From: Dave Airlie <airl...@redhat.com>

For 1D and 2D arrays we don't want the other coordinates being
offset and affecting where we sample. I wrote this patch 6 months
ago but lost it.

This fixes at least
./bin/tex-miplevel-selection textureOffset 1DArray
./bin/tex-miplevel-selection textureOffset 2DArray

Signed-off-by: Dave Airlie <airl...@redhat.com>
---
 src/gallium/drivers/r600/r600_shader.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/r600/r600_shader.c 
b/src/gallium/drivers/r600/r600_shader.c
index ab2a838..f889399 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -5536,8 +5536,11 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
                        }
                } else {
                        offset_x = ctx->literals[4 * inst->TexOffsets[0].Index 
+ inst->TexOffsets[0].SwizzleX] << 1;
-                       offset_y = ctx->literals[4 * inst->TexOffsets[0].Index 
+ inst->TexOffsets[0].SwizzleY] << 1;
+                       if (inst->Texture.Texture != TGSI_TEXTURE_1D && 
inst->Texture.Texture != TGSI_TEXTURE_1D_ARRAY) {
+                               offset_y = ctx->literals[4 * 
inst->TexOffsets[0].Index + inst->TexOffsets[0].SwizzleY] << 1;
+                               if (inst->Texture.Texture != TGSI_TEXTURE_2D && 
inst->Texture.Texture != TGSI_TEXTURE_2D_ARRAY && inst->Texture.Texture != 
TGSI_TEXTURE_RECT)
                        offset_z = ctx->literals[4 * inst->TexOffsets[0].Index 
+ inst->TexOffsets[0].SwizzleZ] << 1;
+                       }
                }
        }
 
-- 
1.9.3

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to