r300g/swtcl: don't do stuff which is only for HWTCL
authorMarek Olšák <maraeo@gmail.com>
Fri, 11 May 2012 21:09:05 +0000 (23:09 +0200)
committerMarek Olšák <maraeo@gmail.com>
Fri, 11 May 2012 22:50:52 +0000 (00:50 +0200)
src/gallium/drivers/r300/r300_context.c
src/gallium/drivers/r300/r300_state.c

index 1006336d44e0c0eb911c10271bf3769bbe2f6418..8cbe246f7872e387e248ab70b2f4764135da6875 100644 (file)
@@ -80,7 +80,8 @@ static void r300_destroy_context(struct pipe_context* context)
     if (r300->draw)
         draw_destroy(r300->draw);
 
-    u_upload_destroy(r300->uploader);
+    if (r300->uploader)
+        u_upload_destroy(r300->uploader);
 
     /* XXX: This function assumes r300->query_list was initialized */
     r300_release_referenced_objects(r300);
@@ -402,8 +403,10 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
     r300->context.create_video_decoder = vl_create_decoder;
     r300->context.create_video_buffer = vl_video_buffer_create;
 
-    r300->uploader = u_upload_create(&r300->context, 256 * 1024, 4,
-                                     PIPE_BIND_INDEX_BUFFER);
+    if (r300screen->caps.has_tcl) {
+        r300->uploader = u_upload_create(&r300->context, 256 * 1024, 4,
+                                         PIPE_BIND_INDEX_BUFFER);
+    }
 
     r300->blitter = util_blitter_create(&r300->context);
     if (r300->blitter == NULL)
@@ -437,7 +440,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
         pipe_resource_reference(&tex, NULL);
     }
 
-    {
+    if (r300screen->caps.has_tcl) {
         struct pipe_resource vb;
         memset(&vb, 0, sizeof(vb));
         vb.target = PIPE_BUFFER;
index a9a76c5fed81357a24e68b751b370f08d2e47f04..5b02cfd90cdc008ab5e3dd1471914d0a3c0e309d 100644 (file)
@@ -1594,19 +1594,22 @@ static void r300_set_vertex_buffers(struct pipe_context* pipe,
 {
     struct r300_context* r300 = r300_context(pipe);
 
-    /* There must be at least one vertex buffer set, otherwise it locks up. */
-    if (!count) {
-        buffers = &r300->dummy_vb;
-        count = 1;
-    }
+    if (r300->screen->caps.has_tcl) {
+        /* There must be at least one vertex buffer set, otherwise it locks up. */
+        if (!count) {
+            buffers = &r300->dummy_vb;
+            count = 1;
+        }
 
-    util_copy_vertex_buffers(r300->vertex_buffer,
-                             &r300->nr_vertex_buffers,
-                             buffers, count);
+        util_copy_vertex_buffers(r300->vertex_buffer,
+                                 &r300->nr_vertex_buffers,
+                                 buffers, count);
 
-    if (r300->screen->caps.has_tcl) {
         r300->vertex_arrays_dirty = TRUE;
     } else {
+        util_copy_vertex_buffers(r300->vertex_buffer,
+                                 &r300->nr_vertex_buffers,
+                                 buffers, count);
         draw_set_vertex_buffers(r300->draw, count, buffers);
     }
 }