Module: Mesa Branch: staging/20.0 Commit: 9cdc30f837c54cbee4a6e92ce624d14dbde78147 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9cdc30f837c54cbee4a6e92ce624d14dbde78147
Author: Rhys Perry <[email protected]> Date: Wed Mar 11 20:22:38 2020 +0000 nir/gather_info: fix per-vertex handling in try_mask_partial_io pipeline-db (Navi, ACO): Totals from affected shaders: SGPRS: 6432 -> 6432 (0.00 %) VGPRS: 11924 -> 11924 (0.00 %) Spilled SGPRs: 0 -> 0 (0.00 %) Spilled VGPRs: 0 -> 0 (0.00 %) Scratch size: 1596 -> 1596 (0.00 %) dwords per thread Code Size: 575524 -> 518620 (-9.89 %) bytes LDS: 12187 -> 12187 (0.00 %) blocks Max Waves: 2695 -> 2695 (0.00 %) Helps a few hundred Dark Souls 3 shaders. Signed-off-by: Rhys Perry <[email protected]> CC: <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4190> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4190> (cherry picked from commit 9f4ba2d2b4a577a7cf6b38e835f0d1f39965bf08) --- .pick_status.json | 2 +- src/compiler/nir/nir_gather_info.c | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index ed44dae2211..739a9e4344e 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -256,7 +256,7 @@ "description": "nir/gather_info: fix per-vertex handling in try_mask_partial_io", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": null }, diff --git a/src/compiler/nir/nir_gather_info.c b/src/compiler/nir/nir_gather_info.c index b77d6381bd1..87bd0df9ae4 100644 --- a/src/compiler/nir/nir_gather_info.c +++ b/src/compiler/nir/nir_gather_info.c @@ -102,12 +102,15 @@ mark_whole_variable(nir_shader *shader, nir_variable *var, bool is_output_read) } static unsigned -get_io_offset(nir_deref_instr *deref, bool is_vertex_input) +get_io_offset(nir_deref_instr *deref, bool is_vertex_input, bool per_vertex) { unsigned offset = 0; for (nir_deref_instr *d = deref; d; d = nir_deref_instr_parent(d)) { if (d->deref_type == nir_deref_type_array) { + if (per_vertex && nir_deref_instr_parent(d)->deref_type == nir_deref_type_var) + break; + if (!nir_src_is_const(d->arr.index)) return -1; @@ -132,8 +135,9 @@ try_mask_partial_io(nir_shader *shader, nir_variable *var, nir_deref_instr *deref, bool is_output_read) { const struct glsl_type *type = var->type; + bool per_vertex = nir_is_per_vertex_io(var, shader->info.stage); - if (nir_is_per_vertex_io(var, shader->info.stage)) { + if (per_vertex) { assert(glsl_type_is_array(type)); type = glsl_get_array_element(type); } @@ -157,7 +161,7 @@ try_mask_partial_io(nir_shader *shader, nir_variable *var, return false; } - unsigned offset = get_io_offset(deref, false); + unsigned offset = get_io_offset(deref, false, per_vertex); if (offset == -1) return false; _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
