diff options
Diffstat (limited to 'src/gallium/drivers/r600')
-rw-r--r-- | src/gallium/drivers/r600/evergreen_state.c | 10 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_state.c | 10 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_state_common.c | 14 |
3 files changed, 22 insertions, 12 deletions
diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 07496ebf51e..af19beb6f3c 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -1327,16 +1327,16 @@ void evergreen_vertex_buffer_update(struct r600_pipe_context *rctx) 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] + - vertex_buffer->buffer_offset + - r600_bo_offset(rbuffer->bo); + 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 = vertex_buffer->buffer_offset + - r600_bo_offset(rbuffer->bo); + offset = 0; } + if (vertex_buffer == NULL) + continue; + offset += vertex_buffer->buffer_offset + r600_bo_offset(rbuffer->bo); r600_pipe_state_add_reg(rstate, R_030000_RESOURCE0_WORD0, offset, 0xFFFFFFFF, rbuffer->bo); diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index cd5f0792d5e..0d76afd6cd5 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -167,16 +167,16 @@ void r600_vertex_buffer_update(struct r600_pipe_context *rctx) 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] + - vertex_buffer->buffer_offset + - r600_bo_offset(rbuffer->bo); + 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 = vertex_buffer->buffer_offset + - r600_bo_offset(rbuffer->bo); + offset = 0; } + if (vertex_buffer == NULL) + continue; + offset += vertex_buffer->buffer_offset + r600_bo_offset(rbuffer->bo); r600_pipe_state_add_reg(rstate, R_038000_RESOURCE0_WORD0, offset, 0xFFFFFFFF, rbuffer->bo); diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index 99b372caace..f488cf74ff2 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -179,8 +179,16 @@ void r600_set_vertex_buffers(struct pipe_context *ctx, unsigned count, struct pipe_vertex_buffer *vbo; unsigned max_index = (unsigned)-1; - for (int i = 0; i < rctx->nvertex_buffer; i++) { - pipe_resource_reference(&rctx->vertex_buffer[i].buffer, NULL); + if (rctx->family >= CHIP_CEDAR) { + for (int i = 0; i < rctx->nvertex_buffer; i++) { + pipe_resource_reference(&rctx->vertex_buffer[i].buffer, NULL); + evergreen_fs_resource_set(&rctx->ctx, NULL, i); + } + } else { + for (int i = 0; i < rctx->nvertex_buffer; i++) { + pipe_resource_reference(&rctx->vertex_buffer[i].buffer, NULL); + r600_context_pipe_state_set_fs_resource(&rctx->ctx, NULL, i); + } } memcpy(rctx->vertex_buffer, buffers, sizeof(struct pipe_vertex_buffer) * count); @@ -188,6 +196,8 @@ void r600_set_vertex_buffers(struct pipe_context *ctx, unsigned count, vbo = (struct pipe_vertex_buffer*)&buffers[i]; rctx->vertex_buffer[i].buffer = NULL; + if (buffers[i].buffer == NULL) + continue; if (r600_buffer_is_user_buffer(buffers[i].buffer)) rctx->any_user_vbs = TRUE; pipe_resource_reference(&rctx->vertex_buffer[i].buffer, buffers[i].buffer); |