Mesa (master): glsl_to_tgsi: fix texture offset translation

Dave Airlie airlied at kemper.freedesktop.org
Mon Dec 10 04:29:21 UTC 2012


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

Author: Dave Airlie <airlied at gmail.com>
Date:   Mon Dec 10 12:23:47 2012 +1000

glsl_to_tgsi: fix texture offset translation

I noticed the texelFetch offset test failed on 2D rect samplers
with GLSL 1.40. This is because I wrote the immediate->offset
translation wrong.

Fixed the translation to actually use the ureg info to set the
offsets up.

Signed-off-by: Dave Airlie <airlied at redhat.com>

---

 src/mesa/state_tracker/st_glsl_to_tgsi.cpp |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index e8a174c..efbbed2 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4243,14 +4243,17 @@ translate_tex_offset(struct st_translate *t,
                      const struct tgsi_texture_offset *in_offset)
 {
    struct tgsi_texture_offset offset;
+   struct ureg_src imm_src;
 
    assert(in_offset->File == PROGRAM_IMMEDIATE);
+   imm_src = t->immediates[in_offset->Index];
 
+   offset.File = imm_src.File;
+   offset.Index = imm_src.Index;
+   offset.SwizzleX = imm_src.SwizzleX;
+   offset.SwizzleY = imm_src.SwizzleY;
+   offset.SwizzleZ = imm_src.SwizzleZ;
    offset.File = TGSI_FILE_IMMEDIATE;
-   offset.Index = in_offset->Index;
-   offset.SwizzleX = in_offset->SwizzleX;
-   offset.SwizzleY = in_offset->SwizzleY;
-   offset.SwizzleZ = in_offset->SwizzleZ;
    offset.Padding = 0;
 
    return offset;




More information about the mesa-commit mailing list