}
}
-static void
-set_st_program(struct gl_program *prog,
- struct gl_shader_program *shader_program,
- nir_shader *nir)
-{
- struct st_program *stp = (struct st_program *)prog;
-
- stp->shader_program = shader_program;
- stp->state.type = PIPE_SHADER_IR_NIR;
- stp->state.ir.nir = nir;
-}
-
static void
st_nir_vectorize_io(nir_shader *producer, nir_shader *consumer)
{
const nir_shader_compiler_options *options =
st->ctx->Const.ShaderCompilerOptions[shader->Stage].NirOptions;
struct gl_program *prog = shader->Program;
+ struct st_program *stp = (struct st_program *)prog;
+
_mesa_copy_linked_program_data(shader_program, shader);
assert(!prog->nir);
+ stp->shader_program = shader_program;
+ stp->state.type = PIPE_SHADER_IR_NIR;
if (shader_program->data->spirv) {
prog->Parameters = _mesa_new_parameter_list();
/* Parameters will be filled during NIR linking. */
prog->nir = _mesa_spirv_to_nir(ctx, shader_program, shader->Stage, options);
- set_st_program(prog, shader_program, prog->nir);
} else {
validate_ir_tree(shader->ir);
_mesa_update_shader_textures_used(shader_program, prog);
prog->nir = glsl_to_nir(st->ctx, shader_program, shader->Stage, options);
- set_st_program(prog, shader_program, prog->nir);
st_nir_preprocess(st, prog, shader_program, shader->Stage);
}
nir_shader *nir =
st_translate_prog_to_nir(st, &stp->Base, MESA_SHADER_VERTEX);
- if (stp->state.ir.nir)
- ralloc_free(stp->state.ir.nir);
+ if (stp->Base.nir)
+ ralloc_free(stp->Base.nir);
stp->state.type = PIPE_SHADER_IR_NIR;
- stp->state.ir.nir = nir;
stp->Base.nir = nir;
return true;
}
bool finalize = false;
state.type = PIPE_SHADER_IR_NIR;
- state.ir.nir = nir_shader_clone(NULL, stvp->state.ir.nir);
+ state.ir.nir = nir_shader_clone(NULL, stvp->Base.nir);
if (key->clamp_color) {
NIR_PASS_V(state.ir.nir, nir_lower_clamp_color_outputs);
finalize = true;
nir_shader *nir =
st_translate_prog_to_nir(st, &stfp->Base, MESA_SHADER_FRAGMENT);
- if (stfp->state.ir.nir)
- ralloc_free(stfp->state.ir.nir);
+ if (stfp->Base.nir)
+ ralloc_free(stfp->Base.nir);
stfp->state.type = PIPE_SHADER_IR_NIR;
- stfp->state.ir.nir = nir;
stfp->Base.nir = nir;
return true;
}
bool finalize = false;
state.type = PIPE_SHADER_IR_NIR;
- state.ir.nir = nir_shader_clone(NULL, stfp->state.ir.nir);
+ state.ir.nir = nir_shader_clone(NULL, stfp->Base.nir);
if (key->clamp_color) {
NIR_PASS_V(state.ir.nir, nir_lower_clamp_color_outputs);
bool finalize = false;
state.type = PIPE_SHADER_IR_NIR;
- state.ir.nir = nir_shader_clone(NULL, prog->state.ir.nir);
+ state.ir.nir = nir_shader_clone(NULL, prog->Base.nir);
if (key->clamp_color) {
NIR_PASS_V(state.ir.nir, nir_lower_clamp_color_outputs);
if (nir) {
stp->state.type = PIPE_SHADER_IR_NIR;
- stp->state.ir.nir = nir_deserialize(NULL, options, &blob_reader);
stp->shader_program = shProg;
- prog->nir = stp->state.ir.nir;
+ prog->nir = nir_deserialize(NULL, options, &blob_reader);
} else {
read_tgsi_from_cache(&blob_reader, &stp->state.tokens);
}