diff options
author | Dave Airlie <[email protected]> | 2017-11-27 16:12:18 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2017-12-06 23:21:06 +0000 |
commit | 4525cdb7514fc9ffbc7539ebfd7122403f3e0347 (patch) | |
tree | a84e0423b218e2ff2b6414fd68823c0375d90283 /src | |
parent | f51458637cce0fc19d968cc19a02f78a880f2fba (diff) |
r600: handle image/buffer sizes correctly.
This adds support to compute for the resq workarounds (buffer/cube sizes)
Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/r600/evergreen_compute.c | 7 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_pipe.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_state_common.c | 16 |
3 files changed, 21 insertions, 4 deletions
diff --git a/src/gallium/drivers/r600/evergreen_compute.c b/src/gallium/drivers/r600/evergreen_compute.c index 0f97bbe3cb0..b527438b617 100644 --- a/src/gallium/drivers/r600/evergreen_compute.c +++ b/src/gallium/drivers/r600/evergreen_compute.c @@ -709,6 +709,13 @@ static void compute_emit_cs(struct r600_context *rctx, r600_set_atom_dirty(rctx, &rctx->cs_shader_state.atom, true); } + bool need_buf_const = current->shader.uses_tex_buffers || + current->shader.has_txq_cube_array_z_comp; + + if (need_buf_const) { + eg_setup_buffer_constants(rctx, PIPE_SHADER_COMPUTE); + r600_update_driver_const_buffers(rctx, true); + } if (evergreen_emit_atomic_buffer_setup(rctx, current, combined_atomics, &atomic_used_mask)) { radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 0, 0)); radeon_emit(cs, EVENT_TYPE(EVENT_TYPE_CS_PARTIAL_FLUSH) | EVENT_INDEX(4)); diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index 4028d98d960..65d118564d5 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -1044,4 +1044,6 @@ void evergreen_emit_atomic_buffer_save(struct r600_context *rctx, uint8_t *atomic_used_mask_p); void r600_update_compressed_resource_state(struct r600_context *rctx, bool compute_only); +void eg_setup_buffer_constants(struct r600_context *rctx, int shader_type); +void r600_update_driver_const_buffers(struct r600_context *rctx, bool compute_only); #endif diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index 938a85f2387..4d52c08a3d1 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -1216,12 +1216,17 @@ static void r600_set_sample_mask(struct pipe_context *pipe, unsigned sample_mask r600_mark_atom_dirty(rctx, &rctx->sample_mask.atom); } -static void r600_update_driver_const_buffers(struct r600_context *rctx) +void r600_update_driver_const_buffers(struct r600_context *rctx, bool compute_only) { int sh, size; void *ptr; struct pipe_constant_buffer cb; - for (sh = 0; sh < PIPE_SHADER_TYPES; sh++) { + int start, end; + + start = compute_only ? PIPE_SHADER_COMPUTE : 0; + end = compute_only ? PIPE_SHADER_TYPES : PIPE_SHADER_COMPUTE; + + for (sh = start; sh < end; sh++) { struct r600_shader_driver_constants_info *info = &rctx->driver_consts[sh]; if (!info->vs_ucp_dirty && !info->texture_const_dirty && @@ -1341,7 +1346,7 @@ static void r600_setup_buffer_constants(struct r600_context *rctx, int shader_ty * 1. buffer size for TXQ * 2. number of cube layers in a cube map array. */ -static void eg_setup_buffer_constants(struct r600_context *rctx, int shader_type) +void eg_setup_buffer_constants(struct r600_context *rctx, int shader_type) { struct r600_textures_info *samplers = &rctx->samplers[shader_type]; struct r600_image_state *images = NULL; @@ -1355,6 +1360,9 @@ static void eg_setup_buffer_constants(struct r600_context *rctx, int shader_type if (shader_type == PIPE_SHADER_FRAGMENT) { images = &rctx->fragment_images; buffers = &rctx->fragment_buffers; + } else if (shader_type == PIPE_SHADER_COMPUTE) { + images = &rctx->compute_images; + buffers = &rctx->compute_buffers; } if (!samplers->views.dirty_buffer_constants && @@ -1781,7 +1789,7 @@ static bool r600_update_derived_state(struct r600_context *rctx) } } - r600_update_driver_const_buffers(rctx); + r600_update_driver_const_buffers(rctx, false); if (rctx->b.chip_class < EVERGREEN && rctx->ps_shader && rctx->vs_shader) { if (!r600_adjust_gprs(rctx)) { |