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