if (prog->nir)
return prog->nir;
- return glsl_to_nir(shader_program, stage, options);
+ nir_shader *nir = glsl_to_nir(shader_program, stage, options);
+
+ st_nir_opts(nir);
+
+ return nir;
}
/* Second third of converting glsl_to_nir. This creates uniforms, gathers
*/
_mesa_associate_uniform_storage(st->ctx, shader_program, prog, true);
- NIR_PASS_V(nir, nir_lower_io_to_temporaries,
- nir_shader_get_entrypoint(nir),
- true, true);
- NIR_PASS_V(nir, nir_lower_global_vars_to_local);
- NIR_PASS_V(nir, nir_split_var_copies);
- NIR_PASS_V(nir, nir_lower_var_copies);
-
/* fragment shaders may need : */
if (prog->info.stage == MESA_SHADER_FRAGMENT) {
static const gl_state_index wposTransformState[STATE_LENGTH] = {
set_st_program(prog, shader_program, nir);
prog->nir = nir;
+
+ NIR_PASS_V(nir, nir_lower_io_to_temporaries,
+ nir_shader_get_entrypoint(nir),
+ true, true);
+ NIR_PASS_V(nir, nir_lower_global_vars_to_local);
+ NIR_PASS_V(nir, nir_split_var_copies);
+ NIR_PASS_V(nir, nir_lower_var_copies);
}
extern "C" {