mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 22:49:13 +02:00
nir: Add pixel_coord, frag_coord_zw intrinsics
On some architectures, gl_FragCoord.xy is available as an integer but gl_FragCoord.zw requires interpolation. Add dedicated intrinsics so we can lower it all in NIR. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23836>
This commit is contained in:
parent
137e8d1cc4
commit
c7067660b2
2 changed files with 8 additions and 0 deletions
|
|
@ -496,6 +496,8 @@ visit_intrinsic(nir_shader *shader, nir_intrinsic_instr *instr)
|
|||
case nir_intrinsic_load_point_coord:
|
||||
case nir_intrinsic_load_line_coord:
|
||||
case nir_intrinsic_load_frag_coord:
|
||||
case nir_intrinsic_load_frag_coord_zw:
|
||||
case nir_intrinsic_load_pixel_coord:
|
||||
case nir_intrinsic_load_fully_covered:
|
||||
case nir_intrinsic_load_sample_pos:
|
||||
case nir_intrinsic_load_sample_pos_or_center:
|
||||
|
|
|
|||
|
|
@ -762,6 +762,12 @@ def system_value(name, dest_comp, indices=[], bit_sizes=[32]):
|
|||
bit_sizes=bit_sizes)
|
||||
|
||||
system_value("frag_coord", 4)
|
||||
# 16-bit integer vec2 of the pixel X/Y in the framebuffer.
|
||||
system_value("pixel_coord", 2, bit_sizes=[16])
|
||||
# Scalar load of frag_coord Z/W components (component=2 for Z, component=3 for
|
||||
# W). Backends can lower frag_coord to pixel_coord + frag_coord_zw, in case
|
||||
# X/Y is available as an integer but Z/W requires interpolation.
|
||||
system_value("frag_coord_zw", 1, indices=[COMPONENT])
|
||||
system_value("point_coord", 2)
|
||||
system_value("line_coord", 1)
|
||||
system_value("front_face", 1, bit_sizes=[1, 32])
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue