mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
Work around bug in certain Intel drivers with #pragma include
This commit is contained in:
parent
449d4c8a89
commit
873fd3294a
@ -2274,15 +2274,14 @@ r_preprocess_source(ostream &out, const Filename &fn,
|
|||||||
bool had_include = false;
|
bool had_include = false;
|
||||||
int lineno = 0;
|
int lineno = 0;
|
||||||
while (getline(*source, line)) {
|
while (getline(*source, line)) {
|
||||||
// We always forward the actual line - the GLSL compiler will
|
|
||||||
// silently ignore #pragma lines anyway.
|
|
||||||
++lineno;
|
++lineno;
|
||||||
out << line << "\n";
|
|
||||||
|
|
||||||
// Check if this line contains a #pragma.
|
// Check if this line contains a #pragma.
|
||||||
char pragma[64];
|
char pragma[64];
|
||||||
if (line.size() < 8 ||
|
if (line.size() < 8 ||
|
||||||
sscanf(line.c_str(), " # pragma %63s", pragma) != 1) {
|
sscanf(line.c_str(), " # pragma %63s", pragma) != 1) {
|
||||||
|
// Just pass the line through unmodified.
|
||||||
|
out << line << "\n";
|
||||||
|
|
||||||
// One exception: check for an #endif after an include. We have
|
// One exception: check for an #endif after an include. We have
|
||||||
// to restore the line number in case the include happened under
|
// to restore the line number in case the include happened under
|
||||||
@ -2347,8 +2346,11 @@ r_preprocess_source(ostream &out, const Filename &fn,
|
|||||||
|
|
||||||
} else if (strcmp(pragma, "optionNV") == 0) {
|
} else if (strcmp(pragma, "optionNV") == 0) {
|
||||||
// This is processed by NVIDIA drivers. Don't touch it.
|
// This is processed by NVIDIA drivers. Don't touch it.
|
||||||
|
out << line << "\n";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
// Forward it, the driver will ignore it if it doesn't know it.
|
||||||
|
out << line << "\n";
|
||||||
shader_cat.warning()
|
shader_cat.warning()
|
||||||
<< "Ignoring unknown pragma directive \"" << pragma << "\" at line "
|
<< "Ignoring unknown pragma directive \"" << pragma << "\" at line "
|
||||||
<< lineno << " of file " << fn << ":\n " << line << "\n";
|
<< lineno << " of file " << fn << ":\n " << line << "\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user