summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2016-10-26 23:25:05 +0200
committerAxel Davy <[email protected]>2016-12-20 23:44:22 +0100
commit08b717dfd33cb733ef3558ef3edf2e051396c462 (patch)
tree91a27c4d8590e514b3890232058ce8c7acc9d4c9 /src/gallium/state_trackers
parent7ebdbb573b6d784068d92993d1f5f81986cfe279 (diff)
st/nine: Decompose nine_context_set_stream_source
Part of the refactor to move all gallium calls to nine_state.c, and have all internal states required for those calls in nine_context. Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/nine/nine_state.c34
1 files changed, 25 insertions, 9 deletions
diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c
index 928d82050c9..2a059d928e0 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -1190,6 +1190,23 @@ nine_context_set_sampler_state(struct NineDevice9 *device,
context->changed.sampler[Sampler] |= 1 << Type;
}
+static void
+nine_context_set_stream_source_apply(struct NineDevice9 *device,
+ UINT StreamNumber,
+ struct pipe_resource *res,
+ UINT OffsetInBytes,
+ UINT Stride)
+{
+ struct nine_context *context = &device->context;
+ const unsigned i = StreamNumber;
+
+ context->vtxbuf[i].stride = Stride;
+ context->vtxbuf[i].buffer_offset = OffsetInBytes;
+ pipe_resource_reference(&context->vtxbuf[i].buffer, res);
+
+ context->changed.vtxbuf |= 1 << StreamNumber;
+}
+
void
nine_context_set_stream_source(struct NineDevice9 *device,
UINT StreamNumber,
@@ -1197,17 +1214,16 @@ nine_context_set_stream_source(struct NineDevice9 *device,
UINT OffsetInBytes,
UINT Stride)
{
- struct nine_context *context = &device->context;
- const unsigned i = StreamNumber;
+ struct pipe_resource *res = NULL;
- context->changed.vtxbuf |= 1 << StreamNumber;
+ if (pVBuf9)
+ res = NineVertexBuffer9_GetResource(pVBuf9);
+ /* in the future when there is internal offset, add it
+ * to OffsetInBytes */
- if (pVBuf9) {
- context->vtxbuf[i].stride = Stride;
- context->vtxbuf[i].buffer_offset = OffsetInBytes;
- }
- pipe_resource_reference(&context->vtxbuf[i].buffer,
- pVBuf9 ? NineVertexBuffer9_GetResource(pVBuf9) : NULL);
+ nine_context_set_stream_source_apply(device, StreamNumber,
+ res, OffsetInBytes,
+ Stride);
}
void