Blender
V3.3
|
Public Member Functions | |
GPUSource (const char *path, const char *file, const char *datatoc, GPUFunctionDictionnary *g_functions) | |
void | print_error (const StringRef &input, int64_t offset, const StringRef message) |
void | check_no_quotes () |
void | quote_preprocess () |
void | enum_preprocess () |
void | material_functions_parse (GPUFunctionDictionnary *g_functions) |
int | init_dependencies (const GPUSourceDictionnary &dict, const GPUFunctionDictionnary &g_functions) |
void | build (Vector< const char * > &result) const |
shader::BuiltinBits | builtins_get () const |
bool | is_from_material_library () const |
Static Public Member Functions | |
static bool | is_in_comment (const StringRef &input, int64_t offset) |
template<bool check_whole_word = true, bool reversed = false, typename T > | |
static int64_t | find_str (const StringRef &input, const T keyword, int64_t offset=0) |
Public Attributes | |
StringRefNull | fullpath |
StringRefNull | filename |
StringRefNull | source |
Vector< GPUSource * > | dependencies |
bool | dependencies_init = false |
shader::BuiltinBits | builtins = (shader::BuiltinBits)0 |
std::string | processed_source |
Definition at line 39 of file gpu_shader_dependency.cc.
|
inline |
Definition at line 48 of file gpu_shader_dependency.cc.
References builtins, check_no_quotes(), blender::StringRefBase::endswith(), enum_preprocess(), filename, blender::StringRefBase::find(), blender::gpu::shader::FRAG_COORD, blender::gpu::shader::FRONT_FACING, g_functions, blender::gpu::shader::GLOBAL_INVOCATION_ID, blender::gpu::shader::INSTANCE_ID, is_from_material_library(), blender::gpu::shader::LOCAL_INVOCATION_ID, blender::gpu::shader::LOCAL_INVOCATION_INDEX, material_functions_parse(), blender::gpu::shader::NUM_WORK_GROUP, blender::gpu::shader::POINT_COORD, blender::gpu::shader::POINT_SIZE, blender::gpu::shader::PRIMITIVE_ID, quote_preprocess(), source, blender::gpu::shader::VERTEX_ID, blender::gpu::shader::WORK_GROUP_ID, and blender::gpu::shader::WORK_GROUP_SIZE.
Definition at line 576 of file gpu_shader_dependency.cc.
References blender::StringRefNull::c_str(), dependencies, result, and source.
|
inline |
Definition at line 584 of file gpu_shader_dependency.cc.
References dependencies, and blender::gpu::shader::NONE.
Referenced by blender::gpu::shader::gpu_shader_dependency_get_builtins().
|
inline |
Some drivers completely forbid quote characters even in unused preprocessor directives. We fix the cases where we can't manually patch in enum_preprocess()
. This check ensure none are present in non-patched sources. (see T97545)
Definition at line 185 of file gpu_shader_dependency.cc.
References blender::StringRefBase::find(), is_in_comment(), pos, print_error(), and source.
Referenced by GPUSource().
|
inline |
Transform C,C++ enum declaration into GLSL compatible defines and constants:
or
becomes
IMPORTANT: This has some requirements:
Definition at line 251 of file gpu_shader_dependency.cc.
References CHECK, blender::StringRefBase::endswith(), filename, find_keyword, find_token, input, output, processed_source, rfind_token, and source.
Referenced by GPUSource().
|
inlinestatic |
Definition at line 119 of file gpu_shader_dependency.cc.
References ELEM, input, is_in_comment(), and offset.
|
inline |
Definition at line 531 of file gpu_shader_dependency.cc.
References dependencies, blender::StringRefBase::find(), g_functions, init_dependencies(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup_default(), pos, print_error(), result, source, and blender::StringRefBase::substr().
Referenced by init_dependencies().
|
inline |
Definition at line 593 of file gpu_shader_dependency.cc.
References blender::StringRefBase::endswith(), filename, and blender::StringRefBase::startswith().
Referenced by GPUSource().
|
inlinestatic |
Definition at line 112 of file gpu_shader_dependency.cc.
Referenced by check_no_quotes(), and find_str().
|
inline |
Definition at line 332 of file gpu_shader_dependency.cc.
References blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), ARRAY_SIZE, BLI_assert_msg, blender::StringRefBase::copy(), err, blender::StringRefBase::find(), find_keyword, find_token, FUNCTION_QUAL_IN, FUNCTION_QUAL_INOUT, FUNCTION_QUAL_OUT, g_functions, GPU_CLOSURE, GPU_FLOAT, GPU_MAT3, GPU_MAT4, GPU_NONE, GPU_TEX1D_ARRAY, GPU_TEX2D, GPU_TEX2D_ARRAY, GPU_TEX3D, GPU_VEC2, GPU_VEC3, GPU_VEC4, input, blender::bke::curves::bezier::insert(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup(), GPUFunction::name, GPUFunction::paramqual, GPUFunction::paramtype, print_error(), rfind_keyword, GPUFunction::source, source, str, blender::StringRefBase::substr(), GPUFunction::totparam, and type.
Referenced by GPUSource().
|
inline |
Definition at line 152 of file gpu_shader_dependency.cc.
References blender::StringRefBase::begin(), count, blender::StringRefBase::end(), fullpath, input, and offset.
Referenced by check_no_quotes(), init_dependencies(), and material_functions_parse().
|
inline |
Some drivers completely forbid string characters even in unused preprocessor directives. This fixes the cases we cannot manually patch: Shared headers #includes. (see T97545) TODO(fclem): This could be done during the datatoc step.
Definition at line 206 of file gpu_shader_dependency.cc.
References blender::StringRefBase::find_first_of(), processed_source, and source.
Referenced by GPUSource().
shader::BuiltinBits blender::gpu::GPUSource::builtins = (shader::BuiltinBits)0 |
Definition at line 45 of file gpu_shader_dependency.cc.
Referenced by GPUSource().
Definition at line 43 of file gpu_shader_dependency.cc.
Referenced by build(), builtins_get(), and init_dependencies().
bool blender::gpu::GPUSource::dependencies_init = false |
Definition at line 44 of file gpu_shader_dependency.cc.
StringRefNull blender::gpu::GPUSource::filename |
Definition at line 41 of file gpu_shader_dependency.cc.
Referenced by enum_preprocess(), gpu_material_library_use_function(), GPUSource(), and is_from_material_library().
StringRefNull blender::gpu::GPUSource::fullpath |
Definition at line 40 of file gpu_shader_dependency.cc.
Referenced by print_error().
std::string blender::gpu::GPUSource::processed_source |
Definition at line 46 of file gpu_shader_dependency.cc.
Referenced by enum_preprocess(), and quote_preprocess().
StringRefNull blender::gpu::GPUSource::source |
Definition at line 42 of file gpu_shader_dependency.cc.
Referenced by build(), check_no_quotes(), enum_preprocess(), GPUSource(), init_dependencies(), material_functions_parse(), and quote_preprocess().