mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-11-28 14:11:04 +00:00
Missing debug info operands can be marked also with 'DebugInfoNone'
Fix a few cases where these were wrongly reported as illegal operand types.
This commit is contained in:
parent
1021ec302f
commit
dc6b55a481
@ -210,6 +210,28 @@ spv_result_t ValidateDebugInfoOperand(
|
|||||||
if (result != SPV_SUCCESS) return result; \
|
if (result != SPV_SUCCESS) return result; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
#define CHECK_OPTIONAL_DEBUG_OPERAND(NAME, operand_type, index) \
|
||||||
|
do { \
|
||||||
|
if (num_words == index + 1 && !DoesDebugInfoOperandMatchExpectation( \
|
||||||
|
_, \
|
||||||
|
[](CommonDebugInfoInstructions dbg_inst) { \
|
||||||
|
return dbg_inst == CommonDebugInfoDebugInfoNone; \
|
||||||
|
}, \
|
||||||
|
inst, index)) { \
|
||||||
|
CHECK_OPERAND(NAME, operand_type, index); \
|
||||||
|
} } while (false)
|
||||||
|
|
||||||
|
#define CHECK_OPTIONAL_DEBUG_OPERAND_VAL(NAME, operand_type, index) \
|
||||||
|
do { \
|
||||||
|
if (num_words == index + 1 && !DoesDebugInfoOperandMatchExpectation( \
|
||||||
|
_, \
|
||||||
|
[](CommonDebugInfoInstructions dbg_inst) { \
|
||||||
|
return dbg_inst == CommonDebugInfoDebugInfoNone; \
|
||||||
|
}, \
|
||||||
|
inst, index)) { \
|
||||||
|
CHECK_DEBUG_OPERAND(NAME, operand_type, index); \
|
||||||
|
} } while (false)
|
||||||
|
|
||||||
// Check that the operand of a debug info instruction |inst| at |word_index|
|
// Check that the operand of a debug info instruction |inst| at |word_index|
|
||||||
// is a result id of an debug info instruction with DebugTypeBasic.
|
// is a result id of an debug info instruction with DebugTypeBasic.
|
||||||
spv_result_t ValidateOperandBaseType(
|
spv_result_t ValidateOperandBaseType(
|
||||||
@ -3158,7 +3180,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) {
|
|||||||
}
|
}
|
||||||
case CommonDebugInfoDebugSource: {
|
case CommonDebugInfoDebugSource: {
|
||||||
CHECK_OPERAND("File", spv::Op::OpString, 5);
|
CHECK_OPERAND("File", spv::Op::OpString, 5);
|
||||||
if (num_words == 7) CHECK_OPERAND("Text", spv::Op::OpString, 6);
|
CHECK_OPTIONAL_DEBUG_OPERAND("Text", spv::Op::OpString, 6);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CommonDebugInfoDebugTypeBasic: {
|
case CommonDebugInfoDebugTypeBasic: {
|
||||||
@ -3388,8 +3410,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) {
|
|||||||
CHECK_OPERAND("Offset", spv::Op::OpConstant, 11);
|
CHECK_OPERAND("Offset", spv::Op::OpConstant, 11);
|
||||||
CHECK_OPERAND("Size", spv::Op::OpConstant, 12);
|
CHECK_OPERAND("Size", spv::Op::OpConstant, 12);
|
||||||
CHECK_CONST_UINT_OPERAND("Flags", 13);
|
CHECK_CONST_UINT_OPERAND("Flags", 13);
|
||||||
if (num_words == 15)
|
CHECK_OPTIONAL_DEBUG_OPERAND("Value", spv::Op::OpConstant, 14);
|
||||||
CHECK_OPERAND("Value", spv::Op::OpConstant, 14);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3438,10 +3459,8 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) {
|
|||||||
// NonSemantic.Shader.DebugInfo.100 doesn't include a reference to the
|
// NonSemantic.Shader.DebugInfo.100 doesn't include a reference to the
|
||||||
// OpFunction
|
// OpFunction
|
||||||
if (vulkanDebugInfo) {
|
if (vulkanDebugInfo) {
|
||||||
if (num_words == 15) {
|
CHECK_OPTIONAL_DEBUG_OPERAND_VAL("Declaration",
|
||||||
CHECK_DEBUG_OPERAND("Declaration",
|
|
||||||
CommonDebugInfoDebugFunctionDeclaration, 14);
|
CommonDebugInfoDebugFunctionDeclaration, 14);
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (!DoesDebugInfoOperandMatchExpectation(
|
if (!DoesDebugInfoOperandMatchExpectation(
|
||||||
_,
|
_,
|
||||||
@ -3451,10 +3470,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) {
|
|||||||
inst, 14)) {
|
inst, 14)) {
|
||||||
CHECK_OPERAND("Function", spv::Op::OpFunction, 14);
|
CHECK_OPERAND("Function", spv::Op::OpFunction, 14);
|
||||||
}
|
}
|
||||||
if (num_words == 16) {
|
CHECK_OPTIONAL_DEBUG_OPERAND_VAL("Declaration", CommonDebugInfoDebugFunctionDeclaration, 15);
|
||||||
CHECK_DEBUG_OPERAND("Declaration",
|
|
||||||
CommonDebugInfoDebugFunctionDeclaration, 15);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3480,16 +3496,14 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) {
|
|||||||
auto validate_parent =
|
auto validate_parent =
|
||||||
ValidateOperandLexicalScope(_, "Parent", inst, 8, ext_inst_name);
|
ValidateOperandLexicalScope(_, "Parent", inst, 8, ext_inst_name);
|
||||||
if (validate_parent != SPV_SUCCESS) return validate_parent;
|
if (validate_parent != SPV_SUCCESS) return validate_parent;
|
||||||
if (num_words == 10) CHECK_OPERAND("Name", spv::Op::OpString, 9);
|
CHECK_OPTIONAL_DEBUG_OPERAND("Name", spv::Op::OpString, 9);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CommonDebugInfoDebugScope: {
|
case CommonDebugInfoDebugScope: {
|
||||||
auto validate_scope =
|
auto validate_scope =
|
||||||
ValidateOperandLexicalScope(_, "Scope", inst, 5, ext_inst_name);
|
ValidateOperandLexicalScope(_, "Scope", inst, 5, ext_inst_name);
|
||||||
if (validate_scope != SPV_SUCCESS) return validate_scope;
|
if (validate_scope != SPV_SUCCESS) return validate_scope;
|
||||||
if (num_words == 7) {
|
CHECK_OPTIONAL_DEBUG_OPERAND_VAL("Inlined At", CommonDebugInfoDebugInlinedAt, 6);
|
||||||
CHECK_DEBUG_OPERAND("Inlined At", CommonDebugInfoDebugInlinedAt, 6);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CommonDebugInfoDebugLocalVariable: {
|
case CommonDebugInfoDebugLocalVariable: {
|
||||||
@ -3622,8 +3636,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) {
|
|||||||
"OpVariable or OpConstant or DebugInfoNone";
|
"OpVariable or OpConstant or DebugInfoNone";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (num_words == 15) {
|
CHECK_OPTIONAL_DEBUG_OPERAND_VAL("Static Member Declaration",
|
||||||
CHECK_DEBUG_OPERAND("Static Member Declaration",
|
|
||||||
CommonDebugInfoDebugTypeMember, 14);
|
CommonDebugInfoDebugTypeMember, 14);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3633,9 +3646,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) {
|
|||||||
auto validate_scope =
|
auto validate_scope =
|
||||||
ValidateOperandLexicalScope(_, "Scope", inst, 6, ext_inst_name);
|
ValidateOperandLexicalScope(_, "Scope", inst, 6, ext_inst_name);
|
||||||
if (validate_scope != SPV_SUCCESS) return validate_scope;
|
if (validate_scope != SPV_SUCCESS) return validate_scope;
|
||||||
if (num_words == 8) {
|
CHECK_OPTIONAL_DEBUG_OPERAND_VAL("Inlined", CommonDebugInfoDebugInlinedAt, 7);
|
||||||
CHECK_DEBUG_OPERAND("Inlined", CommonDebugInfoDebugInlinedAt, 7);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CommonDebugInfoDebugValue: {
|
case CommonDebugInfoDebugValue: {
|
||||||
|
Loading…
Reference in New Issue
Block a user