From 1d6434f02ba7ae17664506645f43365b2753ffc4 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Mon, 23 Nov 2020 22:54:01 -0600 Subject: [PATCH] spirv: Emit nir_jump_halt after TerminateRay or IgnoreIntersection Part-of: --- src/compiler/spirv/vtn_cfg.c | 4 ++-- src/compiler/spirv/vtn_private.h | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/compiler/spirv/vtn_cfg.c b/src/compiler/spirv/vtn_cfg.c index 445e3e5..4ab076d 100644 --- a/src/compiler/spirv/vtn_cfg.c +++ b/src/compiler/spirv/vtn_cfg.c @@ -699,12 +699,10 @@ vtn_process_block(struct vtn_builder *b, return NULL; case SpvOpIgnoreIntersectionKHR: - b->has_early_terminate = true; block->branch_type = vtn_branch_type_ignore_intersection; return NULL; case SpvOpTerminateRayKHR: - b->has_early_terminate = true; block->branch_type = vtn_branch_type_terminate_ray; return NULL; @@ -980,12 +978,14 @@ vtn_emit_branch(struct vtn_builder *b, enum vtn_branch_type branch_type, nir_intrinsic_instr_create(b->nb.shader, nir_intrinsic_ignore_ray_intersection); nir_builder_instr_insert(&b->nb, &ignore->instr); + nir_jump(&b->nb, nir_jump_halt); break; } case vtn_branch_type_terminate_ray: { nir_intrinsic_instr *terminate = nir_intrinsic_instr_create(b->nb.shader, nir_intrinsic_terminate_ray); nir_builder_instr_insert(&b->nb, &terminate->instr); + nir_jump(&b->nb, nir_jump_halt); break; } default: diff --git a/src/compiler/spirv/vtn_private.h b/src/compiler/spirv/vtn_private.h index 7275fff..5c9c1d7 100644 --- a/src/compiler/spirv/vtn_private.h +++ b/src/compiler/spirv/vtn_private.h @@ -711,8 +711,6 @@ struct vtn_builder { * * - OpKill * - OpTerminateInvocation - * - OpIgnoreIntersectionKHR - * - OpTerminateRayKHR * * However, in NIR, they're represented by regular intrinsics with no * control-flow semantics. This means that the SSA form from the SPIR-V -- 2.7.4