summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/r600')
-rw-r--r--src/gallium/drivers/r600/evergreen_state.c5
-rw-r--r--src/gallium/drivers/r600/r600_state.c9
-rw-r--r--src/gallium/drivers/r600/r600_state_common.c5
-rw-r--r--src/gallium/drivers/r600/r600_translate.c12
4 files changed, 10 insertions, 21 deletions
diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
index a9d4a862c32..07496ebf51e 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -1295,11 +1295,6 @@ void evergreen_vertex_buffer_update(struct r600_pipe_context *rctx)
if (rctx->vertex_elements == NULL || !rctx->nvertex_buffer)
return;
- /* delete previous translated vertex elements */
- if (rctx->tran.new_velems) {
- r600_end_vertex_translate(rctx);
- }
-
if (rctx->vertex_elements->incompatible_layout) {
/* translate rebind new vertex elements so
* return once translated
diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c
index 67ea21712f7..cd5f0792d5e 100644
--- a/src/gallium/drivers/r600/r600_state.c
+++ b/src/gallium/drivers/r600/r600_state.c
@@ -135,11 +135,6 @@ void r600_vertex_buffer_update(struct r600_pipe_context *rctx)
if (rctx->vertex_elements == NULL || !rctx->nvertex_buffer)
return;
- /* delete previous translated vertex elements */
- if (rctx->tran.new_velems) {
- r600_end_vertex_translate(rctx);
- }
-
if (rctx->vertex_elements->incompatible_layout) {
/* translate rebind new vertex elements so
* return once translated
@@ -280,7 +275,6 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
{
struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
struct r600_drawl draw;
- boolean translate = FALSE;
memset(&draw, 0, sizeof(struct r600_drawl));
draw.ctx = ctx;
@@ -312,9 +306,6 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
}
r600_draw_common(&draw);
- if (translate)
- r600_end_vertex_translate(rctx);
-
pipe_resource_reference(&draw.index_buffer, NULL);
}
diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
index 1333808c66f..99b372caace 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -119,6 +119,11 @@ void r600_bind_vertex_elements(struct pipe_context *ctx, void *state)
struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
struct r600_vertex_element *v = (struct r600_vertex_element*)state;
+ /* delete previous translated vertex elements */
+ if (rctx->tran.new_velems) {
+ r600_end_vertex_translate(rctx);
+ }
+
rctx->vertex_elements = v;
if (v) {
rctx->states[v->rstate.id] = &v->rstate;
diff --git a/src/gallium/drivers/r600/r600_translate.c b/src/gallium/drivers/r600/r600_translate.c
index 1c227d32151..ba12eee2b56 100644
--- a/src/gallium/drivers/r600/r600_translate.c
+++ b/src/gallium/drivers/r600/r600_translate.c
@@ -42,6 +42,7 @@ void r600_begin_vertex_translate(struct r600_pipe_context *rctx)
struct pipe_resource *out_buffer;
unsigned i, num_verts;
struct pipe_vertex_element new_velems[PIPE_MAX_ATTRIBS];
+ void *tmp;
/* Initialize the translate key, i.e. the recipe how vertices should be
* translated. */
@@ -159,8 +160,9 @@ void r600_begin_vertex_translate(struct r600_pipe_context *rctx)
}
}
- rctx->tran.new_velems = pipe->create_vertex_elements_state(pipe, ve->count, new_velems);
- pipe->bind_vertex_elements_state(pipe, rctx->tran.new_velems);
+ tmp = pipe->create_vertex_elements_state(pipe, ve->count, new_velems);
+ pipe->bind_vertex_elements_state(pipe, tmp);
+ rctx->tran.new_velems = tmp;
pipe_resource_reference(&out_buffer, NULL);
}
@@ -173,15 +175,11 @@ void r600_end_vertex_translate(struct r600_pipe_context *rctx)
return;
}
/* Restore vertex elements. */
- if (rctx->vertex_elements == rctx->tran.new_velems) {
- pipe->bind_vertex_elements_state(pipe, NULL);
- }
pipe->delete_vertex_elements_state(pipe, rctx->tran.new_velems);
rctx->tran.new_velems = NULL;
/* Delete the now-unused VBO. */
- pipe_resource_reference(&rctx->vertex_buffer[rctx->tran.vb_slot].buffer,
- NULL);
+ pipe_resource_reference(&rctx->vertex_buffer[rctx->tran.vb_slot].buffer, NULL);
}
void r600_translate_index_buffer(struct r600_pipe_context *r600,