* Perform "lowering" operations on the NIR that are run once when the shader
* selector is created.
*/
-void si_lower_nir(struct si_shader_selector *sel)
+void si_lower_nir(struct si_screen *sscreen, struct nir_shader *nir)
{
/* Adjust the driver location of inputs and outputs. The state tracker
* interprets them as slots, while the ac/nir backend interprets them
* as individual components.
*/
- if (sel->nir->info.stage != MESA_SHADER_FRAGMENT) {
- nir_foreach_variable(variable, &sel->nir->inputs)
+ if (nir->info.stage != MESA_SHADER_FRAGMENT) {
+ nir_foreach_variable(variable, &nir->inputs)
variable->data.driver_location *= 4;
}
- nir_foreach_variable(variable, &sel->nir->outputs) {
+ nir_foreach_variable(variable, &nir->outputs) {
variable->data.driver_location *= 4;
- if (sel->nir->info.stage == MESA_SHADER_FRAGMENT) {
+ if (nir->info.stage == MESA_SHADER_FRAGMENT) {
if (variable->data.location == FRAG_RESULT_DEPTH)
variable->data.driver_location += 2;
else if (variable->data.location == FRAG_RESULT_STENCIL)
static const struct nir_lower_tex_options lower_tex_options = {
.lower_txp = ~0u,
};
- NIR_PASS_V(sel->nir, nir_lower_tex, &lower_tex_options);
+ NIR_PASS_V(nir, nir_lower_tex, &lower_tex_options);
const nir_lower_subgroups_options subgroups_options = {
.subgroup_size = 64,
.lower_vote_trivial = false,
.lower_vote_eq_to_ballot = true,
};
- NIR_PASS_V(sel->nir, nir_lower_subgroups, &subgroups_options);
+ NIR_PASS_V(nir, nir_lower_subgroups, &subgroups_options);
/* Lower load constants to scalar and then clean up the mess */
- NIR_PASS_V(sel->nir, nir_lower_load_const_to_scalar);
- NIR_PASS_V(sel->nir, nir_lower_var_copies);
- si_nir_opts(sel->nir);
+ NIR_PASS_V(nir, nir_lower_load_const_to_scalar);
+ NIR_PASS_V(nir, nir_lower_var_copies);
+ si_nir_opts(nir);
/* Lower large variables that are always constant with load_constant
* intrinsics, which get turned into PC-relative loads from a data
* section next to the shader.
*/
- NIR_PASS_V(sel->nir, nir_opt_large_constants,
+ NIR_PASS_V(nir, nir_opt_large_constants,
glsl_get_natural_size_align_bytes, 16);
- ac_lower_indirect_derefs(sel->nir, sel->screen->info.chip_class);
+ ac_lower_indirect_derefs(nir, sscreen->info.chip_class);
- si_nir_opts(sel->nir);
+ si_nir_opts(nir);
- NIR_PASS_V(sel->nir, nir_lower_bool_to_int32);
+ NIR_PASS_V(nir, nir_lower_bool_to_int32);
}
static void declare_nir_input_vs(struct si_shader_context *ctx,