st/mesa: fold st_translate_prog_to_nir into prog_to_nir

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32779>
This commit is contained in:
Marek Olšák
2024-12-24 12:00:32 -05:00
committed by Marge Bot
parent 49f737bc14
commit 3f7911e7d3
3 changed files with 7 additions and 24 deletions

View File

@@ -835,9 +835,10 @@ setup_registers_and_variables(struct ptn_compile *c)
}
struct nir_shader *
prog_to_nir(const struct gl_context *ctx, const struct gl_program *prog,
const nir_shader_compiler_options *options)
prog_to_nir(const struct gl_context *ctx, const struct gl_program *prog)
{
const struct nir_shader_compiler_options *options =
st_get_nir_compiler_options(ctx->st, prog->info.stage);
struct ptn_compile *c;
struct nir_shader *s;
gl_shader_stage stage = _mesa_program_enum_to_shader_stage(prog->Target);

View File

@@ -30,8 +30,8 @@
extern "C" {
#endif
struct nir_shader *prog_to_nir(const struct gl_context *ctx, const struct gl_program *prog,
const nir_shader_compiler_options *options);
struct nir_shader *prog_to_nir(const struct gl_context *ctx,
const struct gl_program *prog);
enum glsl_sampler_dim _mesa_texture_index_to_sampler_dim(gl_texture_index index,
bool *is_array);

View File

@@ -410,22 +410,6 @@ st_prog_to_nir_postprocess(struct st_context *st, nir_shader *nir,
nir_validate_shader(nir, "after st/glsl finalize_nir");
}
/**
* Translate ARB (asm) program to NIR
*/
static nir_shader *
st_translate_prog_to_nir(struct st_context *st, struct gl_program *prog,
gl_shader_stage stage)
{
const struct nir_shader_compiler_options *options =
st_get_nir_compiler_options(st, prog->info.stage);
/* Translate to NIR */
nir_shader *nir = prog_to_nir(st->ctx, prog, options);
return nir;
}
/**
* Prepare st_vertex_program info.
*
@@ -616,8 +600,7 @@ st_translate_vertex_program(struct st_context *st,
prog->state.type = PIPE_SHADER_IR_NIR;
if (prog->arb.Instructions)
prog->nir = st_translate_prog_to_nir(st, prog,
MESA_SHADER_VERTEX);
prog->nir = prog_to_nir(st->ctx, prog);
st_prog_to_nir_postprocess(st, prog->nir, prog);
prog->info = prog->nir->info;
@@ -1021,8 +1004,7 @@ st_translate_fragment_program(struct st_context *st,
prog->state.type = PIPE_SHADER_IR_NIR;
if (prog->arb.Instructions) {
prog->nir = st_translate_prog_to_nir(st, prog,
MESA_SHADER_FRAGMENT);
prog->nir = prog_to_nir(st->ctx, prog);
} else if (prog->ati_fs) {
const struct nir_shader_compiler_options *options =
st_get_nir_compiler_options(st, MESA_SHADER_FRAGMENT);