Mesa (master): r300g: emit R300_TEX_ENABLE to indicate there are no textures bound

Corbin Simpson csimpson at kemper.freedesktop.org
Fri Nov 20 23:16:50 UTC 2009


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

Author: Marek Olšák <maraeo at gmail.com>
Date:   Fri Nov 20 05:17:00 2009 +0100

r300g: emit R300_TEX_ENABLE to indicate there are no textures bound

Previously, this reg wasn't emitted at all if texture_count == 0.

---

 src/gallium/drivers/r300/r300_emit.c |   15 +++++++++++++--
 src/gallium/drivers/r300/r300_emit.h |    2 ++
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 37e75ba..6d702c0 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -837,13 +837,22 @@ void r300_emit_viewport_state(struct r300_context* r300,
     END_CS;
 }
 
+void r300_emit_texture_count(struct r300_context* r300)
+{
+    CS_LOCALS(r300);
+
+    BEGIN_CS(2);
+    OUT_CS_REG(R300_TX_ENABLE, (1 << r300->texture_count) - 1);
+    END_CS;
+
+}
+
 void r300_flush_textures(struct r300_context* r300)
 {
     CS_LOCALS(r300);
 
-    BEGIN_CS(4);
+    BEGIN_CS(2);
     OUT_CS_REG(R300_TX_INVALTAGS, 0);
-    OUT_CS_REG(R300_TX_ENABLE, (1 << r300->texture_count) - 1);
     END_CS;
 }
 
@@ -997,6 +1006,8 @@ validate:
     /* Samplers and textures are tracked separately but emitted together. */
     if (r300->dirty_state &
             (R300_ANY_NEW_SAMPLERS | R300_ANY_NEW_TEXTURES)) {
+        r300_emit_texture_count(r300);
+
         for (i = 0; i < MIN2(r300->sampler_count, r300->texture_count); i++) {
   	    if (r300->dirty_state &
 		((R300_NEW_SAMPLER << i) | (R300_NEW_TEXTURE << i))) {
diff --git a/src/gallium/drivers/r300/r300_emit.h b/src/gallium/drivers/r300/r300_emit.h
index 7c83c51..3797d3d 100644
--- a/src/gallium/drivers/r300/r300_emit.h
+++ b/src/gallium/drivers/r300/r300_emit.h
@@ -92,6 +92,8 @@ void r300_emit_vertex_shader(struct r300_context* r300,
 void r300_emit_viewport_state(struct r300_context* r300,
                               struct r300_viewport_state* viewport);
 
+void r300_emit_texture_count(struct r300_context* r300);
+
 void r300_flush_textures(struct r300_context* r300);
 
 /* Emit all dirty state. */




More information about the mesa-commit mailing list