Mesa (staging/22.1): radv/rt: fix nir_builder cursor in lower_rt_instructions()

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jul 28 17:16:52 UTC 2022


Module: Mesa
Branch: staging/22.1
Commit: f8a04c8b6caf86bbbefe369fd7fc05a0119d4fae
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f8a04c8b6caf86bbbefe369fd7fc05a0119d4fae

Author: Daniel Schürmann <daniel at schuermann.dev>
Date:   Tue Jul  5 11:49:29 2022 +0200

radv/rt: fix nir_builder cursor in lower_rt_instructions()

Fixes: 207ce6d658ac6d8f6421a02304b74645ff835e96 ('radv: Add helper to inline shaders into the main shader.')
Reviewed-by: Konstantin Seurer <konstantin.seurer at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17301>
(cherry picked from commit f7c318901d277ff22c23bdc881ee5ca42151be50)

---

 .pick_status.json                 | 2 +-
 src/amd/vulkan/radv_pipeline_rt.c | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index a7e4f84e1d2..dda123585e8 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -2074,7 +2074,7 @@
         "description": "radv/rt: fix nir_builder cursor in lower_rt_instructions()",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "207ce6d658ac6d8f6421a02304b74645ff835e96"
     },
diff --git a/src/amd/vulkan/radv_pipeline_rt.c b/src/amd/vulkan/radv_pipeline_rt.c
index c18e23d0d11..823be535236 100644
--- a/src/amd/vulkan/radv_pipeline_rt.c
+++ b/src/amd/vulkan/radv_pipeline_rt.c
@@ -558,6 +558,7 @@ lower_rt_instructions(nir_shader *shader, struct rt_variables *vars, unsigned ca
             }
             case nir_intrinsic_load_ray_world_to_object: {
                unsigned c = nir_intrinsic_column(intr);
+               b_shader.cursor = nir_instr_remove(instr);
                nir_ssa_def *instance_node_addr = nir_load_var(&b_shader, vars->instance_addr);
                nir_ssa_def *wto_matrix[3];
                nir_build_wto_matrix_load(&b_shader, instance_node_addr, wto_matrix);
@@ -570,12 +571,12 @@ lower_rt_instructions(nir_shader *shader, struct rt_variables *vars, unsigned ca
                if (c == 3)
                   val = nir_fneg(&b_shader,
                                  nir_build_vec3_mat_mult(&b_shader, val, wto_matrix, false));
-               b_shader.cursor = nir_instr_remove(instr);
                nir_ssa_def_rewrite_uses(&intr->dest.ssa, val);
                break;
             }
             case nir_intrinsic_load_ray_object_to_world: {
                unsigned c = nir_intrinsic_column(intr);
+               b_shader.cursor = nir_instr_remove(instr);
                nir_ssa_def *instance_node_addr = nir_load_var(&b_shader, vars->instance_addr);
                nir_ssa_def *val;
                if (c == 3) {
@@ -592,11 +593,11 @@ lower_rt_instructions(nir_shader *shader, struct rt_variables *vars, unsigned ca
                                               nir_iadd(&b_shader, instance_node_addr,
                                                        nir_imm_int64(&b_shader, 92 + c * 12)));
                }
-               b_shader.cursor = nir_instr_remove(instr);
                nir_ssa_def_rewrite_uses(&intr->dest.ssa, val);
                break;
             }
             case nir_intrinsic_load_ray_object_origin: {
+               b_shader.cursor = nir_instr_remove(instr);
                nir_ssa_def *instance_node_addr = nir_load_var(&b_shader, vars->instance_addr);
                nir_ssa_def *wto_matrix[] = {
                   nir_build_load_global(
@@ -613,17 +614,16 @@ lower_rt_instructions(nir_shader *shader, struct rt_variables *vars, unsigned ca
                      .align_mul = 64, .align_offset = 48)};
                nir_ssa_def *val = nir_build_vec3_mat_mult_pre(
                   &b_shader, nir_load_var(&b_shader, vars->origin), wto_matrix);
-               b_shader.cursor = nir_instr_remove(instr);
                nir_ssa_def_rewrite_uses(&intr->dest.ssa, val);
                break;
             }
             case nir_intrinsic_load_ray_object_direction: {
+               b_shader.cursor = nir_instr_remove(instr);
                nir_ssa_def *instance_node_addr = nir_load_var(&b_shader, vars->instance_addr);
                nir_ssa_def *wto_matrix[3];
                nir_build_wto_matrix_load(&b_shader, instance_node_addr, wto_matrix);
                nir_ssa_def *val = nir_build_vec3_mat_mult(
                   &b_shader, nir_load_var(&b_shader, vars->direction), wto_matrix, false);
-               b_shader.cursor = nir_instr_remove(instr);
                nir_ssa_def_rewrite_uses(&intr->dest.ssa, val);
                break;
             }



More information about the mesa-commit mailing list