v3d: add lowering for OpenGL logic operations
authorIago Toral Quiroga <itoral@igalia.com>
Wed, 3 Jul 2019 07:38:39 +0000 (09:38 +0200)
committerIago Toral Quiroga <itoral@igalia.com>
Fri, 12 Jul 2019 07:16:38 +0000 (09:16 +0200)
commite540775f0cb189ca81565815968323edc935cc74
treeeaa01f6468102fa1af9711601d75c9dd7f7899b3
parent7c1d70891150c9960b1bb2464b53a95f4645037c
v3d: add lowering for OpenGL logic operations

This implements support for OpenGL logic operations by emitting code to read
from the TLB if needed and blending the fragment output accordingly. It is
similar to VC4's blend lowering pass, but exclusive to logic operations, since
blending is otherwise supported in hardware.

The pass doesn't handle MSAA targets yet.

Fixes the following piglit tests:
spec/!opengl 1.0/gl-1.0-logicop/*
spec/!opengl 1.1/gl-1.1-xor
spec/!opengl 1.1/gl-1.1-xor-copypixels

It also fixes text cursor rendering in Libreoffice with the GTK+2 theme, which
is rendered via glamor using the XOR logic operation.

v2: fix checks for allowed variable location and maximum render target (Eric)

Reviewed-by: Eric Anholt <eric@anholt.net>
src/broadcom/compiler/meson.build
src/broadcom/compiler/v3d_compiler.h
src/broadcom/compiler/v3d_nir_lower_logic_ops.c [new file with mode: 0644]
src/broadcom/compiler/vir.c