diff options
author | Chia-I Wu <[email protected]> | 2013-08-11 22:44:44 +0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2013-08-12 11:49:51 +0800 |
commit | a9b800aa81cffdcaef2490ff49986099feae2663 (patch) | |
tree | de2c4238599df421d46da7267d17e8f14e76cbb7 /src/gallium/drivers/ilo/ilo_state.c | |
parent | b2f79a3823bd5fca3f3080351f87b41e2396c8f6 (diff) |
ilo: initialize constant buffer SURFACE_STATE early
Fix ilo_gpe_init_view_surface_for_buffer to allow buffer to be NULL, and add
ilo_gpe_set_view_surface_bo to set it later. This allows us to set up
SURFACE_STATE early for constant buffers backed by user buffers.
Diffstat (limited to 'src/gallium/drivers/ilo/ilo_state.c')
-rw-r--r-- | src/gallium/drivers/ilo/ilo_state.c | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/src/gallium/drivers/ilo/ilo_state.c b/src/gallium/drivers/ilo/ilo_state.c index ce6930c4aec..b4af306e54a 100644 --- a/src/gallium/drivers/ilo/ilo_state.c +++ b/src/gallium/drivers/ilo/ilo_state.c @@ -105,18 +105,13 @@ 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_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); + ilo_gpe_set_view_surface_bo(ilo->dev, + ilo_buffer(cbuf->resource)->bo, offset, &cbuf->surface); cbuf->user_buffer = NULL; cbuf->user_buffer_size = 0; @@ -633,26 +628,18 @@ 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); - if (buf[i].buffer) { - const enum pipe_format elem_format = - PIPE_FORMAT_R32G32B32A32_FLOAT; + 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); - 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) { + if (buf[i].user_buffer) { cso->surface.bo = NULL; /* buffer_offset does not apply for user buffer */ @@ -661,6 +648,12 @@ 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; |