From 7ff4454b412ad054455552f5a29b56d9d6da2b64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sat, 9 May 2026 20:33:27 -0400 Subject: [PATCH] radeonsi: enable nir_frag_coord_use_pixel_coord no change in behavior other than getting pixel_coord from the beginning unconditionally Reviewed-by: Samuel Pitoiset Acked-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/drivers/radeonsi/gfx/si_gfx_screen.c | 3 ++- src/gallium/drivers/radeonsi/gfx/si_shader_info.c | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/radeonsi/gfx/si_gfx_screen.c b/src/gallium/drivers/radeonsi/gfx/si_gfx_screen.c index 19424bcdb34..8a4f9dcb883 100644 --- a/src/gallium/drivers/radeonsi/gfx/si_gfx_screen.c +++ b/src/gallium/drivers/radeonsi/gfx/si_gfx_screen.c @@ -340,7 +340,8 @@ static void si_init_screen_nir_options(struct si_screen *sscreen) sscreen->info.compiler_info.has_packed_math_16bit ? si_alu_to_scalar_packed_math_filter : NULL; options->max_unroll_iterations = 128; options->max_unroll_iterations_aggressive = 128; - options->frag_coord_form = nir_frag_coord_xy_z_w_separate | nir_frag_coord_use_w_rcp; + options->frag_coord_form = nir_frag_coord_xy_z_w_separate | nir_frag_coord_use_w_rcp | + nir_frag_coord_use_pixel_coord; /* For OpenGL, rounding mode is undefined. We want fast packing with v_cvt_pkrtz_f16, * but if we use it, all f32->f16 conversions have to round towards zero, * because both scalar and vec2 down-conversions have to round equally. diff --git a/src/gallium/drivers/radeonsi/gfx/si_shader_info.c b/src/gallium/drivers/radeonsi/gfx/si_shader_info.c index cf4ede9ca33..48a510e038f 100644 --- a/src/gallium/drivers/radeonsi/gfx/si_shader_info.c +++ b/src/gallium/drivers/radeonsi/gfx/si_shader_info.c @@ -637,6 +637,8 @@ void si_nir_gather_info(struct si_screen *sscreen, struct nir_shader *nir, } if (nir->info.stage == MESA_SHADER_FRAGMENT) { + assert(!BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_FRAG_COORD_XY)); + info->output_z_equals_input_z &= !info->output_z_is_not_input_z; info->allow_flat_shading = !(info->uses_sysval_persp_center || info->uses_sysval_persp_centroid || info->uses_sysval_persp_sample || info->uses_sysval_linear_center || @@ -647,6 +649,7 @@ void si_nir_gather_info(struct si_screen *sscreen, struct nir_shader *nir, BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_FRAG_COORD_XY) || BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_FRAG_COORD_Z) || BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_FRAG_COORD_W_RCP) || + BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_PIXEL_COORD) || BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_POINT_COORD) || BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_SAMPLE_ID) || BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_SAMPLE_POS) ||