30#define SHADER_SOURCE(datatoc, filename, filepath) extern char datatoc[];
31#include "glsl_compositor_source_list.h"
32#include "glsl_draw_source_list.h"
33#include "glsl_gpu_source_list.h"
35# include "glsl_ocio_source_list.h"
42using GPUPrintFormatMap = Map<uint32_t, shader::PrintfFormat>;
43using GPUSourceDictionnary = Map<StringRef, struct GPUSource *>;
44using GPUFunctionDictionnary = Map<StringRef, GPUFunction *>;
47 StringRefNull fullpath;
48 StringRefNull filename;
50 Vector<GPUSource *> dependencies;
51 bool dependencies_init =
false;
52 shader::BuiltinBits builtins = shader::BuiltinBits::NONE;
53 std::string processed_source;
55 GPUSource(
const char *path,
58 GPUFunctionDictionnary *g_functions,
60 : fullpath(path), filename(file), source(datatoc)
65 if (source.find(
"gl_FragCoord", 0) != StringRef::not_found) {
66 builtins |= shader::BuiltinBits::FRAG_COORD;
68 if (source.find(
"gl_FrontFacing", 0) != StringRef::not_found) {
69 builtins |= shader::BuiltinBits::FRONT_FACING;
71 if (source.find(
"gl_GlobalInvocationID", 0) != StringRef::not_found) {
72 builtins |= shader::BuiltinBits::GLOBAL_INVOCATION_ID;
74 if (source.find(
"gl_InstanceID", 0) != StringRef::not_found) {
75 builtins |= shader::BuiltinBits::INSTANCE_ID;
77 if (source.find(
"gl_LocalInvocationID", 0) != StringRef::not_found) {
78 builtins |= shader::BuiltinBits::LOCAL_INVOCATION_ID;
80 if (source.find(
"gl_LocalInvocationIndex", 0) != StringRef::not_found) {
81 builtins |= shader::BuiltinBits::LOCAL_INVOCATION_INDEX;
83 if (source.find(
"gl_NumWorkGroup", 0) != StringRef::not_found) {
84 builtins |= shader::BuiltinBits::NUM_WORK_GROUP;
86 if (source.find(
"gl_PointCoord", 0) != StringRef::not_found) {
87 builtins |= shader::BuiltinBits::POINT_COORD;
89 if (source.find(
"gl_PointSize", 0) != StringRef::not_found) {
90 builtins |= shader::BuiltinBits::POINT_SIZE;
92 if (source.find(
"gl_PrimitiveID", 0) != StringRef::not_found) {
93 builtins |= shader::BuiltinBits::PRIMITIVE_ID;
95 if (source.find(
"gl_VertexID", 0) != StringRef::not_found) {
96 builtins |= shader::BuiltinBits::VERTEX_ID;
98 if (source.find(
"gl_WorkGroupID", 0) != StringRef::not_found) {
99 builtins |= shader::BuiltinBits::WORK_GROUP_ID;
101 if (source.find(
"gl_WorkGroupSize", 0) != StringRef::not_found) {
102 builtins |= shader::BuiltinBits::WORK_GROUP_SIZE;
106 if (filename.endswith(
".h") || filename.endswith(
".hh")) {
112 if (source.find(
"'") != StringRef::not_found) {
113 char_literals_preprocess();
116 if (source.find(
"drw_print") != StringRef::not_found) {
119 if ((source.find(
"drw_debug_") != StringRef::not_found) &&
121 filename !=
"draw_debug_print_display_vert.glsl" &&
123 !
ELEM(filename,
"common_debug_draw_lib.glsl",
"draw_debug_draw_display_vert.glsl"))
125 builtins |= shader::BuiltinBits::USE_DEBUG_DRAW;
128#if GPU_SHADER_PRINTF_ENABLE
129 if (source.find(
"printf") != StringRef::not_found) {
131 builtins |= shader::BuiltinBits::USE_PRINTF;
139 if (is_from_material_library()) {
140 material_functions_parse(g_functions);
144 static bool is_in_comment(
const StringRef &input,
int64_t offset)
146 return (input.rfind(
"/*", offset) > input.rfind(
"*/", offset)) ||
147 (input.rfind(
"//", offset) > input.rfind(
"\n", offset));
150 template<
bool check_whole_word = true,
bool reversed = false,
typename T>
151 static int64_t find_str(
const StringRef &input,
const T keyword,
int64_t offset = 0)
154 if constexpr (reversed) {
155 offset = input.rfind(keyword, offset);
158 offset = input.find(keyword, offset);
161 if constexpr (check_whole_word) {
163 char previous_char = input[offset - 1];
164 if (!
ELEM(previous_char,
'\n',
'\t',
' ',
':',
'(',
',')) {
165 offset += (reversed) ? -1 : 1;
170 if (is_in_comment(input, offset)) {
171 offset += (reversed) ? -1 : 1;
179#define find_keyword find_str<true, false>
180#define rfind_keyword find_str<true, true>
181#define find_token find_str<false, false>
182#define rfind_token find_str<false, true>
186 StringRef sub = input.substr(0, offset);
187 int64_t line_number = std::count(sub.begin(), sub.end(),
'\n') + 1;
188 int64_t line_end = input.find(
"\n", offset);
189 int64_t line_start = input.rfind(
"\n", offset) + 1;
190 int64_t char_number = offset - line_start + 1;
194 std::cerr << fullpath <<
":" << line_number <<
":" << char_number;
196 std::cerr <<
" error: " << message <<
"\n";
197 std::cerr << std::setw(5) << line_number <<
" | "
198 << input.substr(line_start, line_end - line_start) <<
"\n";
200 for (
int64_t i = 0; i < char_number - 1; i++) {
206#define CHECK(test_value, str, ofs, msg) \
207 if ((test_value) == -1) { \
208 print_error(str, ofs, msg); \
217 void check_no_quotes()
222 pos = source.find(
'"',
pos + 1);
226 if (!is_in_comment(source,
pos)) {
227 print_error(source,
pos,
"Quote characters are forbidden in GLSL files");
238 void quote_preprocess()
240 if (source.find_first_of(
'"') == -1) {
244 processed_source = source;
245 std::replace(processed_source.begin(), processed_source.end(),
'"',
' ');
247 source = processed_source.c_str();
253 void small_types_check()
256 auto check_type = [&](StringRefNull type_str) {
263 print_error(source, cursor,
"small types are forbidden in shader interfaces");
267 check_type(
"char2 ");
268 check_type(
"char3 ");
269 check_type(
"char4 ");
270 check_type(
"uchar ");
271 check_type(
"uchar2 ");
272 check_type(
"uchar3 ");
273 check_type(
"uchar4 ");
274 check_type(
"short ");
275 check_type(
"short2 ");
276 check_type(
"short3 ");
277 check_type(
"short4 ");
278 check_type(
"ushort ");
279 check_type(
"ushort2 ");
280 check_type(
"ushort3 ");
281 check_type(
"ushort4 ");
283 check_type(
"half2 ");
284 check_type(
"half3 ");
285 check_type(
"half4 ");
322 void enum_preprocess()
324 const StringRefNull input = source;
328 const bool is_cpp = filename.endswith(
".hh");
342 if (cursor >= 8 && input.substr(cursor - 8, 8) ==
"typedef ") {
346 output += input.substr(last_pos, cursor - last_pos);
349 int64_t name_start = input.find(
" ", cursor);
352 CHECK(values_start, input, cursor,
"Malformed enum class. Expected \'{\' after typename.");
354 StringRef enum_name = input.substr(name_start, values_start - name_start);
357 CHECK(name_end, input, name_start,
"Expected \':\' after C++ enum name.");
360 CHECK(underlying_type, input, name_start,
"C++ enums needs uint32_t underlying type.");
362 enum_name = input.substr(name_start, name_end);
365 output +=
"#define " + enum_name +
" uint\n";
369 CHECK(values_end, input, cursor,
"Malformed enum class. Expected \'}\' after values.");
374 StringRef enum_values = input.substr(values_start, values_end - values_start);
378 int64_t not_found = (token == -1) ? 0 : -1;
379 CHECK(not_found, input, values_start + token,
"Unexpected \'{\' token inside enum values.");
384 if (last_comma > last_equal) {
385 enum_values = input.substr(values_start, last_comma);
388 output +=
"const uint " + enum_values;
390 int64_t semicolon_found = (input[values_end + 1] ==
';') ? 0 : -1;
391 CHECK(semicolon_found, input, values_end + 1,
"Expected \';\' after enum type declaration.");
394 cursor = last_pos = values_end + 1;
402 output += input.substr(last_pos);
405 processed_source =
output;
406 source = processed_source.c_str();
409 void material_functions_parse(GPUFunctionDictionnary *g_functions)
411 const StringRefNull input = source;
413 const char whitespace_chars[] =
" \r\n\t";
415 auto function_parse = [&](
const StringRef input,
417 StringRef &out_return_type,
419 StringRef &out_args) ->
bool {
425 if (arg_start == -1) {
434 if (body_start != -1 && next_semicolon != -1 && body_start > next_semicolon) {
436 BLI_assert_msg(
false,
"No prototypes allowed in node GLSL libraries.");
438 int64_t name_start = input.find_first_not_of(whitespace_chars, input.find(
' ', cursor));
439 if (name_start == -1) {
442 int64_t name_end = input.find_last_not_of(whitespace_chars, arg_start);
443 if (name_end == -1) {
447 out_return_type =
"void";
448 out_name = input.substr(name_start, name_end - name_start);
449 out_args = input.substr(arg_start + 1, arg_end - (arg_start + 1));
453 auto keyword_parse = [&](
const StringRef
str,
int64_t &cursor) -> StringRef {
454 int64_t keyword_start =
str.find_first_not_of(whitespace_chars, cursor);
455 if (keyword_start == -1) {
457 return str.substr(0, 0);
459 int64_t keyword_end =
str.find_first_of(whitespace_chars, keyword_start);
460 if (keyword_end == -1) {
462 keyword_end =
str.size();
464 cursor = keyword_end + 1;
465 return str.substr(keyword_start, keyword_end - keyword_start);
468 auto arg_parse = [&](
const StringRef
str,
470 StringRef &out_qualifier,
472 StringRef &out_name) ->
bool {
473 int64_t arg_start = cursor + 1;
474 if (arg_start >=
str.size()) {
482 const StringRef arg =
str.substr(arg_start, cursor - arg_start);
485 out_qualifier = keyword_parse(arg, keyword_cursor);
486 out_type = keyword_parse(arg, keyword_cursor);
487 out_name = keyword_parse(arg, keyword_cursor);
488 if (out_name.is_empty()) {
491 out_type = out_qualifier;
492 out_qualifier = arg.substr(0, 0);
498 StringRef func_return_type, func_name, func_args;
499 while (function_parse(input, cursor, func_return_type, func_name, func_args)) {
501 if (func_name ==
"main") {
505 GPUFunction *func = MEM_new<GPUFunction>(__func__);
506 func_name.copy(func->
name,
sizeof(func->
name));
507 func->
source =
reinterpret_cast<void *
>(
this);
509 bool insert = g_functions->add(func->
name, func);
514 GPUSource *other_source =
reinterpret_cast<GPUSource *
>(
515 g_functions->lookup(func_name)->source);
516 if (other_source !=
this) {
518 source.find(func_name),
519 "Function redefinition or overload in two different files ...");
521 input, other_source->source.find(func_name),
"... previous definition was here");
530 if (func_return_type !=
"void") {
536 StringRef arg_qualifier, arg_type, arg_name;
537 while (arg_parse(func_args, args_cursor, arg_qualifier, arg_type, arg_name)) {
540 print_error(input, source.find(func_name),
"Too much parameter in function");
545 if (qualifier ==
"out") {
548 if (qualifier ==
"inout") {
554 auto parse_type = [](StringRef type) ->
eGPUType {
555 if (type ==
"float") {
558 if (type ==
"vec2") {
561 if (type ==
"vec3") {
564 if (type ==
"vec4") {
567 if (type ==
"mat3") {
570 if (type ==
"mat4") {
573 if (type ==
"sampler1DArray") {
576 if (type ==
"sampler2DArray") {
579 if (type ==
"sampler2D") {
582 if (type ==
"sampler3D") {
585 if (type ==
"Closure") {
595 std::string err =
"Unknown parameter type \"" + arg_type +
"\"";
596 int64_t err_ofs = source.find(func_name);
607 void char_literals_preprocess()
609 const StringRefNull input = source;
620 output << input.substr(last_pos, cursor - last_pos);
623 int64_t char_start = cursor + 1;
625 CHECK(char_end, input, cursor,
"Malformed char literal. Missing ending `'`.");
627 StringRef input_char = input.substr(char_start, char_end - char_start);
628 if (input_char.is_empty()) {
629 CHECK(-1, input, cursor,
"Malformed char literal. Empty character constant");
632 uint8_t char_value = input_char[0];
634 if (input_char[0] ==
'\\') {
635 if (input_char[1] ==
'n') {
639 CHECK(-1, input, cursor,
"Unsupported escaped character");
643 if (input_char.size() > 1) {
644 CHECK(-1, input, cursor,
"Malformed char literal. Multi-character character constant");
652 cursor = last_pos = char_end + 1;
660 output << input.substr(last_pos);
662 processed_source = output.str();
663 source = processed_source.c_str();
667 void string_preprocess()
669 const StringRefNull input = source;
680 bool do_endl =
false;
681 StringRef func = input.substr(cursor);
682 if (func.startswith(
"drw_print(")) {
685 else if (func.startswith(
"drw_print_no_endl(")) {
693 output << input.substr(last_pos, cursor - last_pos);
696 int64_t str_start = input.find(
'(', cursor) + 1;
698 CHECK(semicolon, input, cursor,
"Malformed print(). Missing `;` .");
700 if (str_end < str_start) {
701 CHECK(-1, input, cursor,
"Malformed print(). Missing closing `)` .");
704 std::stringstream sub_output;
705 StringRef input_args = input.substr(str_start, str_end - str_start);
707 auto print_string = [&](std::string
str) ->
int {
708 size_t len_before_pad =
str.length();
710 while (
str.length() % 4 != 0) {
714 sub_output <<
"/* " <<
str <<
"*/";
715 sub_output <<
"drw_print_string_start(" << len_before_pad <<
");";
716 for (
size_t i = 0; i < len_before_pad; i += 4) {
718 *(
reinterpret_cast<const uint8_t *
>(
str.c_str()) + i + 1),
719 *(
reinterpret_cast<const uint8_t *
>(
str.c_str()) + i + 2),
720 *(
reinterpret_cast<const uint8_t *
>(
str.c_str()) + i + 3)};
721 if (i + 4 > len_before_pad) {
722 chars[len_before_pad - i] =
'\0';
725 SNPRINTF(uint_hex,
"0x%.2X%.2X%.2X%.2Xu", chars[3], chars[2], chars[1], chars[0]);
726 sub_output <<
"drw_print_char4(" << StringRefNull(uint_hex) <<
");";
731 std::string func_args = input_args;
734 bool string_scope =
false;
736 for (
char &c : func_args) {
738 string_scope = !string_scope;
740 else if (!string_scope) {
747 else if (c ==
',' && func_scope != 0) {
753 const bool print_as_variable = (input_args[0] !=
'"') &&
find_token(input_args,
',') == -1;
754 if (print_as_variable) {
756 std::string arg = input_args;
758 while (arg.length() % 4 != 0) {
763 sub_output <<
"drw_print_value(" << input_args <<
");";
766 const std::regex arg_regex(
768 "[\\s]*\"([^\r\n\t\f\v\"]*)\""
773 std::smatch args_match;
774 std::string::const_iterator args_search_start(func_args.cbegin());
775 while (std::regex_search(args_search_start, func_args.cend(), args_match, arg_regex)) {
776 args_search_start = args_match.suffix().first;
777 std::string arg_string = args_match[1].str();
778 std::string arg_val = args_match[2].str();
780 if (arg_string.empty()) {
781 for (
char &c : arg_val) {
786 sub_output <<
"drw_print_value(" << arg_val <<
");";
789 print_string(arg_string);
795 sub_output <<
"drw_print_newline();";
798 output << sub_output.str();
800 cursor = last_pos = str_end + 1;
807 if (filename !=
"common_debug_print_lib.glsl") {
808 builtins |= shader::BuiltinBits::USE_DEBUG_PRINT;
812 output << input.substr(last_pos);
814 processed_source = output.str();
815 source = processed_source.c_str();
824 void printf_preprocess(GPUPrintFormatMap *format_map)
826 const StringRefNull input = source;
838 output << input.substr(last_pos, cursor - last_pos);
841 int64_t str_start = input.find(
'(', cursor) + 1;
843 CHECK(semicolon, input, cursor,
"Malformed printf(). Missing `;` .");
845 if (str_end < str_start) {
846 CHECK(-1, input, cursor,
"Malformed printf(). Missing closing `)` .");
849 StringRef input_args = input.substr(str_start, str_end - str_start);
851 std::string func_args = input_args;
855 bool string_scope =
false;
857 for (
char &c : func_args) {
859 string_scope = !string_scope;
861 else if (!string_scope) {
868 else if (c ==
',' && func_scope != 0) {
875 Vector<std::string> arguments;
877 const std::regex arg_regex(
879 "[\\s]*\"([^\r\n\t\f\v\"]*)\""
884 std::smatch args_match;
885 std::string::const_iterator args_search_start(func_args.cbegin());
886 while (std::regex_search(args_search_start, func_args.cend(), args_match, arg_regex)) {
887 args_search_start = args_match.suffix().first;
888 std::string arg_string = args_match[1].str();
889 std::string arg_val = args_match[2].str();
891 if (!arg_string.empty()) {
893 CHECK(-1, input, cursor,
"Format string is not the only string arg.");
895 if (!arguments.is_empty()) {
896 CHECK(-1, input, cursor,
"Format string is not first argument.");
901 for (
char &c : arg_val) {
907 arguments.append(arg_val);
913 CHECK(-1, input, cursor,
"No format string found.");
916 int format_arg_count = std::count(
format.begin(),
format.end(),
'%');
917 if (format_arg_count > arguments.size()) {
918 CHECK(-1, input, cursor,
"printf call has not enough arguments.");
921 if (format_arg_count < arguments.size()) {
922 CHECK(-1, input, cursor,
"printf call has too many arguments.");
929 if (format_map->contains(format_hash)) {
930 if (format_map->lookup(format_hash).format_str !=
format) {
931 CHECK(-1, input, cursor,
"printf format hash collision.");
938 shader::PrintfFormat fmt;
943 format = std::regex_replace(
format, std::regex(R
"(\\n)"), "\n");
944 format = std::regex_replace(
format, std::regex(R
"(\\v)"), "\v");
945 format = std::regex_replace(
format, std::regex(R
"(\\t)"), "\t");
946 format = std::regex_replace(
format, std::regex(R
"(\\')"), "\'");
947 format = std::regex_replace(
format, std::regex(R
"(\\")"), "\"");
948 format = std::regex_replace(
format, std::regex(R
"(\\\\)"), "\\");
950 shader::PrintfFormat::Block::ArgumentType type =
951 shader::PrintfFormat::Block::ArgumentType::NONE;
953 while ((end =
format.find_first_of(
'%', start + 1)) != -1) {
955 fmt.format_blocks.append({type,
format.substr(start, end - start)});
958 switch (
format[end + 1]) {
961 type = shader::PrintfFormat::Block::ArgumentType::UINT;
964 type = shader::PrintfFormat::Block::ArgumentType::INT;
967 type = shader::PrintfFormat::Block::ArgumentType::FLOAT;
976 fmt.format_blocks.append({type,
format.substr(start,
format.size() - start)});
978 format_map->add(format_hash, fmt);
981 std::string sub_output =
"print_header(" + std::to_string(format_hash) +
"u, " +
982 std::to_string(format_arg_count) +
"u)";
983 for (std::string &arg : arguments) {
984 sub_output =
"print_data(" + sub_output +
", " + arg +
")";
987 output << sub_output <<
";\n";
989 cursor = last_pos = str_end + 1;
997 output << input.substr(last_pos);
999 processed_source = output.str();
1000 source = processed_source.c_str();
1009 int init_dependencies(
const GPUSourceDictionnary &dict,
1010 const GPUFunctionDictionnary &g_functions)
1012 if (this->dependencies_init) {
1015 this->dependencies_init =
true;
1018 using namespace shader;
1020 if ((builtins & BuiltinBits::USE_PRINTF) == BuiltinBits::USE_PRINTF) {
1021 dependencies.append_non_duplicates(dict.lookup(
"gpu_shader_print_lib.glsl"));
1023 if ((builtins & BuiltinBits::USE_DEBUG_DRAW) == BuiltinBits::USE_DEBUG_DRAW) {
1024 dependencies.append_non_duplicates(dict.lookup(
"common_debug_draw_lib.glsl"));
1026 if ((builtins & BuiltinBits::USE_DEBUG_PRINT) == BuiltinBits::USE_DEBUG_PRINT) {
1027 dependencies.append_non_duplicates(dict.lookup(
"common_debug_print_lib.glsl"));
1031 GPUSource *dependency_source =
nullptr;
1034 pos = source.find(
"pragma BLENDER_REQUIRE(",
pos + 1);
1041 print_error(source, start,
"Malformed BLENDER_REQUIRE: Missing \")\" token");
1044 StringRef dependency_name = source.substr(start, end - start);
1045 dependency_source = dict.lookup_default(dependency_name,
nullptr);
1046 if (dependency_source ==
nullptr) {
1047 print_error(source, start,
"Dependency not found");
1053 int result = dependency_source->init_dependencies(dict, g_functions);
1058 for (
auto *dep : dependency_source->dependencies) {
1059 dependencies.append_non_duplicates(dep);
1061 dependencies.append_non_duplicates(dependency_source);
1069 void build(Vector<const char *> &result)
const
1071 for (
auto *dep : dependencies) {
1072 result.append(dep->source.c_str());
1074 result.append(source.c_str());
1077 shader::BuiltinBits builtins_get()
const
1079 shader::BuiltinBits out_builtins = builtins;
1080 for (
auto *dep : dependencies) {
1081 out_builtins |= dep->builtins;
1083 return out_builtins;
1086 bool is_from_material_library()
const
1088 return (filename.startswith(
"gpu_shader_material_") ||
1089 filename.startswith(
"gpu_shader_common_") ||
1090 filename.startswith(
"gpu_shader_compositor_")) &&
1091 filename.endswith(
".glsl");
1099static GPUPrintFormatMap *
g_formats =
nullptr;
1100static GPUSourceDictionnary *g_sources =
nullptr;
1101static GPUFunctionDictionnary *g_functions =
nullptr;
1102static bool force_printf_injection =
false;
1107 g_sources =
new GPUSourceDictionnary();
1108 g_functions =
new GPUFunctionDictionnary();
1110#define SHADER_SOURCE(datatoc, filename, filepath) \
1111 g_sources->add_new(filename, new GPUSource(filepath, filename, datatoc, g_functions, g_formats));
1112#include "glsl_compositor_source_list.h"
1113#include "glsl_draw_source_list.h"
1114#include "glsl_gpu_source_list.h"
1116# include "glsl_ocio_source_list.h"
1121 for (
auto *value : g_sources->values()) {
1122 errors += value->init_dependencies(*g_sources, *g_functions);
1124 BLI_assert_msg(errors == 0,
"Dependency errors detected: Aborting");
1127#if GPU_SHADER_PRINTF_ENABLE
1131 for (
auto *value : g_sources->values()) {
1132 if ((value->builtins & shader::BuiltinBits::USE_PRINTF) != shader::BuiltinBits::USE_PRINTF) {
1133 if (value->filename.startswith(
"gpu_shader_material_")) {
1134 force_printf_injection =
true;
1145 for (
auto *value : g_sources->values()) {
1148 for (
auto *value : g_functions->values()) {
1155 g_sources =
nullptr;
1156 g_functions =
nullptr;
1161 GPUFunction *function = g_functions->lookup_default(name,
nullptr);
1162 BLI_assert_msg(function !=
nullptr,
"Requested function not in the function library");
1163 GPUSource *source =
reinterpret_cast<GPUSource *
>(function->source);
1164 BLI_gset_add(used_libraries,
const_cast<char *
>(source->filename.c_str()));
1174 return force_printf_injection;
1189 if (shader_source_name.
is_empty()) {
1192 if (g_sources->contains(shader_source_name) ==
false) {
1193 std::cerr <<
"Error: Could not find \"" << shader_source_name
1194 <<
"\" in the list of registered source.\n";
1198 GPUSource *source = g_sources->lookup(shader_source_name);
1199 return source->builtins_get();
1205 Vector<const char *>
result;
1206 GPUSource *src = g_sources->lookup_default(shader_source_name,
nullptr);
1207 if (src ==
nullptr) {
1208 std::cerr <<
"Error source not found : " << shader_source_name << std::endl;
1216 GPUSource *src = g_sources->lookup_default(shader_source_name,
nullptr);
1217 if (src ==
nullptr) {
1218 std::cerr <<
"Error source not found : " << shader_source_name << std::endl;
1226 for (
auto &source : g_sources->values()) {
1227 if (source->source.c_str() == source_string.
c_str()) {
1228 return source->filename;
#define BLI_assert_unreachable()
#define BLI_assert_msg(a, msg)
bool BLI_gset_add(GSet *gs, void *key)
void BLI_kdtree_nd_ insert(KDTree *tree, int index, const float co[KD_DIMS]) ATTR_NONNULL(1
#define SNPRINTF(dst, format,...)
#define UNUSED_VARS_NDEBUG(...)
eGPUBackendType GPU_backend_get_type()
void build(btStridingMeshInterface *triangles, bool useQuantizedAabbCompression, const btVector3 &bvhAabbMin, const btVector3 &bvhAabbMax)
constexpr bool is_empty() const
constexpr const char * c_str() const
GPUFunction * gpu_material_library_use_function(GSet *used_libraries, const char *name)
#define CHECK(test_value, str, ofs, msg)
void gpu_shader_dependency_init()
void gpu_shader_dependency_exit()
static uint hash_string(const char *str)
static void print_error(const char *message, va_list str_format_args)
StringRefNull gpu_shader_dependency_get_filename_from_source_string(const StringRefNull source_string)
Find the name of the file from which the given string was generated.
const PrintfFormat & gpu_shader_dependency_get_printf_format(uint32_t format_hash)
Vector< const char * > gpu_shader_dependency_get_resolved_source(const StringRefNull source_name)
BuiltinBits gpu_shader_dependency_get_builtins(const StringRefNull source_name)
bool gpu_shader_dependency_has_printf()
StringRefNull gpu_shader_dependency_get_source(const StringRefNull source_name)
bool gpu_shader_dependency_force_gpu_print_injection()
static OVERLAY_InstanceFormats g_formats
unsigned __int64 uint64_t
eGPUType paramtype[MAX_PARAMETER]
char name[MAX_FUNCTION_NAME]
GPUFunctionQual paramqual[MAX_PARAMETER]
static const char hex[17]