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>
This commit is contained in:
Marek Olšák 2020-12-26 12:10:01 -05:00 committed by Marge Bot
parent b53d404aa7
commit df456312c2
3 changed files with 4 additions and 10 deletions

View File

@ -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;

View File

@ -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)

View File

@ -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);