mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-12-25 01:01:04 +00:00
spirv-val: allow DebugInfoNone for DebugTypeComposite.Size (#3374)
This commit is contained in:
parent
4386ef4234
commit
9cb2571a18
@ -2300,7 +2300,14 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) {
|
||||
ValidateOperandLexicalScope(_, "Parent", inst, 10, ext_inst_name);
|
||||
if (validate_parent != SPV_SUCCESS) return validate_parent;
|
||||
CHECK_OPERAND("Linkage Name", SpvOpString, 11);
|
||||
CHECK_OPERAND("Size", SpvOpConstant, 12);
|
||||
if (!DoesDebugInfoOperandMatchExpectation(
|
||||
_,
|
||||
[](OpenCLDebugInfo100Instructions dbg_inst) {
|
||||
return dbg_inst == OpenCLDebugInfo100DebugInfoNone;
|
||||
},
|
||||
inst, 12)) {
|
||||
CHECK_OPERAND("Size", SpvOpConstant, 12);
|
||||
}
|
||||
for (uint32_t word_index = 14; word_index < num_words; ++word_index) {
|
||||
if (!DoesDebugInfoOperandMatchExpectation(
|
||||
_,
|
||||
|
@ -889,6 +889,31 @@ TEST_F(ValidateOpenCL100DebugInfo, DebugScopeBeforeOpVariableInFunction) {
|
||||
ASSERT_EQ(SPV_SUCCESS, ValidateInstructions());
|
||||
}
|
||||
|
||||
TEST_F(ValidateOpenCL100DebugInfo, DebugTypeCompositeSizeDebugInfoNone) {
|
||||
const std::string src = R"(
|
||||
%src = OpString "simple.hlsl"
|
||||
%code = OpString "OpaqueType foo;
|
||||
main() {}
|
||||
"
|
||||
%ty_name = OpString "struct VS_OUTPUT"
|
||||
)";
|
||||
|
||||
const std::string dbg_inst_header = R"(
|
||||
%dbg_none = OpExtInst %void %DbgExt DebugInfoNone
|
||||
%dbg_src = OpExtInst %void %DbgExt DebugSource %src %code
|
||||
%comp_unit = OpExtInst %void %DbgExt DebugCompilationUnit 2 4 %dbg_src HLSL
|
||||
%opaque = OpExtInst %void %DbgExt DebugTypeComposite %ty_name Class %dbg_src 1 1 %comp_unit %ty_name %dbg_none FlagIsPublic
|
||||
)";
|
||||
|
||||
const std::string extension = R"(
|
||||
%DbgExt = OpExtInstImport "OpenCL.DebugInfo.100"
|
||||
)";
|
||||
|
||||
CompileSuccessfully(GenerateShaderCodeForDebugInfo(src, "", dbg_inst_header,
|
||||
"", extension, "Vertex"));
|
||||
ASSERT_EQ(SPV_SUCCESS, ValidateInstructions());
|
||||
}
|
||||
|
||||
TEST_F(ValidateOpenCL100DebugInfo, DebugTypeCompositeForwardReference) {
|
||||
const std::string src = R"(
|
||||
%src = OpString "simple.hlsl"
|
||||
|
Loading…
Reference in New Issue
Block a user