aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/nine
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2016-12-04 19:23:11 +0100
committerAxel Davy <[email protected]>2016-12-20 23:47:08 +0100
commit8960be0e939bc6c0f9f34c5d4a16891af7e325fd (patch)
tree61ab071c2f30c79bac91f10bb2b055c74693b975 /src/gallium/state_trackers/nine
parent1e64be6f91652e7e5ba60c86c379ee41bb7e4f81 (diff)
st/nine: Allow non-zero resource offset for vertex buffers
Next patches will introduce an offset. Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/nine')
-rw-r--r--src/gallium/state_trackers/nine/nine_state.c15
-rw-r--r--src/gallium/state_trackers/nine/vertexbuffer9.c3
-rw-r--r--src/gallium/state_trackers/nine/vertexbuffer9.h2
3 files changed, 12 insertions, 8 deletions
diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c
index c0bd6f7bccf..afc309f1dbe 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -1539,14 +1539,15 @@ nine_context_set_stream_source(struct NineDevice9 *device,
UINT Stride)
{
struct pipe_resource *res = NULL;
+ unsigned offset = 0;
if (pVBuf9)
- res = NineVertexBuffer9_GetResource(pVBuf9);
+ res = NineVertexBuffer9_GetResource(pVBuf9, &offset);
/* in the future when there is internal offset, add it
* to OffsetInBytes */
nine_context_set_stream_source_apply(device, StreamNumber,
- res, OffsetInBytes,
+ res, offset + OffsetInBytes,
Stride);
}
@@ -2041,9 +2042,10 @@ nine_context_apply_stateblock(struct NineDevice9 *device,
for (i = 0; m; ++i, m >>= 1) {
if (src->changed.vtxbuf & (1 << i)) {
if (src->stream[i]) {
- context->vtxbuf[i].buffer_offset = src->vtxbuf[i].buffer_offset;
+ unsigned offset = 0;
pipe_resource_reference(&context->vtxbuf[i].buffer,
- src->stream[i] ? NineVertexBuffer9_GetResource(src->stream[i]) : NULL);
+ src->stream[i] ? NineVertexBuffer9_GetResource(src->stream[i], &offset) : NULL);
+ context->vtxbuf[i].buffer_offset = src->vtxbuf[i].buffer_offset + offset;
context->vtxbuf[i].stride = src->vtxbuf[i].stride;
}
}
@@ -3276,16 +3278,17 @@ update_vertex_buffers_sw(struct NineDevice9 *device, int start_vertice, int num_
for (i = 0; mask; mask >>= 1, ++i) {
if (mask & 1) {
if (state->stream[i]) {
+ unsigned offset;
struct pipe_resource *buf;
struct pipe_box box;
vtxbuf = state->vtxbuf[i];
- vtxbuf.buffer = NineVertexBuffer9_GetResource(state->stream[i]);
+ vtxbuf.buffer = NineVertexBuffer9_GetResource(state->stream[i], &offset);
DBG("Locking %p (offset %d, length %d)\n", vtxbuf.buffer,
vtxbuf.buffer_offset, num_vertices * vtxbuf.stride);
- u_box_1d(vtxbuf.buffer_offset + start_vertice * vtxbuf.stride,
+ u_box_1d(vtxbuf.buffer_offset + offset + start_vertice * vtxbuf.stride,
num_vertices * vtxbuf.stride, &box);
buf = vtxbuf.buffer;
vtxbuf.user_buffer = pipe->transfer_map(pipe, buf, 0, PIPE_TRANSFER_READ, &box,
diff --git a/src/gallium/state_trackers/nine/vertexbuffer9.c b/src/gallium/state_trackers/nine/vertexbuffer9.c
index b0eebfb48f3..027f290d8a3 100644
--- a/src/gallium/state_trackers/nine/vertexbuffer9.c
+++ b/src/gallium/state_trackers/nine/vertexbuffer9.c
@@ -63,8 +63,9 @@ NineVertexBuffer9_dtor( struct NineVertexBuffer9 *This )
}
struct pipe_resource *
-NineVertexBuffer9_GetResource( struct NineVertexBuffer9 *This )
+NineVertexBuffer9_GetResource( struct NineVertexBuffer9 *This, unsigned *offset )
{
+ *offset = 0;
return NineBuffer9_GetResource(&This->base);
}
diff --git a/src/gallium/state_trackers/nine/vertexbuffer9.h b/src/gallium/state_trackers/nine/vertexbuffer9.h
index 6caa9bfe326..2991dbadd07 100644
--- a/src/gallium/state_trackers/nine/vertexbuffer9.h
+++ b/src/gallium/state_trackers/nine/vertexbuffer9.h
@@ -58,7 +58,7 @@ NineVertexBuffer9_dtor( struct NineVertexBuffer9 *This );
/*** Nine private ***/
struct pipe_resource *
-NineVertexBuffer9_GetResource( struct NineVertexBuffer9 *This );
+NineVertexBuffer9_GetResource( struct NineVertexBuffer9 *This, unsigned *offset );
/*** Direct3D public ***/