mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 11:38:05 +02:00
nir/opt_frag_coord_to_pixel_coord: handle frag_coord_xy
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com> Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Reviewed-by: Emma Anholt <emma@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41227>
This commit is contained in:
parent
076b0aaf1d
commit
9c5ad16819
1 changed files with 15 additions and 10 deletions
|
|
@ -15,7 +15,8 @@
|
|||
static bool
|
||||
opt_frag_pos(nir_builder *b, nir_intrinsic_instr *intr, UNUSED void *data)
|
||||
{
|
||||
if (intr->intrinsic != nir_intrinsic_load_frag_coord)
|
||||
if (intr->intrinsic != nir_intrinsic_load_frag_coord &&
|
||||
intr->intrinsic != nir_intrinsic_load_frag_coord_xy)
|
||||
return false;
|
||||
|
||||
/* Don't increase precision. */
|
||||
|
|
@ -27,14 +28,16 @@ opt_frag_pos(nir_builder *b, nir_intrinsic_instr *intr, UNUSED void *data)
|
|||
if (nir_src_is_if(use))
|
||||
return false;
|
||||
|
||||
unsigned mask = nir_src_components_read(use);
|
||||
if (intr->intrinsic == nir_intrinsic_load_frag_coord) {
|
||||
unsigned mask = nir_src_components_read(use);
|
||||
|
||||
if (!(mask & 0x3))
|
||||
continue;
|
||||
if (!(mask & 0x3))
|
||||
continue;
|
||||
|
||||
/* Don't handle instructions that read x/y and z/w for simplicity. */
|
||||
if (mask & ~0x3)
|
||||
return false;
|
||||
/* Don't handle instructions that read x/y and z/w for simplicity. */
|
||||
if (mask & ~0x3)
|
||||
return false;
|
||||
}
|
||||
|
||||
nir_instr *use_instr = nir_src_parent_instr(use);
|
||||
|
||||
|
|
@ -62,10 +65,12 @@ opt_frag_pos(nir_builder *b, nir_intrinsic_instr *intr, UNUSED void *data)
|
|||
nir_def *pixel_coord = nir_load_pixel_coord(b);
|
||||
|
||||
nir_foreach_use_safe(use, &intr->def) {
|
||||
unsigned mask = nir_src_components_read(use);
|
||||
if (intr->intrinsic == nir_intrinsic_load_frag_coord) {
|
||||
unsigned mask = nir_src_components_read(use);
|
||||
|
||||
if (!(mask & 0x3))
|
||||
continue;
|
||||
if (!(mask & 0x3))
|
||||
continue;
|
||||
}
|
||||
|
||||
nir_src_rewrite(use, pixel_coord);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue