mesa/src/compiler
Kenneth Graunke 8ab50f5dd1 glsl: Add a lowering pass to handle advanced blending modes.
Many GPUs cannot handle GL_KHR_blend_equation_advanced natively, and
need to emulate it in the pixel shader.  This lowering pass implements
all the necessary math for advanced blending.  It fetches the existing
framebuffer value using the MESA_shader_framebuffer_fetch built-in
variables, and the previous commit's state var uniform to select
which equation to use.

This is done at the GLSL IR level to make it easy for all drivers to
implement the GL_KHR_blend_equation_advanced extension and share code.

Drivers need to hook up MESA_shader_framebuffer_fetch functionality:
1. Hook up the fb_fetch_output variable
2. Implement BlendBarrier()

Then to get KHR_blend_equation_advanced, they simply need to:
3. Disable hardware blending based on ctx->Color._AdvancedBlendEnabled
4. Call this lowering pass.

Very little driver specific code should be required.

v2: Handle multiple output variables per render target (which may exist
    due to ARB_enhanced_layouts), and array variables (even with one
    render target, we might have out vec4 color[1]), and non-vec4
    variables (it's easier than finding spec text to justify not
    handling it).  Thanks to Francisco Jerez for the feedback.
v3: Lower main returns so that we have a single exit point where we
    can add our blending epilogue (caught by Francisco Jerez).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
2016-08-25 19:22:10 -07:00
..
glsl glsl: Add a lowering pass to handle advanced blending modes. 2016-08-25 19:22:10 -07:00
nir nir: Change nir_shader_get_entrypoint to return an impl. 2016-08-25 19:18:24 -07:00
spirv spirv/nir: Add support for ImageQuerySamples 2016-07-22 16:48:54 -07:00
.gitignore mesa: Add .gitignore entries for make check binaries 2016-05-25 09:41:44 -07:00
Android.glsl.gen.mk glsl: Make the generated sources build rules more like NIR 2016-08-17 13:48:25 +01:00
Android.glsl.mk android: libmesa_glsl: add a dependency on libmesa_nir static 2016-06-02 22:31:00 +01:00
Android.mk compiler: android: flesh out nir into separate makefile 2016-04-11 19:08:23 +01:00
Android.nir.gen.mk compiler: android: flesh out nir into separate makefile 2016-04-11 19:08:23 +01:00
Android.nir.mk compiler: android: flesh out nir into separate makefile 2016-04-11 19:08:23 +01:00
builtin_type_macros.h glsl/types: Add a bare "sampler" type 2016-02-13 17:22:36 -08:00
glsl_types.cpp glsl/types: disallow implicit conversions before GLSL 1.20 2016-08-05 14:27:03 +03:00
glsl_types.h glsl: Document and enforce restriction on type values 2016-07-05 17:55:29 -07:00
Makefile.am compiler: Move glsl_to_nir to libglsl.la 2016-05-26 14:13:38 -07:00
Makefile.glsl.am glsl: Make the generated sources build rules more like NIR 2016-08-17 13:48:25 +01:00
Makefile.nir.am nir: add the SConscript.nir to the tarball 2016-05-30 19:19:01 +01:00
Makefile.sources glsl: Add a lowering pass to handle advanced blending modes. 2016-08-25 19:22:10 -07:00
nir_types.cpp nir: add glsl_dvec_type() helper 2016-07-06 23:20:23 -07:00
nir_types.h nir: add glsl_dvec_type() helper 2016-07-06 23:20:23 -07:00
SConscript scons: Build NIR. 2016-04-14 16:38:59 +01:00
SConscript.glsl glsl: reuse main extension table to appropriately restrict extensions 2016-07-23 13:48:04 -04:00
SConscript.nir scons: Build NIR. 2016-04-14 16:38:59 +01:00
shader_enums.c compiler: Rename INTERP_QUALIFIER_* to INTERP_MODE_*. 2016-07-17 19:26:48 -07:00
shader_enums.h glsl: process blend_support_* qualifiers 2016-08-25 19:22:09 -07:00