diff options
author | George Kyriazis <[email protected]> | 2017-02-02 21:16:47 -0600 |
---|---|---|
committer | Tim Rowley <[email protected]> | 2017-02-23 16:36:18 -0600 |
commit | dcac48bfee545660dffbf23bd92a0939b19ffd18 (patch) | |
tree | ed9da084c5b41ca162190a3bf511e7c294f8397f /src/gallium/drivers/swr/swr_state.cpp | |
parent | 669d8f626f64cee1bc74ef7869aac8585b6dcfe6 (diff) |
swr: fix index buffers with non-zero indices
Fix issue with index buffers that do not contain a 0 index. 0 index
can be a non-valid index if the (copied) vertex buffers are a subset of the
user's (which happens because we only copy the range between min & max).
Core will use an index passed in from the driver to replace invalid indices.
Only do this for calls that contain non-zero indices, to minimize performance
Reviewed-by: Bruce Cherniak <[email protected]>
cost.
Diffstat (limited to 'src/gallium/drivers/swr/swr_state.cpp')
-rw-r--r-- | src/gallium/drivers/swr/swr_state.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gallium/drivers/swr/swr_state.cpp b/src/gallium/drivers/swr/swr_state.cpp index 116f19f1ecf..5e3d58d1733 100644 --- a/src/gallium/drivers/swr/swr_state.cpp +++ b/src/gallium/drivers/swr/swr_state.cpp @@ -1106,6 +1106,7 @@ swr_update_derived(struct pipe_context *pipe, SWR_VERTEX_BUFFER_STATE swrVertexBuffers[PIPE_MAX_ATTRIBS]; for (UINT i = 0; i < ctx->num_vertex_buffers; i++) { uint32_t size, pitch, elems, partial_inbounds; + uint32_t min_vertex_index; const uint8_t *p_data; struct pipe_vertex_buffer *vb = &ctx->vertex_buffer[i]; @@ -1117,6 +1118,7 @@ swr_update_derived(struct pipe_context *pipe, size = vb->buffer->width0; elems = size / pitch; partial_inbounds = size % pitch; + min_vertex_index = 0; p_data = swr_resource_data(vb->buffer) + vb->buffer_offset; } else { @@ -1128,6 +1130,7 @@ swr_update_derived(struct pipe_context *pipe, uint32_t base; swr_user_vbuf_range(&info, ctx->velems, vb, i, &elems, &base, &size); partial_inbounds = 0; + min_vertex_index = info.min_index; /* Copy only needed vertices to scratch space */ size = AlignUp(size, 4); @@ -1143,6 +1146,7 @@ swr_update_derived(struct pipe_context *pipe, swrVertexBuffers[i].pitch = pitch; swrVertexBuffers[i].pData = p_data; swrVertexBuffers[i].size = size; + swrVertexBuffers[i].minVertex = min_vertex_index; swrVertexBuffers[i].maxVertex = elems; swrVertexBuffers[i].partialInboundsSize = partial_inbounds; } |