summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2019-01-11 18:06:59 -0500
committerMarek Olšák <[email protected]>2019-01-22 11:59:27 -0500
commitc605738113fe91d04f799eae52cec28fafac3f2d (patch)
tree070f69ee6afd13187746e0fad77f51e65238979d
parentf139589069c116f676fe6a4665400c199563222b (diff)
radeonsi: compile clear and copy buffer compute shaders on demand
same as all other shaders
-rw-r--r--src/gallium/drivers/radeonsi/si_compute_blit.c14
-rw-r--r--src/gallium/drivers/radeonsi/si_pipe.c8
2 files changed, 14 insertions, 8 deletions
diff --git a/src/gallium/drivers/radeonsi/si_compute_blit.c b/src/gallium/drivers/radeonsi/si_compute_blit.c
index 11da04bed85..dfa77a98804 100644
--- a/src/gallium/drivers/radeonsi/si_compute_blit.c
+++ b/src/gallium/drivers/radeonsi/si_compute_blit.c
@@ -111,12 +111,20 @@ static void si_compute_do_clear_or_copy(struct si_context *sctx,
sb[0].buffer_offset = dst_offset;
sb[0].buffer_size = size;
+ bool shader_dst_stream_policy = SI_COMPUTE_DST_CACHE_POLICY != L2_LRU;
+
if (src) {
sb[1].buffer = src;
sb[1].buffer_offset = src_offset;
sb[1].buffer_size = size;
ctx->set_shader_buffers(ctx, PIPE_SHADER_COMPUTE, 0, 2, sb);
+
+ if (!sctx->cs_copy_buffer) {
+ sctx->cs_copy_buffer = si_create_dma_compute_shader(&sctx->b,
+ SI_COMPUTE_COPY_DW_PER_THREAD,
+ shader_dst_stream_policy, true);
+ }
ctx->bind_compute_state(ctx, sctx->cs_copy_buffer);
} else {
assert(clear_value_size >= 4 &&
@@ -127,6 +135,12 @@ static void si_compute_do_clear_or_copy(struct si_context *sctx,
sctx->cs_user_data[i] = clear_value[i % (clear_value_size / 4)];
ctx->set_shader_buffers(ctx, PIPE_SHADER_COMPUTE, 0, 1, sb);
+
+ if (!sctx->cs_clear_buffer) {
+ sctx->cs_clear_buffer = si_create_dma_compute_shader(&sctx->b,
+ SI_COMPUTE_CLEAR_DW_PER_THREAD,
+ shader_dst_stream_policy, false);
+ }
ctx->bind_compute_state(ctx, sctx->cs_clear_buffer);
}
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index 92ce1e0699c..6b89a1192d9 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -510,14 +510,6 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen,
if (sscreen->debug_flags & DBG(FORCE_DMA))
sctx->b.resource_copy_region = sctx->dma_copy;
- bool dst_stream_policy = SI_COMPUTE_DST_CACHE_POLICY != L2_LRU;
- sctx->cs_clear_buffer = si_create_dma_compute_shader(&sctx->b,
- SI_COMPUTE_CLEAR_DW_PER_THREAD,
- dst_stream_policy, false);
- sctx->cs_copy_buffer = si_create_dma_compute_shader(&sctx->b,
- SI_COMPUTE_COPY_DW_PER_THREAD,
- dst_stream_policy, true);
-
sctx->blitter = util_blitter_create(&sctx->b);
if (sctx->blitter == NULL)
goto fail;