r300g: emit R300_TEX_ENABLE to indicate there are no textures bound
authorMarek Olšák <maraeo@gmail.com>
Fri, 20 Nov 2009 04:17:00 +0000 (05:17 +0100)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Fri, 20 Nov 2009 23:12:18 +0000 (15:12 -0800)
Previously, this reg wasn't emitted at all if texture_count == 0.

src/gallium/drivers/r300/r300_emit.c
src/gallium/drivers/r300/r300_emit.h

index 37e75ba0616550082de14006a632fe08b0c8ec26..6d702c002724eced63ca9d77a9fd5f26235242ff 100644 (file)
@@ -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))) {
index 7c83c5166de9d8d17e7bc2458a4bc4719fb2537c..3797d3d332addfdb133ce978854145b99932d71b 100644 (file)
@@ -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. */