Re: [Mesa-dev] [PATCH] r600g: limit texture offset application to specific types (v2)
On Tue, 18 Nov 2014 07:59:23 +0100, Dave Airlie airl...@gmail.com wrote: 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. Fixes: ./bin/tex-miplevel-selection textureLodOffset 1DArray ./bin/tex-miplevel-selection textureLodOffset 2DArray ./bin/tex-miplevel-selection textureOffset 1DArray ./bin/tex-miplevel-selection textureOffset 1DArrayShadow ./bin/tex-miplevel-selection textureOffset 2DArray ./bin/tex-miplevel-selection textureOffset(bias) 1DArray ./bin/tex-miplevel-selection textureOffset(bias) 2DArray v2: rewrite to handle more cases and be consistent with code above. Signed-off-by: Dave Airlie airl...@redhat.com --- src/gallium/drivers/r600/r600_shader.c | 21 ++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index ab2a838..76daf2c 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -5535,9 +5535,24 @@ static int tgsi_tex(struct r600_shader_ctx *ctx) /* texture offsets do not apply to other texture targets */ } } 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; - offset_z = ctx-literals[4 * inst-TexOffsets[0].Index + inst-TexOffsets[0].SwizzleZ] 1; + switch (inst-Texture.Texture) { + case TGSI_TEXTURE_3D: +offset_z = ctx-literals[4 * inst-TexOffsets[0].Index + inst-TexOffsets[0].SwizzleZ] 1; + /* fallthrough */ + case TGSI_TEXTURE_2D: + case TGSI_TEXTURE_SHADOW2D: + case TGSI_TEXTURE_RECT: + case TGSI_TEXTURE_SHADOWRECT: + case TGSI_TEXTURE_2D_ARRAY: + case TGSI_TEXTURE_SHADOW2D_ARRAY: +offset_y = ctx-literals[4 * inst-TexOffsets[0].Index + inst-TexOffsets[0].SwizzleY] 1; + /* fallthrough */ + case TGSI_TEXTURE_1D: + case TGSI_TEXTURE_SHADOW1D: + case TGSI_TEXTURE_1D_ARRAY: + case TGSI_TEXTURE_SHADOW1D_ARRAY: +offset_x = ctx-literals[4 * inst-TexOffsets[0].Index + inst-TexOffsets[0].SwizzleX] 1; + } } } Confirmed fixes the same set of tests on a Turks. Reviewed-by: Glenn Kennard glenn.kenn...@gmail.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] r600g: limit texture offset application to specific types (v2)
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. Fixes: ./bin/tex-miplevel-selection textureLodOffset 1DArray ./bin/tex-miplevel-selection textureLodOffset 2DArray ./bin/tex-miplevel-selection textureOffset 1DArray ./bin/tex-miplevel-selection textureOffset 1DArrayShadow ./bin/tex-miplevel-selection textureOffset 2DArray ./bin/tex-miplevel-selection textureOffset(bias) 1DArray ./bin/tex-miplevel-selection textureOffset(bias) 2DArray v2: rewrite to handle more cases and be consistent with code above. Signed-off-by: Dave Airlie airl...@redhat.com --- src/gallium/drivers/r600/r600_shader.c | 21 ++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index ab2a838..76daf2c 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -5535,9 +5535,24 @@ static int tgsi_tex(struct r600_shader_ctx *ctx) /* texture offsets do not apply to other texture targets */ } } 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; - offset_z = ctx-literals[4 * inst-TexOffsets[0].Index + inst-TexOffsets[0].SwizzleZ] 1; + switch (inst-Texture.Texture) { + case TGSI_TEXTURE_3D: + offset_z = ctx-literals[4 * inst-TexOffsets[0].Index + inst-TexOffsets[0].SwizzleZ] 1; + /* fallthrough */ + case TGSI_TEXTURE_2D: + case TGSI_TEXTURE_SHADOW2D: + case TGSI_TEXTURE_RECT: + case TGSI_TEXTURE_SHADOWRECT: + case TGSI_TEXTURE_2D_ARRAY: + case TGSI_TEXTURE_SHADOW2D_ARRAY: + offset_y = ctx-literals[4 * inst-TexOffsets[0].Index + inst-TexOffsets[0].SwizzleY] 1; + /* fallthrough */ + case TGSI_TEXTURE_1D: + case TGSI_TEXTURE_SHADOW1D: + case TGSI_TEXTURE_1D_ARRAY: + case TGSI_TEXTURE_SHADOW1D_ARRAY: + offset_x = ctx-literals[4 * inst-TexOffsets[0].Index + inst-TexOffsets[0].SwizzleX] 1; + } } } -- 1.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev