r300g: fix emission of some non-CSO atoms at the beginning of CS
authorMarek Olšák <maraeo@gmail.com>
Sat, 15 May 2010 19:22:23 +0000 (21:22 +0200)
committerMarek Olšák <maraeo@gmail.com>
Sat, 15 May 2010 19:22:23 +0000 (21:22 +0200)
src/gallium/drivers/r300/r300_context.c
src/gallium/drivers/r300/r300_context.h
src/gallium/drivers/r300/r300_flush.c

index 0444fdac7d5096f1885eb1d7eab681c09439604a..775173b9a85647603fa2f208eb181bbc06660680 100644 (file)
@@ -151,6 +151,13 @@ static void r300_setup_atoms(struct r300_context* r300)
     r300->ztop_state.state = CALLOC_STRUCT(r300_ztop_state);
     r300->fs_constants.state = CALLOC_STRUCT(r300_constant_buffer);
     r300->vs_constants.state = CALLOC_STRUCT(r300_constant_buffer);
+
+    /* Some non-CSO atoms don't use the state pointer. */
+    r300->invariant_state.allow_null_state = TRUE;
+    r300->fs_rc_constant_state.allow_null_state = TRUE;
+    r300->pvs_flush.allow_null_state = TRUE;
+    r300->query_start.allow_null_state = TRUE;
+    r300->texture_cache_inval.allow_null_state = TRUE;
 }
 
 struct pipe_context* r300_create_context(struct pipe_screen* screen,
index 4a59c6a8fb2c0f61855c8dedf63b3383cda5bdff..d2c8f56f6d7ff40f3c595ec499b10bd6078c2639 100644 (file)
@@ -55,6 +55,8 @@ struct r300_atom {
     unsigned size;
     /* Whether this atom should be emitted. */
     boolean dirty;
+    /* Whether this atom may be emitted with state == NULL. */
+    boolean allow_null_state;
 };
 
 struct r300_blend_state {
index ad7cae7bf53c4c95048dfb77fbd94c7f3590b0e8..3d22027136bb1c93f914d1aed4b08542a2363d4e 100644 (file)
@@ -56,7 +56,7 @@ static void r300_flush(struct pipe_context* pipe,
 
         /* New kitchen sink, baby. */
         foreach(atom, &r300->atom_list) {
-            if (atom->state) {
+            if (atom->state || atom->allow_null_state) {
                 atom->dirty = TRUE;
             }
         }