* variant lowering.
*/
void
-st_finalize_nir(struct st_context *st, struct gl_program *prog, nir_shader *nir)
+st_finalize_nir(struct st_context *st, struct gl_program *prog,
+ struct gl_shader_program *shader_program, nir_shader *nir)
{
struct pipe_screen *screen = st->pipe->screen;
unreachable("invalid shader type for tgsi bypass\n");
}
- struct gl_shader_program *shader_program;
- switch (nir->info.stage) {
- case MESA_SHADER_VERTEX:
- shader_program = ((struct st_vertex_program *)prog)->shader_program;
- break;
- case MESA_SHADER_GEOMETRY:
- case MESA_SHADER_TESS_CTRL:
- case MESA_SHADER_TESS_EVAL:
- shader_program = ((struct st_common_program *)prog)->shader_program;
- break;
- case MESA_SHADER_FRAGMENT:
- shader_program = ((struct st_fragment_program *)prog)->shader_program;
- break;
- case MESA_SHADER_COMPUTE:
- shader_program = ((struct st_compute_program *)prog)->shader_program;
- break;
- default:
- assert(!"should not be reached");
- return;
- }
-
NIR_PASS_V(nir, nir_lower_atomics_to_ssbo,
st->ctx->Const.Program[nir->info.stage].MaxAtomicBuffers);
struct gl_shader_program *shader_program,
gl_shader_stage stage);
-void st_finalize_nir(struct st_context *st, struct gl_program *prog, struct nir_shader *nir);
+void st_finalize_nir(struct st_context *st, struct gl_program *prog,
+ struct gl_shader_program *shader_program,
+ struct nir_shader *nir);
struct gl_program *
st_nir_get_mesa_program(struct gl_context *ctx,
vpv->num_inputs++;
}
- st_finalize_nir(st, &stvp->Base, vpv->tgsi.ir.nir);
+ st_finalize_nir(st, &stvp->Base, stvp->shader_program,
+ vpv->tgsi.ir.nir);
vpv->driver_shader = pipe->create_vs_state(pipe, &vpv->tgsi);
/* driver takes ownership of IR: */
NIR_PASS_V(tgsi.ir.nir, nir_lower_tex, &options);
}
- st_finalize_nir(st, &stfp->Base, tgsi.ir.nir);
+ st_finalize_nir(st, &stfp->Base, stfp->shader_program, tgsi.ir.nir);
if (unlikely(key->external.lower_nv12 || key->external.lower_iyuv)) {
/* This pass needs to happen *after* nir_lower_sampler */
if (prog->tgsi.type == PIPE_SHADER_IR_NIR) {
tgsi.type = PIPE_SHADER_IR_NIR;
tgsi.ir.nir = nir_shader_clone(NULL, prog->tgsi.ir.nir);
- st_finalize_nir(st, &prog->Base, tgsi.ir.nir);
+ st_finalize_nir(st, &prog->Base, prog->shader_program,
+ tgsi.ir.nir);
} else
tgsi = prog->tgsi;
/* fill in new variant */
MESA_SHADER_COMPUTE);
/* no compute variants: */
- st_finalize_nir(st, &stcp->Base, nir);
+ st_finalize_nir(st, &stcp->Base, stcp->shader_program, nir);
stcp->tgsi.ir_type = PIPE_SHADER_IR_NIR;
stcp->tgsi.prog = nir;