Skip to content

mesa,gallium: Make point coord origin a CAP

Alyssa Rosenzweig requested to merge asahi/mesa:mesa/point-coord-origin into main

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

Merge request reports