r300g: fix psychedelic colors with SWTCL
[mesa.git] / src / gallium / drivers / r300 / r300_context.c
index 4f721ebb5998cebeff7f92c3a3bbaca87ca83550..c45d4b64f424ae87c32c1fd92dbe965ae9fc9235 100644 (file)
@@ -76,11 +76,13 @@ static void r300_destroy_context(struct pipe_context* context)
     FREE(r300->rs_block_state.state);
     FREE(r300->scissor_state.state);
     FREE(r300->textures_state.state);
-    FREE(r300->vap_output_state.state);
     FREE(r300->viewport_state.state);
     FREE(r300->ztop_state.state);
     FREE(r300->fs_constants.state);
     FREE(r300->vs_constants.state);
+    if (!r300->screen->caps.has_tcl) {
+        FREE(r300->vertex_stream_state.state);
+    }
     FREE(r300);
 }
 
@@ -125,7 +127,6 @@ static void r300_setup_atoms(struct r300_context* r300)
     R300_INIT_ATOM(viewport_state, 9);
     R300_INIT_ATOM(rs_block_state, 0);
     R300_INIT_ATOM(vertex_stream_state, 0);
-    R300_INIT_ATOM(vap_output_state, 6);
     R300_INIT_ATOM(pvs_flush, 2);
     R300_INIT_ATOM(vs_state, 0);
     R300_INIT_ATOM(vs_constants, 0);
@@ -149,11 +150,20 @@ static void r300_setup_atoms(struct r300_context* r300)
     r300->rs_block_state.state = CALLOC_STRUCT(r300_rs_block);
     r300->scissor_state.state = CALLOC_STRUCT(pipe_scissor_state);
     r300->textures_state.state = CALLOC_STRUCT(r300_textures_state);
-    r300->vap_output_state.state = CALLOC_STRUCT(r300_vap_output_state);
     r300->viewport_state.state = CALLOC_STRUCT(r300_viewport_state);
     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);
+    if (!r300->screen->caps.has_tcl) {
+        r300->vertex_stream_state.state = CALLOC_STRUCT(r300_vertex_stream_state);
+    }
+
+    /* 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,
@@ -204,9 +214,6 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
         draw_set_rasterize_stage(r300->draw, r300_draw_stage(r300));
         /* Enable Draw's clipping. */
         draw_set_driver_clipping(r300->draw, FALSE);
-        /* Force Draw to never do viewport transform, since we can do
-         * transform in hardware, always. */
-        draw_set_viewport_state(r300->draw, &r300_viewport_identity);
     }
 
     r300_setup_atoms(r300);