intel/rt/nir: enable the trampoline shader to load the indirect ray shader bsr
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Fri, 25 Nov 2022 13:32:27 +0000 (15:32 +0200)
committerMarge Bot <emma+marge@anholt.net>
Fri, 2 Dec 2022 09:28:23 +0000 (09:28 +0000)
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20011>

src/intel/compiler/brw_nir_rt.c
src/intel/vulkan/genX_cmd_buffer.c

index 574312c1a358a399239b69d788ec5d158a894aa1..0c67e14446ec3a6c8fb49658ac548752b9d86911 100644 (file)
@@ -439,11 +439,27 @@ brw_nir_create_raygen_trampoline(const struct brw_compiler *compiler,
     * raygen BSR address here; the global data we'll deal with later.
     */
    b.shader->num_uniforms = 32;
-   nir_ssa_def *raygen_bsr_addr =
+   nir_ssa_def *raygen_param_bsr_addr =
       load_trampoline_param(&b, raygen_bsr_addr, 1, 64);
+   nir_ssa_def *is_indirect =
+      nir_i2b(&b, load_trampoline_param(&b, is_indirect, 1, 8));
    nir_ssa_def *local_shift =
       nir_u2u32(&b, load_trampoline_param(&b, local_group_size_log2, 3, 8));
 
+   nir_ssa_def *raygen_indirect_bsr_addr;
+   nir_push_if(&b, is_indirect);
+   {
+      raygen_indirect_bsr_addr =
+         nir_load_global_constant(&b, raygen_param_bsr_addr,
+                                  8 /* align */,
+                                  1 /* components */,
+                                  64 /* bit_size */);
+   }
+   nir_pop_if(&b, NULL);
+
+   nir_ssa_def *raygen_bsr_addr =
+      nir_if_phi(&b, raygen_indirect_bsr_addr, raygen_param_bsr_addr);
+
    nir_ssa_def *global_id = nir_load_workgroup_id_zero_base(&b);
    nir_ssa_def *simd_channel = nir_load_subgroup_invocation(&b);
    nir_ssa_def *local_x =
index 0af7ea05bf3d867a28cffd46cb644ea8ed7bcfd7..7c5a4d06262379f53f8367366d4c88b42ab577b6 100644 (file)
@@ -5829,7 +5829,7 @@ cmd_buffer_trace_rays(struct anv_cmd_buffer *cmd_buffer,
       struct brw_rt_raygen_trampoline_params trampoline_params = {
          .rt_disp_globals_addr = anv_address_physical(rtdg_addr),
          .raygen_bsr_addr = raygen_sbt->deviceAddress,
-         .is_indirect = is_indirect,
+         .is_indirect = false, /* Only for raygen_bsr_addr */
          .local_group_size_log2 = {
             local_size_log2[0],
             local_size_log2[1],