summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/ilo/ilo_state.c
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2013-08-13 15:23:41 +0800
committerChia-I Wu <[email protected]>2013-08-13 15:24:58 +0800
commit8b5b5fe3944d75c5d3667516139e366d2207c22a (patch)
treee93773e8495f443516da0cbb9bb6f3073d16379d /src/gallium/drivers/ilo/ilo_state.c
parentf423eba46e080b975a2b8366b490d99dee4729ad (diff)
Revert "ilo: initialize constant buffer SURFACE_STATE early"
This reverts commit a9b800aa81cffdcaef2490ff49986099feae2663. With push constant support, the constructed SURFACE_STATE is unused and wasted. The change only slows things down.
Diffstat (limited to 'src/gallium/drivers/ilo/ilo_state.c')
-rw-r--r--src/gallium/drivers/ilo/ilo_state.c37
1 files changed, 22 insertions, 15 deletions
diff --git a/src/gallium/drivers/ilo/ilo_state.c b/src/gallium/drivers/ilo/ilo_state.c
index b4af306e54a..ce6930c4aec 100644
--- a/src/gallium/drivers/ilo/ilo_state.c
+++ b/src/gallium/drivers/ilo/ilo_state.c
@@ -105,13 +105,18 @@ finalize_constant_buffers(struct ilo_context *ilo)
/* upload user buffer */
if (cbuf->user_buffer) {
+ const enum pipe_format elem_format =
+ PIPE_FORMAT_R32G32B32A32_FLOAT;
unsigned offset;
u_upload_data(ilo->uploader, 0, cbuf->user_buffer_size,
cbuf->user_buffer, &offset, &cbuf->resource);
- ilo_gpe_set_view_surface_bo(ilo->dev,
- ilo_buffer(cbuf->resource)->bo, offset, &cbuf->surface);
+ ilo_gpe_init_view_surface_for_buffer(ilo->dev,
+ ilo_buffer(cbuf->resource),
+ offset, cbuf->user_buffer_size,
+ util_format_get_blocksize(elem_format), elem_format,
+ false, false, &cbuf->surface);
cbuf->user_buffer = NULL;
cbuf->user_buffer_size = 0;
@@ -628,18 +633,26 @@ ilo_set_constant_buffer(struct pipe_context *pipe,
if (buf) {
for (i = 0; i < count; i++) {
- const enum pipe_format elem_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
struct ilo_cbuf_cso *cso = &cbuf->cso[index + i];
pipe_resource_reference(&cso->resource, buf[i].buffer);
- ilo_gpe_init_view_surface_for_buffer(ilo->dev,
- ilo_buffer(buf[i].buffer),
- buf[i].buffer_offset, buf[i].buffer_size,
- util_format_get_blocksize(elem_format), elem_format,
- false, false, &cso->surface);
+ if (buf[i].buffer) {
+ const enum pipe_format elem_format =
+ PIPE_FORMAT_R32G32B32A32_FLOAT;
- if (buf[i].user_buffer) {
+ ilo_gpe_init_view_surface_for_buffer(ilo->dev,
+ ilo_buffer(buf[i].buffer),
+ buf[i].buffer_offset, buf[i].buffer_size,
+ util_format_get_blocksize(elem_format), elem_format,
+ false, false, &cso->surface);
+
+ cso->user_buffer = NULL;
+ cso->user_buffer_size = 0;
+
+ cbuf->enabled_mask |= 1 << (index + i);
+ }
+ else if (buf[i].user_buffer) {
cso->surface.bo = NULL;
/* buffer_offset does not apply for user buffer */
@@ -648,12 +661,6 @@ ilo_set_constant_buffer(struct pipe_context *pipe,
cbuf->enabled_mask |= 1 << (index + i);
}
- else if (buf[i].buffer) {
- cso->user_buffer = NULL;
- cso->user_buffer_size = 0;
-
- cbuf->enabled_mask |= 1 << (index + i);
- }
else {
cso->surface.bo = NULL;
cso->user_buffer = NULL;