Skip to content

Commit 113784c

Browse files
spirv-val: Allow DebugInfoNone (#6749)
closes #6744
1 parent ee4f6be commit 113784c

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

source/val/validate_extensions.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,10 +396,14 @@ spv_result_t ValidateOperandDebugType(ValidationState_t& _,
396396
// Check for common types.
397397
std::function<bool(CommonDebugInfoInstructions)> expectation =
398398
[&allow_template_param](CommonDebugInfoInstructions dbg_inst) {
399+
// TODO - Should DebugTypeTemplateParameterPack be allowed?
399400
if (allow_template_param &&
400401
(dbg_inst == CommonDebugInfoDebugTypeTemplateParameter ||
401402
dbg_inst == CommonDebugInfoDebugTypeTemplateTemplateParameter)) {
402403
return true;
404+
} else if (dbg_inst == CommonDebugInfoDebugInfoNone) {
405+
// DebugInfoNone is a safe "null" type that can be used
406+
return true;
403407
}
404408
return CommonDebugInfoDebugTypeBasic <= dbg_inst &&
405409
dbg_inst <= CommonDebugInfoDebugTypeTemplate;

test/val/val_ext_inst_debug_test.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6390,6 +6390,20 @@ TEST_F(ValidateVulkan101DebugInfo, DebugTypeBasicFPEncodingFailNotConst) {
63906390
"OpConstant"));
63916391
}
63926392

6393+
TEST_F(ValidateVulkan100DebugInfo, DebugTypePointerNone) {
6394+
const std::string constants = R"(
6395+
%u32_7 = OpConstant %u32 7
6396+
)";
6397+
const std::string dbg_inst_header = R"(
6398+
%none = OpExtInst %void %DbgExt DebugInfoNone
6399+
%voidptr = OpExtInst %void %DbgExt DebugTypePointer %none %u32_7 %u32_0
6400+
)";
6401+
6402+
CompileSuccessfully(GenerateShaderCodeForDebugInfo(
6403+
"", constants, dbg_inst_header, "", shader_extension_100, "Vertex"));
6404+
ASSERT_EQ(SPV_SUCCESS, ValidateInstructions());
6405+
}
6406+
63936407
} // namespace
63946408
} // namespace val
63956409
} // namespace spvtools

0 commit comments

Comments
 (0)