mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-10-18 11:10:05 +00:00
spirv-val: Loosen restriction on base type of DebugTypePointer and DebugTypeQualifier (#5479)
* Allow base type for DebugTypePointer and DebugTypeQualifier to be any DebugType
This commit is contained in:
parent
0df791f97a
commit
246e6d4c68
@ -482,8 +482,8 @@ spv_result_t ValidateClspvReflectionArgumentBuffer(ValidationState_t& _,
|
||||
return SPV_SUCCESS;
|
||||
}
|
||||
|
||||
spv_result_t ValidateClspvReflectionArgumentOffsetBuffer(ValidationState_t& _,
|
||||
const Instruction* inst) {
|
||||
spv_result_t ValidateClspvReflectionArgumentOffsetBuffer(
|
||||
ValidationState_t& _, const Instruction* inst) {
|
||||
const auto num_operands = inst->operands().size();
|
||||
if (auto error = ValidateKernelDecl(_, inst)) {
|
||||
return error;
|
||||
@ -802,7 +802,7 @@ spv_result_t ValidateClspvReflectionPushConstantData(ValidationState_t& _,
|
||||
}
|
||||
|
||||
spv_result_t ValidateClspvReflectionPrintfInfo(ValidationState_t& _,
|
||||
const Instruction* inst) {
|
||||
const Instruction* inst) {
|
||||
if (!IsUint32Constant(_, inst->GetOperandAs<uint32_t>(4))) {
|
||||
return _.diag(SPV_ERROR_INVALID_ID, inst)
|
||||
<< "PrintfID must be a 32-bit unsigned integer OpConstant";
|
||||
@ -823,8 +823,8 @@ spv_result_t ValidateClspvReflectionPrintfInfo(ValidationState_t& _,
|
||||
return SPV_SUCCESS;
|
||||
}
|
||||
|
||||
spv_result_t ValidateClspvReflectionPrintfStorageBuffer(ValidationState_t& _,
|
||||
const Instruction* inst) {
|
||||
spv_result_t ValidateClspvReflectionPrintfStorageBuffer(
|
||||
ValidationState_t& _, const Instruction* inst) {
|
||||
if (!IsUint32Constant(_, inst->GetOperandAs<uint32_t>(4))) {
|
||||
return _.diag(SPV_ERROR_INVALID_ID, inst)
|
||||
<< "DescriptorSet must be a 32-bit unsigned integer OpConstant";
|
||||
@ -843,8 +843,8 @@ spv_result_t ValidateClspvReflectionPrintfStorageBuffer(ValidationState_t& _,
|
||||
return SPV_SUCCESS;
|
||||
}
|
||||
|
||||
spv_result_t ValidateClspvReflectionPrintfPushConstant(ValidationState_t& _,
|
||||
const Instruction* inst) {
|
||||
spv_result_t ValidateClspvReflectionPrintfPushConstant(
|
||||
ValidationState_t& _, const Instruction* inst) {
|
||||
if (!IsUint32Constant(_, inst->GetOperandAs<uint32_t>(4))) {
|
||||
return _.diag(SPV_ERROR_INVALID_ID, inst)
|
||||
<< "Offset must be a 32-bit unsigned integer OpConstant";
|
||||
@ -3168,16 +3168,16 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) {
|
||||
break;
|
||||
}
|
||||
case CommonDebugInfoDebugTypePointer: {
|
||||
auto validate_base_type =
|
||||
ValidateOperandBaseType(_, inst, 5, ext_inst_name);
|
||||
auto validate_base_type = ValidateOperandDebugType(
|
||||
_, "Base Type", inst, 5, ext_inst_name, false);
|
||||
if (validate_base_type != SPV_SUCCESS) return validate_base_type;
|
||||
CHECK_CONST_UINT_OPERAND("Storage Class", 6);
|
||||
CHECK_CONST_UINT_OPERAND("Flags", 7);
|
||||
break;
|
||||
}
|
||||
case CommonDebugInfoDebugTypeQualifier: {
|
||||
auto validate_base_type =
|
||||
ValidateOperandBaseType(_, inst, 5, ext_inst_name);
|
||||
auto validate_base_type = ValidateOperandDebugType(
|
||||
_, "Base Type", inst, 5, ext_inst_name, false);
|
||||
if (validate_base_type != SPV_SUCCESS) return validate_base_type;
|
||||
CHECK_CONST_UINT_OPERAND("Type Qualifier", 6);
|
||||
break;
|
||||
|
@ -1012,9 +1012,9 @@ TEST_F(ValidateOpenCL100DebugInfo, DebugTypePointerFail) {
|
||||
CompileSuccessfully(GenerateShaderCodeForDebugInfo(
|
||||
src, size_const, dbg_inst_header, "", extension, "Vertex"));
|
||||
ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions());
|
||||
EXPECT_THAT(getDiagnosticString(),
|
||||
HasSubstr("expected operand Base Type must be a result id of "
|
||||
"DebugTypeBasic"));
|
||||
EXPECT_THAT(
|
||||
getDiagnosticString(),
|
||||
HasSubstr("expected operand Base Type is not a valid debug type"));
|
||||
}
|
||||
|
||||
TEST_F(ValidateOpenCL100DebugInfo, DebugTypeQualifier) {
|
||||
@ -1077,9 +1077,9 @@ TEST_F(ValidateOpenCL100DebugInfo, DebugTypeQualifierFail) {
|
||||
CompileSuccessfully(GenerateShaderCodeForDebugInfo(
|
||||
src, size_const, dbg_inst_header, "", extension, "Vertex"));
|
||||
ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions());
|
||||
EXPECT_THAT(getDiagnosticString(),
|
||||
HasSubstr("expected operand Base Type must be a result id of "
|
||||
"DebugTypeBasic"));
|
||||
EXPECT_THAT(
|
||||
getDiagnosticString(),
|
||||
HasSubstr("expected operand Base Type is not a valid debug type"));
|
||||
}
|
||||
TEST_F(ValidateVulkan100DebugInfo, DebugTypeQualifier) {
|
||||
const std::string src = R"(
|
||||
@ -1147,9 +1147,9 @@ OpExtension "SPV_KHR_non_semantic_info"
|
||||
CompileSuccessfully(GenerateShaderCodeForDebugInfo(
|
||||
src, constants, dbg_inst_header, "", extension, "Vertex"));
|
||||
ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions());
|
||||
EXPECT_THAT(getDiagnosticString(),
|
||||
HasSubstr("expected operand Base Type must be a result id of "
|
||||
"DebugTypeBasic"));
|
||||
EXPECT_THAT(
|
||||
getDiagnosticString(),
|
||||
HasSubstr("expected operand Base Type is not a valid debug type"));
|
||||
}
|
||||
|
||||
TEST_F(ValidateOpenCL100DebugInfo, DebugTypeArray) {
|
||||
|
Loading…
Reference in New Issue
Block a user