summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/nine
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2019-01-21 22:50:01 +0100
committerAxel Davy <[email protected]>2019-04-30 19:18:52 +0200
commit5c67db68897843885ac1502c85995527288613f1 (patch)
treec437e87a554f7edb0a945626f55cf36571f74287 /src/gallium/state_trackers/nine
parent9942ba2ea3bdfc55e2c832c8a03623d35e3bfe1f (diff)
st/nine: Handle const_ranges in nine_state
Handle slot mapping if there is one. 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.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c
index 7de5fc9a4c6..43675716a5e 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -495,7 +495,19 @@ prepare_vs_constants_userbuf(struct NineDevice9 *device)
assert(cb.buffer && upload_ptr);
- memcpy(upload_ptr, cb.user_buffer, cb.buffer_size);
+ if (!context->cso_shader.vs_const_ranges) {
+ memcpy(upload_ptr, cb.user_buffer, cb.buffer_size);
+ } else {
+ unsigned i = 0;
+ unsigned offset = 0;
+ while (context->cso_shader.vs_const_ranges[i*2+1] != 0) {
+ memcpy(upload_ptr+offset,
+ &((float*)cb.user_buffer)[4*context->cso_shader.vs_const_ranges[i*2]],
+ context->cso_shader.vs_const_ranges[i*2+1] * sizeof(float[4]));
+ offset += context->cso_shader.vs_const_ranges[i*2+1] * sizeof(float[4]);
+ i++;
+ }
+ }
u_upload_unmap(context->pipe->const_uploader);
cb.user_buffer = NULL;
@@ -571,7 +583,19 @@ prepare_ps_constants_userbuf(struct NineDevice9 *device)
assert(cb.buffer && upload_ptr);
- memcpy(upload_ptr, cb.user_buffer, cb.buffer_size);
+ if (!context->cso_shader.ps_const_ranges) {
+ memcpy(upload_ptr, cb.user_buffer, cb.buffer_size);
+ } else {
+ unsigned i = 0;
+ unsigned offset = 0;
+ while (context->cso_shader.ps_const_ranges[i*2+1] != 0) {
+ memcpy(upload_ptr+offset,
+ &((float*)cb.user_buffer)[4*context->cso_shader.ps_const_ranges[i*2]],
+ context->cso_shader.ps_const_ranges[i*2+1] * sizeof(float[4]));
+ offset += context->cso_shader.ps_const_ranges[i*2+1] * sizeof(float[4]);
+ i++;
+ }
+ }
u_upload_unmap(context->pipe->const_uploader);
cb.user_buffer = NULL;