diff options
author | Kenneth Graunke <[email protected]> | 2016-05-18 11:38:32 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2016-05-20 14:30:00 -0700 |
commit | 6e5d86c07af920fa52afbe075a04116b9ebb3cc3 (patch) | |
tree | 2411eaeef7535a69548fe88ee9464ea4fbb4c455 /src/compiler/nir/nir.h | |
parent | 12ab7fc6ac1ca785afb1126607bb95ea26473e06 (diff) |
nir: Add a simple nir_lower_wpos_center() pass for Vulkan drivers.
nir_lower_wpos_ytransform() is great for OpenGL, which allows
applications to choose whether their coordinate system's origin is
upper left/lower left, and whether the pixel center should be on
integer/half-integer boundaries.
Vulkan, however, has much simpler requirements: the pixel center
is always half-integer, and the origin is always upper left. No
coordinate transform is needed - we just need to add <0.5, 0.5>.
This means that we can avoid using (and setting up) a uniform.
I thought about adding more options to nir_lower_wpos_ytransform(),
but making a new pass that never even touched uniforms seemed simpler.
v2: Use normal iterator rather than _safe variant (noticed by Matt).
Signed-off-by: Kenneth Graunke <[email protected]>
Acked-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir.h')
-rw-r--r-- | src/compiler/nir/nir.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index a21a7bdc6fa..78913d30deb 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -2407,6 +2407,7 @@ typedef struct nir_lower_wpos_ytransform_options { bool nir_lower_wpos_ytransform(nir_shader *shader, const nir_lower_wpos_ytransform_options *options); +bool nir_lower_wpos_center(nir_shader *shader); typedef struct nir_lower_drawpixels_options { int texcoord_state_tokens[5]; |