spirv: Emit nir_jump_halt after TerminateRay or IgnoreIntersection
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 24 Nov 2020 04:54:01 +0000 (22:54 -0600)
committerMarge Bot <eric+marge@anholt.net>
Wed, 25 Nov 2020 05:37:09 +0000 (05:37 +0000)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7356>

src/compiler/spirv/vtn_cfg.c
src/compiler/spirv/vtn_private.h

index 445e3e5..4ab076d 100644 (file)
@@ -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:
index 7275fff..5c9c1d7 100644 (file)
@@ -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