gallium/svga: Don't replace user vertex buffer with uploaded copy
authorThomas Hellstrom <thellstrom@vmware.com>
Mon, 7 Mar 2011 09:40:26 +0000 (10:40 +0100)
committerThomas Hellstrom <thellstrom@vmware.com>
Wed, 9 Mar 2011 07:49:33 +0000 (08:49 +0100)
Do that later on when we set up the hwtnl state instead.
This addresses a problem when we drop the uploaded copy due to a vb
size change, it will remain referenced in svga->curr.vb[], and the
new contents of the vb will never be uploaded.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
src/gallium/drivers/svga/svga_state_vdecl.c

index 958d00393f2f28b90ddbd58fd80eb8cafd203d2d..2f85f9488f9dda03578d39b15080da7d5152d46c 100644 (file)
@@ -78,7 +78,6 @@ upload_user_buffers( struct svga_context *svga )
                             buffer->b.b.width0);
          }
 
-         pipe_resource_reference( &svga->curr.vb[i].buffer, buffer->uploaded.buffer );
          svga->curr.vb[i].buffer_offset = buffer->uploaded.offset;
       }
    }
@@ -110,6 +109,7 @@ static int emit_hw_vs_vdecl( struct svga_context *svga,
    for (i = 0; i < svga->curr.velems->count; i++) {
       const struct pipe_vertex_buffer *vb = &svga->curr.vb[ve[i].vertex_buffer_index];
       unsigned usage, index;
+      struct svga_buffer *buffer = svga_buffer(vb->buffer);
 
 
       svga_generate_vdecl_semantics( i, &usage, &index );
@@ -127,6 +127,7 @@ static int emit_hw_vs_vdecl( struct svga_context *svga,
       svga_hwtnl_vdecl( svga->hwtnl,
                         i,
                         &decl,
+                        buffer->uploaded.buffer ? buffer->uploaded.buffer :
                         vb->buffer );
    }