summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2020-12-26 12:10:01 -0500
committerMarge Bot <eric+marge@anholt.net>2021-01-18 01:17:19 +0000
commitdf456312c2a9749ea535820d792b151b73b9757f (patch)
tree3621be681410d759647f6fa17bb185dd57cc7b3f
parentb53d404aa73d3dd71c5e9a5005b46c860c8a4eca (diff)
radeonsi: constant buffer cleanups
si_set_clip_state unreferenced a NULL pointer = no-op. si_set_tess_state can just pass the user buffer to si_set_rw_buffer directly. Then si_upload_const_buffer can be static. Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8548>
-rw-r--r--src/gallium/drivers/radeonsi/si_descriptors.c4
-rw-r--r--src/gallium/drivers/radeonsi/si_state.c8
-rw-r--r--src/gallium/drivers/radeonsi/si_state.h2
3 files changed, 4 insertions, 10 deletions
diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
index 21f9ae4b146..bf01803ebac 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -1081,8 +1081,8 @@ static struct si_descriptors *si_const_and_shader_buffer_descriptors(struct si_c
return &sctx->descriptors[si_const_and_shader_buffer_descriptors_idx(shader)];
}
-void si_upload_const_buffer(struct si_context *sctx, struct si_resource **buf, const uint8_t *ptr,
- unsigned size, uint32_t *const_offset)
+static void si_upload_const_buffer(struct si_context *sctx, struct si_resource **buf,
+ const uint8_t *ptr, unsigned size, uint32_t *const_offset)
{
void *tmp;
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index 9e3132e8c70..c2916b72f5a 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -715,7 +715,6 @@ static void si_set_clip_state(struct pipe_context *ctx, const struct pipe_clip_s
cb.buffer_offset = 0;
cb.buffer_size = 4 * 4 * 8;
si_set_rw_buffer(sctx, SI_VS_CONST_CLIP_PLANES, &cb);
- pipe_resource_reference(&cb.buffer, NULL);
}
static void si_emit_clip_state(struct si_context *sctx)
@@ -4888,14 +4887,11 @@ static void si_set_tess_state(struct pipe_context *ctx, const float default_oute
memcpy(array + 4, default_inner_level, sizeof(float) * 2);
cb.buffer = NULL;
- cb.user_buffer = NULL;
+ cb.user_buffer = array;
+ cb.buffer_offset = 0;
cb.buffer_size = sizeof(array);
- si_upload_const_buffer(sctx, (struct si_resource **)&cb.buffer, (void *)array, sizeof(array),
- &cb.buffer_offset);
-
si_set_rw_buffer(sctx, SI_HS_CONST_DEFAULT_TESS_LEVELS, &cb);
- pipe_resource_reference(&cb.buffer, NULL);
}
static void si_texture_barrier(struct pipe_context *ctx, unsigned flags)
diff --git a/src/gallium/drivers/radeonsi/si_state.h b/src/gallium/drivers/radeonsi/si_state.h
index 9eb798e0fd7..2de248f3705 100644
--- a/src/gallium/drivers/radeonsi/si_state.h
+++ b/src/gallium/drivers/radeonsi/si_state.h
@@ -512,8 +512,6 @@ bool si_gfx_resources_check_encrypted(struct si_context *sctx);
bool si_compute_resources_check_encrypted(struct si_context *sctx);
void si_shader_pointers_mark_dirty(struct si_context *sctx);
void si_add_all_descriptors_to_bo_list(struct si_context *sctx);
-void si_upload_const_buffer(struct si_context *sctx, struct si_resource **buf, const uint8_t *ptr,
- unsigned size, uint32_t *const_offset);
void si_update_all_texture_descriptors(struct si_context *sctx);
void si_shader_change_notify(struct si_context *sctx);
void si_update_needs_color_decompress_masks(struct si_context *sctx);