mesa,gallium: Make point coord origin a CAP
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Thu, 2 Jun 2022 00:41:58 +0000 (20:41 -0400)
committerMarge Bot <emma+marge@anholt.net>
Wed, 8 Jun 2022 14:10:50 +0000 (14:10 +0000)
commite749f67f8989874f6795d95422c1f3eb4d2706ba
treed1620dcb4fafc62734a287be0fd03c1fafa1aafc
parent10a2406232ef782790de01c24844adb0d573a6e4
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>
docs/gallium/screen.rst
src/gallium/auxiliary/util/u_screen.c
src/gallium/drivers/nouveau/nv50/nv50_screen.c
src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
src/gallium/include/pipe/p_defines.h
src/mesa/main/consts_exts.h
src/mesa/program/prog_statevars.c
src/mesa/state_tracker/st_context.c