radeonsi: fix vertex element state
authorChristian König <deathsimple@vodafone.de>
Mon, 16 Jul 2012 10:07:54 +0000 (12:07 +0200)
committerChristian König <deathsimple@vodafone.de>
Tue, 17 Jul 2012 08:44:12 +0000 (10:44 +0200)
The vertex element state isn't in registers any more, so
remove that old code. That fixes a memory corruption with
the blend state and gets eglgears partially working.

Signed-off-by: Christian König <deathsimple@vodafone.de>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
src/gallium/drivers/radeonsi/r600_state_common.c
src/gallium/drivers/radeonsi/radeonsi_pipe.h

index 05b7946512ff5ff8537a13f6ec011077115b01cc..b63027e9c3819f86f7dbf0f84f95aee776b7cce9 100644 (file)
@@ -279,9 +279,6 @@ void r600_bind_vertex_elements(struct pipe_context *ctx, void *state)
        rctx->vertex_elements = v;
        if (v) {
                r600_inval_shader_cache(rctx);
-
-               rctx->states[v->rstate.id] = &v->rstate;
-               r600_context_pipe_state_set(rctx, &v->rstate);
        }
 }
 
@@ -290,9 +287,6 @@ void r600_delete_vertex_element(struct pipe_context *ctx, void *state)
        struct r600_context *rctx = (struct r600_context *)ctx;
        struct r600_vertex_element *v = (struct r600_vertex_element*)state;
 
-       if (rctx->states[v->rstate.id] == &v->rstate) {
-               rctx->states[v->rstate.id] = NULL;
-       }
        if (rctx->vertex_elements == state)
                rctx->vertex_elements = NULL;
        FREE(state);
@@ -558,13 +552,8 @@ static void r600_vertex_buffer_update(struct r600_context *rctx)
 
        r600_inval_vertex_cache(rctx);
 
-       if (rctx->vertex_elements->vbuffer_need_offset) {
-               /* one resource per vertex elements */
-               count = rctx->vertex_elements->count;
-       } else {
-               /* bind vertex buffer once */
-               count = rctx->nr_vertex_buffers;
-       }
+       /* bind vertex buffer once */
+       count = rctx->nr_vertex_buffers;
        assert(count <= 256 / 4);
 
        t_list_buffer = (struct r600_resource*)
@@ -583,19 +572,10 @@ static void r600_vertex_buffer_update(struct r600_context *rctx)
                unsigned data_format, num_format;
                int first_non_void;
 
-               if (rctx->vertex_elements->vbuffer_need_offset) {
-                       /* one resource per vertex elements */
-                       unsigned vbuffer_index;
-                       vbuffer_index = rctx->vertex_elements->elements[i].vertex_buffer_index;
-                       vertex_buffer = &rctx->vertex_buffer[vbuffer_index];
-                       rbuffer = (struct r600_resource*)vertex_buffer->buffer;
-                       offset = rctx->vertex_elements->vbuffer_offset[i];
-               } else {
-                       /* bind vertex buffer once */
-                       vertex_buffer = &rctx->vertex_buffer[i];
-                       rbuffer = (struct r600_resource*)vertex_buffer->buffer;
-                       offset = 0;
-               }
+               /* bind vertex buffer once */
+               vertex_buffer = &rctx->vertex_buffer[i];
+               rbuffer = (struct r600_resource*)vertex_buffer->buffer;
+               offset = 0;
                if (vertex_buffer == NULL || rbuffer == NULL)
                        continue;
                offset += vertex_buffer->buffer_offset;
index 7d6b13a4683b8da95b4aa85e4d3c09dd62afd772..6ba1017e16d9e4ee36adfff7cb98b94f8bcbca3d 100644 (file)
@@ -156,13 +156,6 @@ struct r600_vertex_element
 {
        unsigned                        count;
        struct pipe_vertex_element      elements[PIPE_MAX_ATTRIBS];
-       unsigned                        fs_size;
-       struct r600_pipe_state          rstate;
-       /* if offset is to big for fetch instructio we need to alterate
-        * offset of vertex buffer, record here the offset need to add
-        */
-       unsigned                        vbuffer_need_offset;
-       unsigned                        vbuffer_offset[PIPE_MAX_ATTRIBS];
 };
 
 struct r600_shader_io {