diff options
author | Kenneth Graunke <[email protected]> | 2016-06-27 11:32:16 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2016-08-25 19:22:10 -0700 |
commit | 8ab50f5dd14fb720316e65d9553e7cad5c50bf87 (patch) | |
tree | 483403faaff53b705dcff9a5861460675783a9f6 /src/mesa | |
parent | e299661166a77c3cfc8a59c874bdb1e2179aa160 (diff) |
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 <[email protected]>
Reviewed-by: Francisco Jerez <[email protected]>
Diffstat (limited to 'src/mesa')
0 files changed, 0 insertions, 0 deletions