diff options
author | Axel Davy <[email protected]> | 2016-11-01 16:38:57 +0100 |
---|---|---|
committer | Axel Davy <[email protected]> | 2016-12-20 23:44:22 +0100 |
commit | 69f447752debda137498c9891ffcbc15a3db301a (patch) | |
tree | 019e862508fa2769b456ba6e7fcc37b7aa2a3de0 /src | |
parent | 08b717dfd33cb733ef3558ef3edf2e051396c462 (diff) |
st/nine: Decompose nine_context_set_indices
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')
-rw-r--r-- | src/gallium/state_trackers/nine/nine_state.c | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c index 2a059d928e0..2dabd4b1379 100644 --- a/src/gallium/state_trackers/nine/nine_state.c +++ b/src/gallium/state_trackers/nine/nine_state.c @@ -1244,23 +1244,39 @@ nine_context_set_stream_source_freq(struct NineDevice9 *device, context->changed.group |= NINE_STATE_STREAMFREQ; } +static void +nine_context_set_indices_apply(struct NineDevice9 *device, + struct pipe_resource *res, + UINT IndexSize, + UINT OffsetInBytes) +{ + struct nine_context *context = &device->context; + + context->idxbuf.index_size = IndexSize; + context->idxbuf.offset = OffsetInBytes; + pipe_resource_reference(&context->idxbuf.buffer, res); + context->idxbuf.user_buffer = NULL; + + context->changed.group |= NINE_STATE_IDXBUF; +} + void nine_context_set_indices(struct NineDevice9 *device, struct NineIndexBuffer9 *idxbuf) { - struct nine_context *context = &device->context; const struct pipe_index_buffer *pipe_idxbuf; + struct pipe_resource *res = NULL; + UINT IndexSize = 0; + UINT OffsetInBytes = 0; if (idxbuf) { pipe_idxbuf = NineIndexBuffer9_GetBuffer(idxbuf); - context->idxbuf.index_size = pipe_idxbuf->index_size; - pipe_resource_reference(&context->idxbuf.buffer, pipe_idxbuf->buffer); - context->idxbuf.offset = pipe_idxbuf->offset; - context->idxbuf.user_buffer = NULL; - } else - pipe_resource_reference(&context->idxbuf.buffer, NULL); + IndexSize = pipe_idxbuf->index_size; + res = pipe_idxbuf->buffer; + OffsetInBytes = pipe_idxbuf->offset; + } - context->changed.group |= NINE_STATE_IDXBUF; + nine_context_set_indices_apply(device, res, IndexSize, OffsetInBytes); } void |