radeonsi: restructure si_pipe_set_constant_buffer
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6948>
diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
index 2d0bfc4..9ea61be 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -1164,15 +1164,17 @@
if (shader >= SI_NUM_SHADERS)
return;
- if (slot == 0 && input && input->buffer &&
- !(si_resource(input->buffer)->flags & RADEON_FLAG_32BIT)) {
- assert(!"constant buffer 0 must have a 32-bit VM address, use const_uploader");
- return;
+ if (input) {
+ if (input->buffer) {
+ if (slot == 0 &&
+ !(si_resource(input->buffer)->flags & RADEON_FLAG_32BIT)) {
+ assert(!"constant buffer 0 must have a 32-bit VM address, use const_uploader");
+ return;
+ }
+ si_resource(input->buffer)->bind_history |= PIPE_BIND_CONSTANT_BUFFER;
+ }
}
- if (input && input->buffer)
- si_resource(input->buffer)->bind_history |= PIPE_BIND_CONSTANT_BUFFER;
-
slot = si_get_constbuf_slot(slot);
si_set_constant_buffer(sctx, &sctx->const_and_shader_buffers[shader],
si_const_and_shader_buffer_descriptors_idx(shader), slot, input);