Browse Source

Add caps check for optional 16bit ops support to several execution tests. (#3222)

Helena Kotas 4 years ago
parent
commit
6a1138a055
1 changed files with 69 additions and 3 deletions
  1. 69 3
      tools/clang/unittests/HLSL/ExecutionTest.cpp

+ 69 - 3
tools/clang/unittests/HLSL/ExecutionTest.cpp

@@ -3978,6 +3978,13 @@ TEST_F(ExecutionTest, UnaryHalfOpTest) {
     if (!CreateDevice(&pDevice, D3D_SHADER_MODEL::D3D_SHADER_MODEL_6_2)) {
       return;
     }
+
+    if (!DoesDeviceSupportNative16bitOps(pDevice)) {
+      WEX::Logging::Log::Comment(L"Device does not support native 16-bit operations.");
+      WEX::Logging::Log::Result(WEX::Logging::TestResults::Skipped);
+      return;
+    }
+
     // Read data from the table
     int tableSize = sizeof(UnaryHalfOpParameters) / sizeof(TableParameter);
     TableParameterHandler handler(UnaryHalfOpParameters, tableSize);
@@ -4047,6 +4054,13 @@ TEST_F(ExecutionTest, BinaryHalfOpTest) {
     if (!CreateDevice(&pDevice, D3D_SHADER_MODEL::D3D_SHADER_MODEL_6_2)) {
         return;
     }
+
+    if (!DoesDeviceSupportNative16bitOps(pDevice)) {
+      WEX::Logging::Log::Comment(L"Device does not support native 16-bit operations.");
+      WEX::Logging::Log::Result(WEX::Logging::TestResults::Skipped);
+      return;
+    }
+  
     // Read data from the table
     int tableSize = sizeof(BinaryHalfOpParameters) / sizeof(TableParameter);
     TableParameterHandler handler(BinaryHalfOpParameters, tableSize);
@@ -4141,8 +4155,14 @@ TEST_F(ExecutionTest, TertiaryHalfOpTest) {
     if (!CreateDevice(&pDevice, D3D_SHADER_MODEL::D3D_SHADER_MODEL_6_2)) {
         return;
     }
+
+    if (!DoesDeviceSupportNative16bitOps(pDevice)) {
+      WEX::Logging::Log::Comment(L"Device does not support native 16-bit operations.");
+      WEX::Logging::Log::Result(WEX::Logging::TestResults::Skipped);
+      return;
+    }
+
     // Read data from the table
-    
     int tableSize = sizeof(TertiaryHalfOpParameters) / sizeof(TableParameter);
     TableParameterHandler handler(TertiaryHalfOpParameters, tableSize);
 
@@ -4655,8 +4675,14 @@ TEST_F(ExecutionTest, UnaryInt16OpTest) {
   if (!CreateDevice(&pDevice, D3D_SHADER_MODEL::D3D_SHADER_MODEL_6_2)) {
     return;
   }
-  // Read data from the table
 
+  if (!DoesDeviceSupportNative16bitOps(pDevice)) {
+    WEX::Logging::Log::Comment(L"Device does not support native 16-bit operations.");
+    WEX::Logging::Log::Result(WEX::Logging::TestResults::Skipped);
+    return;
+  }
+
+  // Read data from the table
   int tableSize = sizeof(UnaryInt16OpParameters) / sizeof(TableParameter);
   TableParameterHandler handler(UnaryInt16OpParameters, tableSize);
 
@@ -4715,8 +4741,14 @@ TEST_F(ExecutionTest, UnaryUint16OpTest) {
   if (!CreateDevice(&pDevice, D3D_SHADER_MODEL::D3D_SHADER_MODEL_6_2)) {
     return;
   }
-  // Read data from the table
 
+  if (!DoesDeviceSupportNative16bitOps(pDevice)) {
+    WEX::Logging::Log::Comment(L"Device does not support native 16-bit operations.");
+    WEX::Logging::Log::Result(WEX::Logging::TestResults::Skipped);
+    return;
+  }
+
+  // Read data from the table
   int tableSize = sizeof(UnaryUint16OpParameters) / sizeof(TableParameter);
   TableParameterHandler handler(UnaryUint16OpParameters, tableSize);
 
@@ -4775,6 +4807,13 @@ TEST_F(ExecutionTest, BinaryInt16OpTest) {
   if (!CreateDevice(&pDevice, D3D_SHADER_MODEL::D3D_SHADER_MODEL_6_2)) {
     return;
   }
+
+  if (!DoesDeviceSupportNative16bitOps(pDevice)) {
+    WEX::Logging::Log::Comment(L"Device does not support native 16-bit operations.");
+    WEX::Logging::Log::Result(WEX::Logging::TestResults::Skipped);
+    return;
+  }
+
   // Read data from the table
   size_t tableSize = sizeof(BinaryInt16OpParameters) / sizeof(TableParameter);
   TableParameterHandler handler(BinaryInt16OpParameters, tableSize);
@@ -4866,6 +4905,13 @@ TEST_F(ExecutionTest, TertiaryInt16OpTest) {
   if (!CreateDevice(&pDevice, D3D_SHADER_MODEL::D3D_SHADER_MODEL_6_2)) {
     return;
   }
+
+  if (!DoesDeviceSupportNative16bitOps(pDevice)) {
+    WEX::Logging::Log::Comment(L"Device does not support native 16-bit operations.");
+    WEX::Logging::Log::Result(WEX::Logging::TestResults::Skipped);
+    return;
+  }
+
   // Read data from the table
   size_t tableSize = sizeof(TertiaryInt16OpParameters) / sizeof(TableParameter);
   TableParameterHandler handler(TertiaryInt16OpParameters, tableSize);
@@ -4935,6 +4981,13 @@ TEST_F(ExecutionTest, BinaryUint16OpTest) {
   if (!CreateDevice(&pDevice, D3D_SHADER_MODEL::D3D_SHADER_MODEL_6_2)) {
     return;
   }
+
+  if (!DoesDeviceSupportNative16bitOps(pDevice)) {
+    WEX::Logging::Log::Comment(L"Device does not support native 16-bit operations.");
+    WEX::Logging::Log::Result(WEX::Logging::TestResults::Skipped);
+    return;
+  }
+
   // Read data from the table
   size_t tableSize = sizeof(BinaryUint16OpParameters) / sizeof(TableParameter);
   TableParameterHandler handler(BinaryUint16OpParameters, tableSize);
@@ -5023,6 +5076,13 @@ TEST_F(ExecutionTest, TertiaryUint16OpTest) {
   if (!CreateDevice(&pDevice, D3D_SHADER_MODEL::D3D_SHADER_MODEL_6_2)) {
     return;
   }
+
+  if (!DoesDeviceSupportNative16bitOps(pDevice)) {
+    WEX::Logging::Log::Comment(L"Device does not support native 16-bit operations.");
+    WEX::Logging::Log::Result(WEX::Logging::TestResults::Skipped);
+    return;
+  }
+
   // Read data from the table
   size_t tableSize = sizeof(TertiaryUint16OpParameters) / sizeof(TableParameter);
   TableParameterHandler handler(TertiaryUint16OpParameters, tableSize);
@@ -6372,6 +6432,12 @@ TEST_F(ExecutionTest, CBufferTestHalf) {
   if (!CreateDevice(&pDevice, D3D_SHADER_MODEL_6_2))
     return;
 
+  if (!DoesDeviceSupportNative16bitOps(pDevice)) {
+    WEX::Logging::Log::Comment(L"Device does not support native 16-bit operations.");
+    WEX::Logging::Log::Result(WEX::Logging::TestResults::Skipped);
+    return;
+  }
+
   uint16_t InputData[] = { 0x3F80, 0x3F00, 0x3D80, 0x7BFF };
 
   std::shared_ptr<ShaderOpTestResult> test = RunShaderOpTest(pDevice, m_support, pStream, "CBufferTestHalf",