ac/nir: lower sample_pos in ac_nir_lower_ps_early

i.e. before future linking optimizations and shader_info gathering

The ac_nir_lower_ps_early call is also added for non-monolithic shaders
because it's required now.

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33024>
This commit is contained in:
Marek Olšák
2024-12-29 12:58:34 -05:00
parent 580304350b
commit b9b1f3a047
2 changed files with 15 additions and 0 deletions
@@ -331,6 +331,14 @@ lower_ps_intrinsic(nir_builder *b, nir_instr *instr, void *state)
return true;
}
break;
case nir_intrinsic_load_sample_pos:
/* Even though we could lower this by unpacking the sample position from user SGPRs, doing
* that hasn't shown any performance improvement in piglit/pixel-rate. Note that this is
* only used by sample shading.
*/
/* sample_pos = ffract(frag_coord.xy); */
nir_def_replace(&intrin->def, nir_ffract(b, nir_channels(b, nir_load_frag_coord(b), 0x3)));
return true;
default:
break;
}
+7
View File
@@ -2564,6 +2564,13 @@ static struct nir_shader *si_get_nir_shader(struct si_shader *shader, struct si_
NIR_PASS_V(nir, si_nir_emit_polygon_stipple, args);
progress = true;
} else if (nir->info.stage == MESA_SHADER_FRAGMENT) {
ac_nir_lower_ps_early_options early_options = {
.alpha_func = COMPARE_FUNC_ALWAYS,
.spi_shader_col_format_hint = ~0,
};
NIR_PASS_V(nir, ac_nir_lower_ps_early, &early_options);
progress = true;
}
assert(shader->wave_size == 32 || shader->wave_size == 64);