Forráskód Böngészése

shaderpipeline: Fix #defines inserted before #version in legacy glsl

rdb 1 hete
szülő
commit
8dd2f517f8

+ 5 - 1
panda/src/shaderpipeline/shaderCompilerGlslPreProc.cxx

@@ -349,7 +349,11 @@ r_preprocess_source(State &state, std::istream &in, const std::string &fn,
         return false;
       }
       if (!preamble.empty()) {
-        out << preamble << "#line 1\n";
+        // Preamble goes *after* the version line.
+        out << line << "\n";
+        out << preamble << "\n";
+        write_line_directive = true;
+        continue;
       }
     }
     else if (strcmp(directive, "extension") == 0) {