diff --git a/src/amd/common/nir/ac_nir_lower_ps_early.c b/src/amd/common/nir/ac_nir_lower_ps_early.c index ffd40c4ff6e..98b7eb38ff5 100644 --- a/src/amd/common/nir/ac_nir_lower_ps_early.c +++ b/src/amd/common/nir/ac_nir_lower_ps_early.c @@ -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; } diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 6ee6357dc19..a6e45ff317a 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -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);