radeonsi: remove some uses of enum pipe_shader_type

it's identical to gl_shader_stage

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32713>
This commit is contained in:
Marek Olšák 2024-12-02 23:26:35 -05:00 committed by Marge Bot
parent 110b308841
commit 7ddb28f447
5 changed files with 13 additions and 20 deletions

View file

@ -767,11 +767,10 @@ static unsigned si_identity(unsigned slot)
static void si_dump_descriptors(struct si_context *sctx, gl_shader_stage stage,
const struct si_shader_info *info, struct u_log_context *log)
{
enum pipe_shader_type processor = pipe_shader_type_from_mesa(stage);
struct si_descriptors *descs =
&sctx->descriptors[SI_DESCS_FIRST_SHADER + processor * SI_NUM_SHADER_DESCS];
&sctx->descriptors[SI_DESCS_FIRST_SHADER + stage * SI_NUM_SHADER_DESCS];
static const char *shader_name[] = {"VS", "PS", "GS", "TCS", "TES", "CS"};
const char *name = shader_name[processor];
const char *name = shader_name[stage];
unsigned enabled_constbuf, enabled_shaderbuf, enabled_samplers;
unsigned enabled_images;
@ -782,15 +781,15 @@ static void si_dump_descriptors(struct si_context *sctx, gl_shader_stage stage,
enabled_images = u_bit_consecutive(0, info->base.num_images);
} else {
enabled_constbuf =
sctx->const_and_shader_buffers[processor].enabled_mask >> SI_NUM_SHADER_BUFFERS;
sctx->const_and_shader_buffers[stage].enabled_mask >> SI_NUM_SHADER_BUFFERS;
enabled_shaderbuf = 0;
for (int i = 0; i < SI_NUM_SHADER_BUFFERS; i++) {
enabled_shaderbuf |=
(sctx->const_and_shader_buffers[processor].enabled_mask &
(sctx->const_and_shader_buffers[stage].enabled_mask &
1llu << (SI_NUM_SHADER_BUFFERS - i - 1)) << i;
}
enabled_samplers = sctx->samplers[processor].enabled_mask;
enabled_images = sctx->images[processor].enabled_mask;
enabled_samplers = sctx->samplers[stage].enabled_mask;
enabled_images = sctx->images[stage].enabled_mask;
}
si_dump_descriptor_list(sctx->screen, &descs[SI_SHADER_DESCS_CONST_AND_SHADER_BUFFERS], name,

View file

@ -1072,7 +1072,6 @@ struct si_context {
struct si_shader_ctx_state gs;
struct si_shader_ctx_state ps;
} shader;
/* indexed access using pipe_shader_type (not by MESA_SHADER_*) */
struct si_shader_ctx_state shaders[SI_NUM_GRAPHICS_SHADERS];
};
struct si_cs_shader_state cs_shader_state;

View file

@ -1987,8 +1987,7 @@ static void si_lower_ngg(struct si_shader *shader, nir_shader *nir)
struct nir_shader *si_deserialize_shader(struct si_shader_selector *sel)
{
struct pipe_screen *screen = &sel->screen->b;
const void *options = screen->get_compiler_options(screen, PIPE_SHADER_IR_NIR,
pipe_shader_type_from_mesa(sel->stage));
const void *options = screen->get_compiler_options(screen, PIPE_SHADER_IR_NIR, sel->stage);
struct blob_reader blob_reader;
blob_reader_init(&blob_reader, sel->nir_binary, sel->nir_size);
@ -2347,7 +2346,7 @@ static struct nir_shader *si_get_nir_shader(struct si_shader *shader, struct si_
bool inline_uniforms = false;
uint32_t *inlined_uniform_values;
si_get_inline_uniform_state((union si_shader_key*)key, sel->pipe_shader_type,
si_get_inline_uniform_state((union si_shader_key*)key, sel->stage,
&inline_uniforms, &inlined_uniform_values);
if (inline_uniforms) {

View file

@ -620,7 +620,6 @@ struct si_shader_selector {
struct si_shader_info info;
enum pipe_shader_type pipe_shader_type;
uint8_t const_and_shader_buf_descriptors_index;
uint8_t sampler_and_images_descriptors_index;
uint8_t cs_shaderbufs_sgpr_index;

View file

@ -3605,12 +3605,10 @@ static void *si_create_shader_selector(struct pipe_context *ctx,
si_nir_scan_shader(sscreen, sel->nir, &sel->info);
sel->stage = sel->nir->info.stage;
const enum pipe_shader_type type = pipe_shader_type_from_mesa(sel->stage);
sel->pipe_shader_type = type;
sel->const_and_shader_buf_descriptors_index =
si_const_and_shader_buffer_descriptors_idx(type);
si_const_and_shader_buffer_descriptors_idx(sel->stage);
sel->sampler_and_images_descriptors_index =
si_sampler_and_image_descriptors_idx(type);
si_sampler_and_image_descriptors_idx(sel->stage);
if (si_can_dump_shader(sscreen, sel->stage, SI_DUMP_INIT_NIR))
nir_print_shader(sel->nir, stderr);
@ -4130,13 +4128,12 @@ static void si_destroy_shader_selector(struct pipe_context *ctx, void *cso)
{
struct si_context *sctx = (struct si_context *)ctx;
struct si_shader_selector *sel = (struct si_shader_selector *)cso;
enum pipe_shader_type type = pipe_shader_type_from_mesa(sel->stage);
util_queue_drop_job(&sctx->screen->shader_compiler_queue, &sel->ready);
if (sctx->shaders[type].cso == sel) {
sctx->shaders[type].cso = NULL;
sctx->shaders[type].current = NULL;
if (sctx->shaders[sel->stage].cso == sel) {
sctx->shaders[sel->stage].cso = NULL;
sctx->shaders[sel->stage].current = NULL;
}
for (unsigned i = 0; i < sel->variants_count; i++) {