Mesa (master): r300g: fix emission of which textures are enabled

Corbin Simpson csimpson at kemper.freedesktop.org
Wed Dec 16 03:04:50 UTC 2009


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

Author: Marek Olšák <maraeo at gmail.com>
Date:   Tue Dec 15 05:35:03 2009 +0100

r300g: fix emission of which textures are enabled

It fixes most of the "Bad CS" issues in piglit/texCombine and piglit/fbo.
Some other issues of this kind will get fixed in the kernel soon (depth-only
rendering, S3TC, and RGTC).

---

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

diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 55e4f94..55c8aa0 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -883,10 +883,21 @@ void r300_emit_viewport_state(struct r300_context* r300,
 
 void r300_emit_texture_count(struct r300_context* r300)
 {
+    uint32_t tx_enable = 0;
+    int i;
     CS_LOCALS(r300);
 
+    /* Notice that texture_count and sampler_count are just sizes
+     * of the respective arrays. We still have to check for the individual
+     * elements. */
+    for (i = 0; i < MIN2(r300->sampler_count, r300->texture_count); i++) {
+        if (r300->textures[i]) {
+            tx_enable |= 1 << i;
+        }
+    }
+
     BEGIN_CS(2);
-    OUT_CS_REG(R300_TX_ENABLE, (1 << r300->texture_count) - 1);
+    OUT_CS_REG(R300_TX_ENABLE, tx_enable);
     END_CS;
 
 }




More information about the mesa-commit mailing list