|
Blender V4.3
|
Public Member Functions | |
| GPUSource (const char *path, const char *file, const char *datatoc, GPUFunctionDictionnary *g_functions, GPUPrintFormatMap *g_formats) | |
| void | print_error (const StringRef &input, int64_t offset, const StringRef message) |
| void | check_no_quotes () |
| void | quote_preprocess () |
| void | small_types_check () |
| void | enum_preprocess () |
| void | material_functions_parse (GPUFunctionDictionnary *g_functions) |
| void | char_literals_preprocess () |
| void | string_preprocess () |
| void | printf_preprocess (GPUPrintFormatMap *format_map) |
| 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::NONE |
| std::string | processed_source |
Definition at line 46 of file gpu_shader_dependency.cc.
|
inline |
Definition at line 55 of file gpu_shader_dependency.cc.
References builtins, check_no_quotes(), ELEM, else, filename, fullpath, g_formats, g_functions, if(), blender::StringRefBase::not_found, source, and blender::gpu::shader::USE_DEBUG_DRAW.
Referenced by init_dependencies(), and material_functions_parse().
|
inline |
Definition at line 1069 of file gpu_shader_dependency.cc.
References dependencies, result, and source.
Referenced by blender::gpu::shader::gpu_shader_dependency_get_resolved_source().
|
inline |
Definition at line 1077 of file gpu_shader_dependency.cc.
References builtins, and dependencies.
Referenced by blender::gpu::shader::gpu_shader_dependency_get_builtins().
|
inline |
Definition at line 607 of file gpu_shader_dependency.cc.
References CHECK, find_token, hex, blender::StringRefBase::is_empty(), output, processed_source, blender::StringRefBase::size(), SNPRINTF, source, and blender::StringRefBase::substr().
|
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 #97545)
Definition at line 217 of file gpu_shader_dependency.cc.
References 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 322 of file gpu_shader_dependency.cc.
References CHECK, filename, blender::StringRefBase::find(), find_keyword, find_token, GPU_backend_get_type(), GPU_BACKEND_METAL, output, processed_source, rfind_token, source, and blender::StringRefBase::substr().
|
inlinestatic |
Definition at line 151 of file gpu_shader_dependency.cc.
References ELEM, blender::StringRefBase::find(), is_in_comment(), blender::gpu::reversed(), and blender::StringRefBase::rfind().
|
inline |
Definition at line 1009 of file gpu_shader_dependency.cc.
References BLI_assert_unreachable, builtins, dependencies, g_functions, GPUSource(), init_dependencies(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup_default(), pos, print_error(), result, and source.
Referenced by init_dependencies().
|
inline |
Definition at line 1086 of file gpu_shader_dependency.cc.
References filename.
|
inlinestatic |
Definition at line 144 of file gpu_shader_dependency.cc.
References blender::StringRefBase::rfind().
Referenced by check_no_quotes(), and find_str().
|
inline |
Definition at line 409 of file gpu_shader_dependency.cc.
References ARRAY_SIZE, BLI_assert_msg, blender::StringRefBase::copy(), blender::StringRefBase::find(), blender::StringRefBase::find_first_not_of(), find_keyword, blender::StringRefBase::find_last_not_of(), 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, GPUSource(), insert(), GPUFunction::name, GPUFunction::paramqual, GPUFunction::paramtype, print_error(), rfind_keyword, source, GPUFunction::source, str, blender::StringRefBase::substr(), and GPUFunction::totparam.
|
inline |
Definition at line 184 of file gpu_shader_dependency.cc.
References blender::StringRefBase::begin(), blender::StringRefBase::end(), blender::StringRefBase::find(), fullpath, blender::StringRefBase::rfind(), and blender::StringRefBase::substr().
|
inline |
Preprocess printf statement for correct shader code generation. printf(format, data1, data2) gets replaced by print_data(print_data(print_header(format_hash, 2), data1), data2).
Definition at line 824 of file gpu_shader_dependency.cc.
References blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), blender::Vector< T, InlineBufferCapacity, Allocator >::append(), BLI_assert_msg, CHECK, blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::contains(), blender::StringRefBase::find(), find_keyword, find_token, blender::gpu::shader::PrintfFormat::Block::FLOAT, blender::gpu::shader::PrintfFormat::format_blocks, blender::gpu::shader::PrintfFormat::format_str, blender::hash_string(), blender::gpu::shader::PrintfFormat::Block::INT, blender::Vector< T, InlineBufferCapacity, Allocator >::is_empty(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup(), blender::gpu::shader::PrintfFormat::Block::NONE, output, processed_source, rfind_token, blender::Vector< T, InlineBufferCapacity, Allocator >::size(), source, blender::StringRefBase::substr(), and blender::gpu::shader::PrintfFormat::Block::UINT.
|
inline |
Some drivers completely forbid string characters even in unused preprocessor directives. This fixes the cases we cannot manually patch: Shared headers #includes. (see #97545) TODO(fclem): This could be done during the datatoc step.
Definition at line 238 of file gpu_shader_dependency.cc.
References processed_source, and source.
|
inline |
Assert not small types are present inside shader shared files.
Definition at line 253 of file gpu_shader_dependency.cc.
References find_keyword, print_error(), and source.
|
inline |
Definition at line 667 of file gpu_shader_dependency.cc.
References builtins, CHECK, filename, blender::StringRefBase::find(), find_keyword, find_token, output, processed_source, rfind_token, SNPRINTF, source, blender::StringRefBase::startswith(), str, blender::StringRefBase::substr(), and blender::gpu::shader::USE_DEBUG_PRINT.
| shader::BuiltinBits blender::gpu::GPUSource::builtins = shader::BuiltinBits::NONE |
Definition at line 52 of file gpu_shader_dependency.cc.
Referenced by builtins_get(), GPUSource(), init_dependencies(), and string_preprocess().
Definition at line 50 of file gpu_shader_dependency.cc.
Referenced by build(), builtins_get(), and init_dependencies().
| bool blender::gpu::GPUSource::dependencies_init = false |
Definition at line 51 of file gpu_shader_dependency.cc.
| StringRefNull blender::gpu::GPUSource::filename |
Definition at line 48 of file gpu_shader_dependency.cc.
Referenced by enum_preprocess(), gpu_material_library_use_function(), GPUSource(), is_from_material_library(), and string_preprocess().
| StringRefNull blender::gpu::GPUSource::fullpath |
Definition at line 47 of file gpu_shader_dependency.cc.
Referenced by GPUSource(), and print_error().
| std::string blender::gpu::GPUSource::processed_source |
Definition at line 53 of file gpu_shader_dependency.cc.
Referenced by char_literals_preprocess(), enum_preprocess(), printf_preprocess(), quote_preprocess(), and string_preprocess().
| StringRefNull blender::gpu::GPUSource::source |
Definition at line 49 of file gpu_shader_dependency.cc.
Referenced by build(), char_literals_preprocess(), check_no_quotes(), enum_preprocess(), blender::gpu::shader::gpu_shader_dependency_get_source(), GPUSource(), init_dependencies(), material_functions_parse(), printf_preprocess(), quote_preprocess(), small_types_check(), and string_preprocess().