Validator: downgraded dupl type decl to warning
authorAndrey Tuganov <andreyt@google.com>
Wed, 1 Mar 2017 17:49:17 +0000 (12:49 -0500)
committerDavid Neto <dneto@google.com>
Wed, 1 Mar 2017 22:50:26 +0000 (17:50 -0500)
Validator check for uniqueness of type declarations
(commit 0e9c24fdd112e7742b9b5dcff35aee32e71a66fd)
was causing failures in vulkancts tests.

Downgrading from error to warning.

source/validate_type_unique.cpp
test/val/val_type_unique_test.cpp

index 857a0f5..c0dbeca 100644 (file)
@@ -36,7 +36,11 @@ spv_result_t TypeUniquePass(ValidationState_t& _,
     }
 
     if (!_.RegisterUniqueTypeDeclaration(*inst)) {
-      return _.diag(SPV_ERROR_INVALID_DATA)
+      // TODO(atgoo@github) Error logging temporarily disabled because it's
+      // failing vulkancts tests. Message in the diagnostics is for unit tests.
+      // See https://github.com/KhronosGroup/SPIRV-Tools/issues/559
+      // return _.diag(SPV_ERROR_INVALID_DATA)
+      return _.diag(SPV_SUCCESS)
           << "Duplicate non-aggregate type declarations are not allowed."
           << " Opcode: " << inst->opcode;
     }
index f51cd9b..9dd44ed 100644 (file)
@@ -25,10 +25,14 @@ namespace {
 using ::testing::HasSubstr;
 
 using std::string;
-using std::pair;
 
 using ValidateTypeUnique = spvtest::ValidateBase<bool>;
 
+// TODO(atgoo@github) Error logging temporarily disabled because it's failing
+// vulkancts tests. See https://github.com/KhronosGroup/SPIRV-Tools/issues/559
+// const spv_result_t kDuplicateTypeError = SPV_ERROR_INVALID_DATA;
+const spv_result_t kDuplicateTypeError = SPV_SUCCESS;
+
 const string& GetHeader() {
   static const string header = R"(
 OpCapability Shader
@@ -102,7 +106,7 @@ TEST_F(ValidateTypeUnique, duplicate_void) {
 %boolt2 = OpTypeVoid
 )" + GetBody();
   CompileSuccessfully(str.c_str());
-  ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions());
+  ASSERT_EQ(kDuplicateTypeError, ValidateInstructions());
   EXPECT_THAT(getDiagnosticString(), HasSubstr(GetErrorString(SpvOpTypeVoid)));
 }
 
@@ -111,7 +115,7 @@ TEST_F(ValidateTypeUnique, duplicate_bool) {
 %boolt2 = OpTypeBool
 )" + GetBody();
   CompileSuccessfully(str.c_str());
-  ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions());
+  ASSERT_EQ(kDuplicateTypeError, ValidateInstructions());
   EXPECT_THAT(getDiagnosticString(), HasSubstr(GetErrorString(SpvOpTypeBool)));
 }
 
@@ -120,7 +124,7 @@ TEST_F(ValidateTypeUnique, duplicate_int) {
 %uintt2 = OpTypeInt 32 0
 )" + GetBody();
   CompileSuccessfully(str.c_str());
-  ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions());
+  ASSERT_EQ(kDuplicateTypeError, ValidateInstructions());
   EXPECT_THAT(getDiagnosticString(), HasSubstr(GetErrorString(SpvOpTypeInt)));
 }
 
@@ -129,7 +133,7 @@ TEST_F(ValidateTypeUnique, duplicate_float) {
 %floatt2 = OpTypeFloat 32
 )" + GetBody();
   CompileSuccessfully(str.c_str());
-  ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions());
+  ASSERT_EQ(kDuplicateTypeError, ValidateInstructions());
   EXPECT_THAT(getDiagnosticString(), HasSubstr(GetErrorString(SpvOpTypeFloat)));
 }
 
@@ -138,7 +142,7 @@ TEST_F(ValidateTypeUnique, duplicate_vec3) {
 %vec3t2 = OpTypeVector %floatt 3
 )" + GetBody();
   CompileSuccessfully(str.c_str());
-  ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions());
+  ASSERT_EQ(kDuplicateTypeError, ValidateInstructions());
   EXPECT_THAT(getDiagnosticString(),
               HasSubstr(GetErrorString(SpvOpTypeVector)));
 }
@@ -148,7 +152,7 @@ TEST_F(ValidateTypeUnique, duplicate_mat33) {
 %mat33t2 = OpTypeMatrix %vec3t 3
 )" + GetBody();
   CompileSuccessfully(str.c_str());
-  ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions());
+  ASSERT_EQ(kDuplicateTypeError, ValidateInstructions());
   EXPECT_THAT(getDiagnosticString(),
               HasSubstr(GetErrorString(SpvOpTypeMatrix)));
 }
@@ -158,7 +162,7 @@ TEST_F(ValidateTypeUnique, duplicate_vfunc) {
 %vfunct2 = OpTypeFunction %voidt
 )" + GetBody();
   CompileSuccessfully(str.c_str());
-  ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions());
+  ASSERT_EQ(kDuplicateTypeError, ValidateInstructions());
   EXPECT_THAT(getDiagnosticString(),
               HasSubstr(GetErrorString(SpvOpTypeFunction)));
 }
@@ -175,8 +179,7 @@ OpMemoryModel Physical32 OpenCL
 %ps2 = OpTypePipeStorage
 )";
   CompileSuccessfully(str.c_str(), SPV_ENV_UNIVERSAL_1_1);
-  ASSERT_EQ(SPV_ERROR_INVALID_DATA,
-            ValidateInstructions(SPV_ENV_UNIVERSAL_1_1));
+  ASSERT_EQ(kDuplicateTypeError, ValidateInstructions(SPV_ENV_UNIVERSAL_1_1));
   EXPECT_THAT(getDiagnosticString(),
               HasSubstr(GetErrorString(SpvOpTypePipeStorage)));
 }
@@ -192,8 +195,7 @@ OpMemoryModel Physical32 OpenCL
 %nb2 = OpTypeNamedBarrier
 )";
   CompileSuccessfully(str.c_str(), SPV_ENV_UNIVERSAL_1_1);
-  ASSERT_EQ(SPV_ERROR_INVALID_DATA,
-            ValidateInstructions(SPV_ENV_UNIVERSAL_1_1));
+  ASSERT_EQ(kDuplicateTypeError, ValidateInstructions(SPV_ENV_UNIVERSAL_1_1));
   EXPECT_THAT(getDiagnosticString(),
               HasSubstr(GetErrorString(SpvOpTypeNamedBarrier)));
 }