ce716d009f
This is based on Timur Kristof's code, but there are a lot of differences. The idea is that it doesn't just compute an intersection between a point and a triangle. It computes the *distance* between a point and a triangle and it does so in screen space. It accurately takes the subpixel precision of the rasterizer into account, so that it works optimally at all resolutions, all MSAA modes, and all quant modes. The distance computation is only approximated because it only considers the infinite lines going through triangle edges. However, it seems to be more than sufficient in practice because the existing rounding-based small prim culling compensates for it. The performance improvement is up to 10% in some geometry-bound tests, though targeted microbenchmarks can show a lot more than that. Reviewed-by: Timur Kristóf <timur.kristof@gmail.com> Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33361>