Mesa (master): r300g: fix the WRAP_T mode when using 1D textures

Corbin Simpson csimpson at kemper.freedesktop.org
Wed Oct 28 12:21:34 PDT 2009


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

Author: Marek Olšák <maraeo at gmail.com>
Date:   Wed Oct 28 02:21:49 2009 +0100

r300g: fix the WRAP_T mode when using 1D textures

Signed-off-by: Corbin Simpson <MostAwesomeDude at gmail.com>

---

 src/gallium/drivers/r300/r300_emit.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 096165a..8bfa293 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -532,10 +532,17 @@ void r300_emit_texture(struct r300_context* r300,
                        struct r300_texture* tex,
                        unsigned offset)
 {
+    uint32_t filter0 = sampler->filter0;
     CS_LOCALS(r300);
 
+    /* to emulate 1D textures through 2D ones correctly */
+    if (tex->tex.height[0] == 1) {
+        filter0 &= ~R300_TX_WRAP_T_MASK;
+        filter0 |= R300_TX_WRAP_T(R300_TX_CLAMP_TO_EDGE);
+    }
+
     BEGIN_CS(16);
-    OUT_CS_REG(R300_TX_FILTER0_0 + (offset * 4), sampler->filter0 |
+    OUT_CS_REG(R300_TX_FILTER0_0 + (offset * 4), filter0 |
         (offset << 28));
     OUT_CS_REG(R300_TX_FILTER1_0 + (offset * 4), sampler->filter1);
     OUT_CS_REG(R300_TX_BORDER_COLOR_0 + (offset * 4), sampler->border_color);



More information about the mesa-commit mailing list