From e63d6ed85e0d2c23d0a6335c0ac05e1501a403d3 Mon Sep 17 00:00:00 2001 From: Caio Oliveira Date: Tue, 8 Nov 2022 10:40:00 -0800 Subject: [PATCH] spirv: Make vtn_fail and friends trap in debug mode The SPIR-V parser catches its failures and failed assertions, clean up and return a failure to the caller. This is a good default behavior, but when debugging sometimes is useful to hook the debugger right in the failed assertion. Reviewed-by: Jason Ekstrand Part-of: --- src/compiler/spirv/spirv_to_nir.c | 4 ++++ src/microsoft/ci/spirv2dxil_reference.txt | 11 ----------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index bb964552908..827ad823e47 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -202,6 +202,10 @@ _vtn_fail(struct vtn_builder *b, const char *file, unsigned line, if (dump_path) vtn_dump_shader(b, dump_path, "fail"); +#ifndef NDEBUG + os_break(); +#endif + vtn_longjmp(b->fail_jump, 1); } diff --git a/src/microsoft/ci/spirv2dxil_reference.txt b/src/microsoft/ci/spirv2dxil_reference.txt index 9a9face4db7..5e4fe239e42 100644 --- a/src/microsoft/ci/spirv2dxil_reference.txt +++ b/src/microsoft/ci/spirv2dxil_reference.txt @@ -495,7 +495,6 @@ SPIR-V parsing FAILED: Invalid back or cross-edge in the CFG 0 bytes into the SPIR-V binary -Compilation failed Test:SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Regardless.spvasm:main|Fragment: Pass @@ -542,7 +541,6 @@ SPIR-V parsing FAILED: Invalid back or cross-edge in the CFG 0 bytes into the SPIR-V binary -Compilation failed Test:SpvParserCFGTest_ComputeBlockOrder_RespectConditionalBranchOrder.spvasm:main|Fragment: Pass @@ -609,7 +607,6 @@ SPIR-V parsing FAILED: Invalid back or cross-edge in the CFG 0 bytes into the SPIR-V binary -Compilation failed Test:SpvParserCFGTest_EmitBody_If_Empty.spvasm:main|Fragment: Pass @@ -621,7 +618,6 @@ SPIR-V parsing FAILED: Invalid back or cross-edge in the CFG 0 bytes into the SPIR-V binary -Compilation failed Test:SpvParserCFGTest_EmitBody_If_Then_NoElse.spvasm:main|Fragment: Pass @@ -630,7 +626,6 @@ SPIR-V parsing FAILED: Invalid back or cross-edge in the CFG 0 bytes into the SPIR-V binary -Compilation failed Test:SpvParserCFGTest_EmitBody_IfBreak_FromElse_ForwardWithinElse.spvasm:main|Fragment: Pass @@ -640,7 +635,6 @@ SPIR-V parsing FAILED: Invalid back or cross-edge in the CFG 0 bytes into the SPIR-V binary -Compilation failed Test:SpvParserCFGTest_EmitBody_IfSelection_TrueBranch_LoopBreak.spvasm:main|Fragment: Pass @@ -696,7 +690,6 @@ SPIR-V parsing FAILED: Invalid back or cross-edge in the CFG 0 bytes into the SPIR-V binary -Compilation failed Test:SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_Simple.spvasm:main|Fragment: Fail @@ -704,7 +697,6 @@ SPIR-V parsing FAILED: Invalid back or cross-edge in the CFG 0 bytes into the SPIR-V binary -Compilation failed Test:SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ThenDirectToElse.spvasm:main|Fragment: Fail @@ -712,7 +704,6 @@ SPIR-V parsing FAILED: Invalid back or cross-edge in the CFG 0 bytes into the SPIR-V binary -Compilation failed Test:SpvParserCFGTest_FindIfSelectionInternalHeaders_Regardless.spvasm:main|Fragment: Pass @@ -1002,7 +993,6 @@ SPIR-V parsing FAILED: Vulkan memory model is unsupported by this driver 68 bytes into the SPIR-V binary -Compilation failed Test:SpvParserTest_Impl_Source_InvalidId.spvasm:main|GLCompute: Pass @@ -1152,7 +1142,6 @@ SPIR-V parsing FAILED: Invalid type for an SSA value 408 bytes into the SPIR-V binary -Compilation failed Test:SpvParserTest_VectorExtractDynamic_SignedIndex.spvasm:main|GLCompute: Pass