summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/util/u_screen.c
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>2022-06-01 20:41:58 -0400
committerMarge Bot <emma+marge@anholt.net>2022-06-08 14:10:50 +0000
commite749f67f8989874f6795d95422c1f3eb4d2706ba (patch)
treed1620dcb4fafc62734a287be0fd03c1fafa1aafc /src/gallium/auxiliary/util/u_screen.c
parent10a2406232ef782790de01c24844adb0d573a6e4 (diff)
mesa,gallium: Make point coord origin a CAP
When lower_wpos_pntc is used, the state tracker inserts code to transform gl_PointCoord.y according to a uniform, to account for API-requested point coordinate origin and framebuffer orientation. With the transformation, driver-supplied point coordinates are expected to have an upper left origin. If the hardware point coordinate supports (only) a lower left origin, the backend has to use lower_wpos_pntc and then lower *again* to flip back. This ends up transforming twice, which is wasteful: a = load point coord Y with lower left origin a' = 1.0 - a a'' = uniform_transform(a') However, lower_wpos_pntc is quite capable of transforming for a lower left origin too, it just needs to flip the transformation. Add a CAP specifying the point coordinate origin convention, rather than assuming upper-left. This simplifies the Asahi code greatly. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16829>
Diffstat (limited to 'src/gallium/auxiliary/util/u_screen.c')
-rw-r--r--src/gallium/auxiliary/util/u_screen.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_screen.c b/src/gallium/auxiliary/util/u_screen.c
index daf6bb32fad..9dde62141ee 100644
--- a/src/gallium/auxiliary/util/u_screen.c
+++ b/src/gallium/auxiliary/util/u_screen.c
@@ -74,6 +74,11 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
case PIPE_CAP_FS_COORD_ORIGIN_LOWER_LEFT:
case PIPE_CAP_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
case PIPE_CAP_FS_COORD_PIXEL_CENTER_INTEGER:
+ return 0;
+
+ case PIPE_CAP_POINT_COORD_ORIGIN_UPPER_LEFT:
+ return 1;
+
case PIPE_CAP_DEPTH_CLIP_DISABLE:
case PIPE_CAP_DEPTH_CLIP_DISABLE_SEPARATE:
case PIPE_CAP_DEPTH_CLAMP_ENABLE: