It helps remove one use of sel->type.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6340>
sel->info.stage = MESA_SHADER_COMPUTE;
sel->type = PIPE_SHADER_COMPUTE;
sel->screen = sscreen;
+ sel->const_and_shader_buf_descriptors_index =
+ si_const_and_shader_buffer_descriptors_idx(sel->type);
+ sel->sampler_and_images_descriptors_index =
+ si_sampler_and_image_descriptors_idx(sel->type);
program->shader.selector = &program->sel;
program->ir_type = cso->ir_type;
program->local_size = cso->req_local_mem;
if (!sel)
return;
- si_set_active_descriptors(sctx, si_const_and_shader_buffer_descriptors_idx(sel->type),
+ si_set_active_descriptors(sctx, sel->const_and_shader_buf_descriptors_index,
sel->active_const_and_shader_buffers);
- si_set_active_descriptors(sctx, si_sampler_and_image_descriptors_idx(sel->type),
+ si_set_active_descriptors(sctx, sel->sampler_and_images_descriptors_index,
sel->active_samplers_and_images);
}
/* PIPE_SHADER_[VERTEX|FRAGMENT|...] */
enum pipe_shader_type type;
+ ubyte const_and_shader_buf_descriptors_index;
+ ubyte sampler_and_images_descriptors_index;
bool vs_needs_prolog;
bool prim_discard_cs_allowed;
bool ngg_culling_allowed;
si_nir_scan_shader(sel->nir, &sel->info);
sel->type = pipe_shader_type_from_mesa(sel->info.stage);
+ sel->const_and_shader_buf_descriptors_index =
+ si_const_and_shader_buffer_descriptors_idx(sel->type);
+ sel->sampler_and_images_descriptors_index =
+ si_sampler_and_image_descriptors_idx(sel->type);
+
p_atomic_inc(&sscreen->num_shaders_created);
si_get_active_slot_masks(&sel->info, &sel->active_const_and_shader_buffers,
&sel->active_samplers_and_images);