Pārlūkot izejas kodu

[spirv] -fcgl does not imply -Vd anymore (#974)

Lei Zhang 7 gadi atpakaļ
vecāks
revīzija
0b76ed720f

+ 11 - 11
tools/clang/lib/SPIRV/SPIRVEmitter.cpp

@@ -480,18 +480,18 @@ void SPIRVEmitter::HandleTranslationUnit(ASTContext &context) {
         return;
       }
     }
+  }
 
-    // Validate the generated SPIR-V code
-    if (!spirvOptions.disableValidation) {
-      std::string messages;
-      if (!spirvToolsValidate(&m, &messages)) {
-        emitFatalError("generated SPIR-V is invalid: %0", {}) << messages;
-        emitNote("please file a bug report on "
-                 "https://github.com/Microsoft/DirectXShaderCompiler/issues "
-                 "with source code if possible",
-                 {});
-        return;
-      }
+  // Validate the generated SPIR-V code
+  if (!spirvOptions.disableValidation) {
+    std::string messages;
+    if (!spirvToolsValidate(&m, &messages)) {
+      emitFatalError("generated SPIR-V is invalid: %0", {}) << messages;
+      emitNote("please file a bug report on "
+               "https://github.com/Microsoft/DirectXShaderCompiler/issues "
+               "with source code if possible",
+               {});
+      return;
     }
   }
 

+ 2 - 0
tools/clang/unittests/SPIRV/FileTestUtils.cpp

@@ -139,6 +139,8 @@ bool runCompilerWithSpirvGeneration(const llvm::StringRef inputFilePath,
     flags.push_back(L"-spirv");
     // Disable legalization and optimization for testing
     flags.push_back(L"-fcgl");
+    // Disable validation. We'll run it manually.
+    flags.push_back(L"-Vd");
     for (const auto &arg : rest)
       flags.push_back(arg.c_str());