瀏覽代碼

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

rdb 1 周之前
父節點
當前提交
8dd2f517f8
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      panda/src/shaderpipeline/shaderCompilerGlslPreProc.cxx

+ 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;
         return false;
       }
       }
       if (!preamble.empty()) {
       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) {
     else if (strcmp(directive, "extension") == 0) {