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

Author: Dave Airlie <[email protected]>
Date:   Wed Oct 14 11:42:05 2009 +1000

r300g: fix case where texture unit 0 is disabled but unit 1 is enabled.

to reproduce, start texrect, disable 0 texture in menu.

Signed-off-by: Dave Airlie <[email protected]>

---

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

diff --git a/src/gallium/drivers/r300/r300_emit.c 
b/src/gallium/drivers/r300/r300_emit.c
index 570b4c5..99deb50 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -683,7 +683,8 @@ validate:
     /* ...textures... */
     for (i = 0; i < r300->texture_count; i++) {
         tex = r300->textures[i];
-        assert(tex && tex->buffer && "texture is marked, but NULL!");
+        if (!tex)
+           continue;
         if (!r300->winsys->add_buffer(r300->winsys, tex->buffer,
                     RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0)) {
             r300->context.flush(&r300->context, 0, NULL);
@@ -770,12 +771,13 @@ validate:
     if (r300->dirty_state &
             (R300_ANY_NEW_SAMPLERS | R300_ANY_NEW_TEXTURES)) {
         for (i = 0; i < MIN2(r300->sampler_count, r300->texture_count); i++) {
-            if (r300->dirty_state &
-                    ((R300_NEW_SAMPLER << i) | (R300_NEW_TEXTURE << i))) {
-                r300_emit_texture(r300,
-                        r300->sampler_states[i],
-                        r300->textures[i],
-                        i);
+           if (r300->dirty_state &
+               ((R300_NEW_SAMPLER << i) | (R300_NEW_TEXTURE << i))) {
+               if (r300->textures[i]) 
+                   r300_emit_texture(r300,
+                                     r300->sampler_states[i],
+                                     r300->textures[i],
+                                     i);
                 r300->dirty_state &=
                     ~((R300_NEW_SAMPLER << i) | (R300_NEW_TEXTURE << i));
                 dirty_tex++;

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to