summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2018-06-06 14:14:31 -0700
committerKenneth Graunke <[email protected]>2019-02-21 10:26:06 -0800
commit4e007dbb3097e965b736f35ccfdd00ebf025423b (patch)
treef680015fb91b1adeffaeec613f97cd887dedc0ab /src
parent9ea05ccf1f20691cde6911762bce8207c7283714 (diff)
iris: have more than one const_offset
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/iris/iris_context.h9
-rw-r--r--src/gallium/drivers/iris/iris_state.c16
2 files changed, 14 insertions, 11 deletions
diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h
index 90230e8705a..bf0724b9a6a 100644
--- a/src/gallium/drivers/iris/iris_context.h
+++ b/src/gallium/drivers/iris/iris_context.h
@@ -169,10 +169,13 @@ struct iris_compiled_shader {
uint8_t derived_data[0];
};
+struct iris_const_buffer {
+ struct pipe_resource *res;
+ unsigned offset;
+};
+
struct iris_shader_state {
- struct pipe_constant_buffer constbuf[PIPE_MAX_CONSTANT_BUFFERS];
- struct pipe_resource *const_resources[PIPE_MAX_CONSTANT_BUFFERS];
- unsigned const_offset;
+ struct iris_const_buffer constbuf[PIPE_MAX_CONSTANT_BUFFERS];
};
struct iris_vtable {
diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c
index e0000c19887..3e81cd95842 100644
--- a/src/gallium/drivers/iris/iris_state.c
+++ b/src/gallium/drivers/iris/iris_state.c
@@ -1345,17 +1345,17 @@ iris_set_constant_buffer(struct pipe_context *ctx,
struct iris_context *ice = (struct iris_context *) ctx;
gl_shader_stage stage = stage_from_pipe(p_stage);
struct iris_shader_state *shs = &ice->shaders.state[stage];
+ struct iris_const_buffer *cbuf = &shs->constbuf[index];
if (input && (input->buffer || input->user_buffer)) {
if (input->user_buffer) {
u_upload_data(ctx->const_uploader, 0, input->buffer_size, 32,
- input->user_buffer, &shs->const_offset,
- &shs->const_resources[index]);
+ input->user_buffer, &cbuf->offset, &cbuf->res);
} else {
- pipe_resource_reference(&shs->const_resources[index], input->buffer);
+ pipe_resource_reference(&cbuf->res, input->buffer);
}
} else {
- pipe_resource_reference(&shs->const_resources[index], NULL);
+ pipe_resource_reference(&cbuf->res, NULL);
}
}
@@ -2260,14 +2260,14 @@ iris_upload_render_state(struct iris_context *ice,
continue;
// XXX: is range->block a constbuf index? it would be nice
- struct iris_resource *res =
- (void *) shs->const_resources[range->block];
+ struct iris_const_buffer *cbuf = &shs->constbuf[range->block];
+ struct iris_resource *res = (void *) cbuf->res;
- assert(shs->const_offset % 32 == 0);
+ assert(cbuf->offset % 32 == 0);
pkt.ConstantBody.ReadLength[n] = range->length;
pkt.ConstantBody.Buffer[n] =
- ro_bo(res->bo, range->start * 32 + shs->const_offset);
+ ro_bo(res->bo, range->start * 32 + cbuf->offset);
n--;
}
}