Module: Mesa
Branch: master
Commit: 9c9a9bee4431124439c57a9429e745dd4837fcdf
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9c9a9bee4431124439c57a9429e745dd4837fcdf

Author: Dave Airlie <airl...@redhat.com>
Date:   Mon Feb 12 14:46:50 2018 +1000

r600: fix array spill if temp[0] is before all arrays

I found a shader with
DCL TEMP[0], LOCAL
DCL TEMP[1..256], ARRAY(1), LOCAL
DCL TEMP[257..512], ARRAY(2), LOCAL
DCL TEMP[513..768], ARRAY(3), LOCAL
DCL TEMP[769], LOCAL

This would remap badly, as it would add up all the spilled sizes
and subtract it from the temp for 0. If the current temp is less
than the array start break out.

Fixes: 1d871aa6 (r600g: Implement spilling of temp arrays (v2))
Signed-off-by: Dave Airlie <airl...@redhat.com>

---

 src/gallium/drivers/r600/r600_shader.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/gallium/drivers/r600/r600_shader.c 
b/src/gallium/drivers/r600/r600_shader.c
index 4141e86430..7d60bd90c3 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -920,6 +920,8 @@ static int map_tgsi_reg_index_to_r600_gpr(struct 
r600_shader_ctx *ctx, unsigned
                        }
                }
 
+               if (tgsi_reg_index < ctx->array_infos[i].range.First)
+                       break;
                if (ctx->spilled_arrays[i]) {
                        spilled_size += ctx->array_infos[i].range.Last - 
ctx->array_infos[i].range.First + 1;
                }

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to