Skip to content

Commit

Permalink
spirv-val: Collapse ZeroExtend error message
Browse files Browse the repository at this point in the history
  • Loading branch information
spencer-lunarg committed Nov 4, 2023
1 parent 7895cbf commit 03698f1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
9 changes: 2 additions & 7 deletions source/val/validate_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -759,15 +759,10 @@ spv_result_t ValidateImageOperands(ValidationState_t& _,
// void, and the Format is Unknown.
// In Vulkan, the texel type is only known in all cases by the pipeline
// setup.
if (!_.IsIntScalarOrVectorType(result_type)) {
return _.diag(SPV_ERROR_INVALID_DATA, inst)
<< _.VkErrorID(4965)
<< "Using SignExtend, but result type is not a scalar or vector "
"integer type.";
} else if (!_.IsUnsignedIntScalarOrVectorType(result_type)) {
if (!_.IsUnsignedIntScalarOrVectorType(result_type)) {
return _.diag(SPV_ERROR_INVALID_DATA, inst)
<< _.VkErrorID(4965)
<< "Using SignExtend, but result type is a signed integer type.";
<< "Using ZeroExtend, but result type is a signed integer type.";
}
}

Expand Down
12 changes: 6 additions & 6 deletions test/val/val_image_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5965,7 +5965,7 @@ TEST_F(ValidateImage, ZeroExtendScalarSIntTexelV14) {
ValidateInstructions(SPV_ENV_UNIVERSAL_1_4));
EXPECT_THAT(
getDiagnosticString(),
HasSubstr("Using SignExtend, but result type is a signed integer type."));
HasSubstr("Using ZeroExtend, but result type is a signed integer type."));
}

TEST_F(ValidateImage, ZeroExtendScalarVectorUIntTexelV14Good) {
Expand Down Expand Up @@ -5996,7 +5996,7 @@ TEST_F(ValidateImage, ZeroExtendVectorSIntTexelV14) {
ValidateInstructions(SPV_ENV_UNIVERSAL_1_4));
EXPECT_THAT(
getDiagnosticString(),
HasSubstr("Using SignExtend, but result type is a signed integer type."));
HasSubstr("Using ZeroExtend, but result type is a signed integer type."));
}

TEST_F(ValidateImage, ReadLodAMDSuccess1) {
Expand Down Expand Up @@ -8249,7 +8249,7 @@ TEST_F(ValidateImage, TypeImageVulkanStorageZeroExtendSigned) {
AnyVUID("VUID-StandaloneSpirv-Image-04965"));
EXPECT_THAT(
getDiagnosticString(),
HasSubstr("Using SignExtend, but result type is a signed integer type"));
HasSubstr("Using ZeroExtend, but result type is a signed integer type"));
}

TEST_F(ValidateImage, TypeImageVulkanStorageZeroExtendRedundant) {
Expand Down Expand Up @@ -8327,9 +8327,9 @@ TEST_F(ValidateImage, TypeImageVulkanStorageZeroExtendFloat) {
ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_2));
EXPECT_THAT(getDiagnosticString(),
AnyVUID("VUID-StandaloneSpirv-Image-04965"));
EXPECT_THAT(getDiagnosticString(),
HasSubstr("Using SignExtend, but result type is not a scalar or "
"vector integer type."));
EXPECT_THAT(
getDiagnosticString(),
HasSubstr("Using ZeroExtend, but result type is a signed integer type."));
}

} // namespace
Expand Down

0 comments on commit 03698f1

Please sign in to comment.