nir: Add blend lowering pass
authorAlyssa Rosenzweig <alyssa@collabora.com>
Tue, 4 May 2021 18:11:12 +0000 (14:11 -0400)
committerMarge Bot <eric+marge@anholt.net>
Fri, 7 May 2021 17:25:21 +0000 (17:25 +0000)
commitf3de2bd6c2dd4c6b4bdbd63e7e5d47f326d2f494
tree06f5c833697d5235ae9095bcab1f8fbef6c1baac
parent0cde5ddc795523fb6b8e6c72e73a2436fb31be69
nir: Add blend lowering pass

This pass was originally developed for Panfrost, where it passes the
relevant dEQP tests. Upstreaming so it can be extended and then shared
with:

* Asahi, for blending
* Zink, for logic ops
* Lavapipe, for advanced blending

Note that using this with MRT in a fragment shader (as non-panfrost
drivers will) has not yet been tested. Logic ops with integer
framebuffers are probably todo. It's been enough for Panfrost, will
suffice for ES2 on Asahi, and provides an upstream base for kusma's work
on advanced blending, so overall the merge is a net benefit.

v2: Remove bogus assert that the format layout is PLAIN. We need to
render R11G11B10, which Mesa reports as layout OTHER. The code is still
correct.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> [v1]
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10601>
src/compiler/Makefile.sources
src/compiler/nir/meson.build
src/compiler/nir/nir_lower_blend.c [new file with mode: 0644]
src/compiler/nir/nir_lower_blend.h [new file with mode: 0644]