mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-11-25 21:10:04 +00:00
spirv-val: Label VUID 04643 (#4202)
This commit is contained in:
parent
2b0d16a059
commit
8f421ced3e
@ -466,6 +466,7 @@ spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) {
|
||||
|
||||
if (!_.IsValidStorageClass(storage_class)) {
|
||||
return _.diag(SPV_ERROR_INVALID_BINARY, inst)
|
||||
<< _.VkErrorID(4643)
|
||||
<< "Invalid storage class for target environment";
|
||||
}
|
||||
|
||||
|
@ -463,6 +463,7 @@ spv_result_t ValidateTypePointer(ValidationState_t& _,
|
||||
|
||||
if (!_.IsValidStorageClass(storage_class)) {
|
||||
return _.diag(SPV_ERROR_INVALID_BINARY, inst)
|
||||
<< _.VkErrorID(4643)
|
||||
<< "Invalid storage class for target environment";
|
||||
}
|
||||
|
||||
|
@ -1255,12 +1255,12 @@ bool ValidationState_t::IsValidStorageClass(
|
||||
case SpvStorageClassFunction:
|
||||
case SpvStorageClassPushConstant:
|
||||
case SpvStorageClassPhysicalStorageBuffer:
|
||||
case SpvStorageClassRayPayloadNV:
|
||||
case SpvStorageClassIncomingRayPayloadNV:
|
||||
case SpvStorageClassHitAttributeNV:
|
||||
case SpvStorageClassCallableDataNV:
|
||||
case SpvStorageClassIncomingCallableDataNV:
|
||||
case SpvStorageClassShaderRecordBufferNV:
|
||||
case SpvStorageClassRayPayloadKHR:
|
||||
case SpvStorageClassIncomingRayPayloadKHR:
|
||||
case SpvStorageClassHitAttributeKHR:
|
||||
case SpvStorageClassCallableDataKHR:
|
||||
case SpvStorageClassIncomingCallableDataKHR:
|
||||
case SpvStorageClassShaderRecordBufferKHR:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@ -1694,6 +1694,8 @@ std::string ValidationState_t::VkErrorID(uint32_t id,
|
||||
return VUID_WRAP(VUID-StandaloneSpirv-None-04641);
|
||||
case 4642:
|
||||
return VUID_WRAP(VUID-StandaloneSpirv-None-04642);
|
||||
case 4643:
|
||||
return VUID_WRAP(VUID-StandaloneSpirv-None-04643);
|
||||
case 4651:
|
||||
return VUID_WRAP(VUID-StandaloneSpirv-OpVariable-04651);
|
||||
case 4652:
|
||||
|
@ -273,6 +273,30 @@ TEST_F(ValidateMisc, UndefVoid) {
|
||||
EXPECT_THAT(getDiagnosticString(),
|
||||
HasSubstr("Cannot create undefined values with void type"));
|
||||
}
|
||||
|
||||
TEST_F(ValidateMisc, VulkanInvalidStorageClass) {
|
||||
const std::string spirv = R"(
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %func "shader"
|
||||
%int = OpTypeInt 32 0
|
||||
%ptr = OpTypePointer CrossWorkgroup %int
|
||||
%var = OpVariable %ptr CrossWorkgroup
|
||||
%void = OpTypeVoid
|
||||
%void_f = OpTypeFunction %void
|
||||
%func = OpFunction %void None %void_f
|
||||
%label = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
|
||||
CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_0);
|
||||
ASSERT_EQ(SPV_ERROR_INVALID_BINARY, ValidateInstructions(SPV_ENV_VULKAN_1_0));
|
||||
EXPECT_THAT(getDiagnosticString(),
|
||||
AnyVUID("VUID-StandaloneSpirv-None-04643"));
|
||||
EXPECT_THAT(getDiagnosticString(),
|
||||
HasSubstr("Invalid storage class for target environment"));
|
||||
}
|
||||
} // namespace
|
||||
} // namespace val
|
||||
} // namespace spvtools
|
||||
|
Loading…
Reference in New Issue
Block a user