nir/compiler_options: add nir_load_pixel_coord

And use it for nir_printf_fmt_at_px().

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38996>
This commit is contained in:
Lionel Landwerlin 2026-01-15 12:57:13 +02:00 committed by Marge Bot
parent 063d480a62
commit 12be2a580c
2 changed files with 8 additions and 2 deletions

View file

@ -311,8 +311,11 @@ void nir_printf_fmt_at_px(nir_builder *b, unsigned ptr_bit_size, unsigned x_px,
{
va_list ap;
nir_def *xy_px = nir_f2u32(b,nir_load_frag_coord(b));
nir_def *is_at_px = nir_ball_iequal(b, nir_imm_ivec2(b, x_px, y_px), xy_px);
nir_def *xy_px = b->shader->options->has_pixel_coord ?
nir_load_pixel_coord(b) : nir_f2u32(b, nir_load_frag_coord(b));
nir_def *is_at_px = b->shader->options->has_pixel_coord ?
nir_ball_iequal(b, nir_imm_uvec2_intN(b, x_px, y_px, 16), xy_px) :
nir_ball_iequal(b, nir_imm_ivec2(b, x_px, y_px), xy_px);
nir_push_if(b, is_at_px);
va_start(ap, fmt);

View file

@ -612,6 +612,9 @@ typedef struct nir_shader_compiler_options {
/** Backend supports pack_32_4x8 or pack_32_4x8_split. */
bool has_pack_32_4x8;
/** Backend supports nir_load_pixel_coord */
bool has_pixel_coord;
/** Backend supports nir_load_texture_scale and prefers it over txs for nir
* lowerings. */
bool has_texture_scaling;