Merge branch 'blender-v3.2-release'
This commit is contained in:
commit
e7464dffbc
|
@ -164,7 +164,7 @@ float attr_load_float(samplerBuffer cd_buf)
|
|||
* \{ */
|
||||
|
||||
# ifndef OBINFO_LIB
|
||||
# error "draw_object_infos is mandatory for volume objects"
|
||||
# error draw_object_infos is mandatory for volume objects
|
||||
# endif
|
||||
|
||||
vec3 g_orco;
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
* shader files.
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
@ -98,6 +99,10 @@ struct GPUSource {
|
|||
/* Limit to shared header files to avoid the temptation to use C++ syntax in .glsl files. */
|
||||
if (filename.endswith(".h") || filename.endswith(".hh")) {
|
||||
enum_preprocess();
|
||||
quote_preprocess();
|
||||
}
|
||||
else {
|
||||
check_no_quotes();
|
||||
}
|
||||
|
||||
if (is_from_material_library()) {
|
||||
|
@ -173,6 +178,44 @@ struct GPUSource {
|
|||
continue; \
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
*/
|
||||
void check_no_quotes()
|
||||
{
|
||||
#ifdef DEBUG
|
||||
int64_t pos = -1;
|
||||
do {
|
||||
pos = source.find('"', pos + 1);
|
||||
if (pos == -1) {
|
||||
break;
|
||||
}
|
||||
if (!is_in_comment(source, pos)) {
|
||||
print_error(source, pos, "Quote characters are forbidden in GLSL files");
|
||||
}
|
||||
} while (true);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
void quote_preprocess()
|
||||
{
|
||||
if (source.find_first_of('"') == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
processed_source = source;
|
||||
std::replace(processed_source.begin(), processed_source.end(), '"', ' ');
|
||||
|
||||
source = processed_source.c_str();
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform C,C++ enum declaration into GLSL compatible defines and constants:
|
||||
*
|
||||
|
@ -282,6 +325,7 @@ struct GPUSource {
|
|||
if (last_pos != 0) {
|
||||
output += input.substr(last_pos);
|
||||
}
|
||||
|
||||
processed_source = output;
|
||||
source = processed_source.c_str();
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue