Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relax DebugLine validation #5916

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions source/val/validate_extensions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3208,10 +3208,11 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) {
return _.diag(SPV_ERROR_INVALID_DATA, inst)
<< ext_inst_name() << ": operand Line End (" << line_end
<< ") is less than Line Start (" << line_start << ")";
} else if (column_end < column_start) {
} else if (line_start == line_end && column_end < column_start) {
return _.diag(SPV_ERROR_INVALID_DATA, inst)
<< ext_inst_name() << ": operand Column End (" << column_end
<< ") is less than Column Start (" << column_start << ")";
<< ") is less than Column Start (" << column_start
<< ") when Line Start equals Line End";
}
break;
}
Expand Down
26 changes: 22 additions & 4 deletions test/val/val_ext_inst_debug_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5023,10 +5023,28 @@ TEST_F(ValidateVulkan100DebugInfo, DebugLineColumnEndSmaller) {
CompileSuccessfully(GenerateShaderCodeForDebugInfo(
src, "", dbg_inst_header, body, shader_extension, "Vertex"));
ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions());
EXPECT_THAT(
getDiagnosticString(),
HasSubstr(
"DebugLine: operand Column End (0) is less than Column Start (1)"));
EXPECT_THAT(getDiagnosticString(),
HasSubstr("DebugLine: operand Column End (0) is less than Column "
"Start (1) when Line Start equals Line End"));
}

TEST_F(ValidateVulkan100DebugInfo, DebugLineColumnEndSmallerMultiline) {
const std::string src = R"(
%src = OpString "simple.hlsl"
%code = OpString "int main() { }"
)";

const std::string dbg_inst_header = R"(
%dbg_src = OpExtInst %void %DbgExt DebugSource %src %code
)";

const std::string body = R"(
%line1 = OpExtInst %void %DbgExt DebugLine %dbg_src %u32_1 %u32_2 %u32_1 %u32_0
)";

CompileSuccessfully(GenerateShaderCodeForDebugInfo(
src, "", dbg_inst_header, body, shader_extension, "Vertex"));
ASSERT_EQ(SPV_SUCCESS, ValidateInstructions());
}

} // namespace
Expand Down
Loading