mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-24 23:38:10 +02:00
nir: add nir_frag_coord_use_pixel_coord for OpenGL
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41461>
This commit is contained in:
parent
2d8d200c70
commit
63deaf3bfe
2 changed files with 17 additions and 1 deletions
|
|
@ -810,7 +810,17 @@ nir_build_frag_coord(nir_builder *b, unsigned num_components)
|
|||
assert(num_components && num_components <= 4);
|
||||
|
||||
if (b->shader->options->frag_coord_form & nir_frag_coord_xy_z_w_separate) {
|
||||
nir_def *xy = nir_load_frag_coord_xy(b);
|
||||
nir_def *xy;
|
||||
|
||||
if (b->shader->options->frag_coord_form &
|
||||
nir_frag_coord_use_pixel_coord) {
|
||||
xy = nir_u2f32(b, nir_load_pixel_coord(b));
|
||||
|
||||
if (!b->shader->info.fs.pixel_center_integer)
|
||||
xy = nir_fadd_imm(b, nir_u2f32(b, nir_load_pixel_coord(b)), 0.5);
|
||||
} else {
|
||||
xy = nir_load_frag_coord_xy(b);
|
||||
}
|
||||
|
||||
if (num_components <= 2)
|
||||
return nir_trim_vector(b, xy, num_components);
|
||||
|
|
|
|||
|
|
@ -251,6 +251,12 @@ typedef enum {
|
|||
|
||||
/* Use frag_coord_w_rcp instead of frag_coord_w. */
|
||||
nir_frag_coord_use_w_rcp = BITFIELD_BIT(1),
|
||||
|
||||
/* Use pixel_coord + (pixel_center_integer ? 0 : 0.5) instead of
|
||||
* frag_coord_xy. This is always correct for OpenGL without VRS because
|
||||
* even sample shading must have gl_FragCoord at pixel center.
|
||||
*/
|
||||
nir_frag_coord_use_pixel_coord = BITFIELD_BIT(2),
|
||||
} nir_frag_coord_form;
|
||||
|
||||
typedef struct nir_shader_compiler_options {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue