Browse Source

Fail lib_6_1/2 without -Vd

Tex Riddell 7 years ago
parent
commit
b7850a24df

+ 10 - 1
lib/DxcSupport/HLSLOptions.cpp

@@ -554,7 +554,16 @@ int ReadDxcOpts(const OptTable *optionTable, unsigned flagsToInclude,
     opts.DisableValidation = true;
   }
 
-  // SPIRV Change Starts
+  // Disable lib_6_1 and lib_6_2 if /Vd is not present
+  if (opts.IsLibraryProfile() && (Major < 6 || (Major == 6 && Minor < 3))) {
+    if (!opts.DisableValidation) {
+      errors << "Must disable validation for unsupported lib_6_1 or lib_6_2 "
+                "targets.";
+      return 1;
+    }
+  }
+
+    // SPIRV Change Starts
 #ifdef ENABLE_SPIRV_CODEGEN
   const bool genSpirv = opts.GenSPIRV = Args.hasFlag(OPT_spirv, OPT_INVALID, false);
   opts.VkInvertY = Args.hasFlag(OPT_fvk_invert_y, OPT_INVALID, false);

+ 1 - 1
tools/clang/test/CodeGenHLSL/quick-test/lib_append_buf.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -T lib_6_2 %s | FileCheck %s
+// RUN: %dxc -T lib_6_3 %s | FileCheck %s
 
 // Make sure append/consume works for lib.
 // CHECK: bufferUpdateCounter(i32 70, {{.*}}, i8 -1)

+ 1 - 1
tools/clang/test/CodeGenHLSL/quick-test/lib_mat_entry7.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -T lib_6_1  %s | FileCheck %s
+// RUN: %dxc -T lib_6_1 -Vd  %s | FileCheck %s
 
 // Make sure double matrix flattened and have correct offset.
 // CHECK:dx.op.bufferLoad.i32(i32 68, %dx.types.Handle {{.*}}, i32 {{.*}}, i32 0)

+ 1 - 1
tools/clang/test/HLSL/ctbuf.hlsl

@@ -1,4 +1,4 @@
-// RUN: %dxc -T lib_6_1 -ast-dump %s | FileCheck %s
+// RUN: %dxc -T lib_6_3 -ast-dump %s | FileCheck %s
 
 struct S {
   float4 f;

+ 2 - 2
tools/clang/unittests/HLSL/LinkerTest.cpp

@@ -461,7 +461,7 @@ TEST_F(LinkerTest, RunLinkToLibWithUnresolvedFunctions) {
   LPCWSTR libName2 = L"lib2";
   RegisterDxcModule(libName2, pLib2, pLinker);
 
-  Link(L"", L"lib_6_2", pLinker, { libName1, libName2 }, {
+  Link(L"", L"lib_6_3", pLinker, { libName1, libName2 }, {
     "declare float @\"\\01?external_fn1@@YAMXZ\"()",
     "declare float @\"\\01?external_fn2@@YAMXZ\"()",
     "declare float @\"\\01?external_fn@@YAMXZ\"()",
@@ -633,7 +633,7 @@ TEST_F(LinkerTest, RunLinkWithPotentialIntrinsicNameCollisions) {
   LPCWSTR libName2 = L"lib2";
   RegisterDxcModule(libName2, pLib2, pLinker);
 
-  Link(L"", L"lib_6_2", pLinker, { libName1, libName2 }, {
+  Link(L"", L"lib_6_3", pLinker, { libName1, libName2 }, {
     "declare %dx.types.Handle @\"dx.op.createHandleForLib.class.Texture2D<vector<float, 4> >\"(i32, %\"class.Texture2D<vector<float, 4> >\")",
     "declare %dx.types.Handle @\"dx.op.createHandleForLib.class.Texture2D<float>\"(i32, %\"class.Texture2D<float>\")"
   }, { });

+ 1 - 1
tools/clang/unittests/dxc_batch/dxc_batch.cpp

@@ -856,7 +856,7 @@ int __cdecl wmain(int argc, const wchar_t **argv_) {
     std::vector<std::string> args(tmpArgStrings.begin(), tmpArgStrings.end());
     // Add target to avoid fail.
     args.emplace_back("-T");
-    args.emplace_back("lib_6_1");
+    args.emplace_back("lib_6_x");
 
     std::vector<StringRef> refArgs;
     refArgs.reserve(args.size());

+ 4 - 4
utils/hct/hcttestcmds.cmd

@@ -520,15 +520,15 @@ if %errorlevel% neq 0 (
 )
 
 echo Smoke test for dxl command line ...
-dxc.exe -T lib_6_1 "%2"\..\CodeGenHLSL\lib_entry4.hlsl -Fo lib_entry4.dxbc 1>nul
+dxc.exe -T lib_6_x "%2"\..\CodeGenHLSL\lib_entry4.hlsl -Fo lib_entry4.dxbc 1>nul
 if %errorlevel% neq 0 (
-  echo Failed to run dxc.exe -T "%2"\..\CodeGenHLSL\lib_6_1 lib_entry4.hlsl -Fo lib_entry4.dxbc
+  echo Failed to run dxc.exe -T "%2"\..\CodeGenHLSL\lib_6_x lib_entry4.hlsl -Fo lib_entry4.dxbc
   call :cleanup 2>nul
   exit /b 1
 )
-dxc.exe -T lib_6_1 "%2"\..\CodeGenHLSL\lib_res_match.hlsl -Fo lib_res_match.dxbc 1>nul
+dxc.exe -T lib_6_x "%2"\..\CodeGenHLSL\lib_res_match.hlsl -Fo lib_res_match.dxbc 1>nul
 if %errorlevel% neq 0 (
-  echo Failed to run dxc.exe -T "%2"\..\CodeGenHLSL\lib_6_1 lib_res_match.hlsl -Fo lib_res_match.dxbc
+  echo Failed to run dxc.exe -T "%2"\..\CodeGenHLSL\lib_6_x lib_res_match.hlsl -Fo lib_res_match.dxbc
   call :cleanup 2>nul
   exit /b 1
 )