Implement support for dual source blending in ES
Use EXT_blend_func_extended to implement dual source blending in OpenGL
ES. The extension is the ES version of ARB_blend_func_extended.
The extension provides gl_SecondaryFragColorEXT for ES 2.0 contexts.
The extension provides glBindFragDataLocationIndexed to bind a custom
fragment shader output to the secondary color for ES 3.0 contexts.
For ES 3.1 contexts, the extension would also give
"layout (location=0, index=1)" output varible layout modifier syntax,
but it is not used in this patch.
The extension needs #extension GL_EXT_blend_func_extended : require
directive for the variables to be available in ES 2.0. For ES 3.0, the
directive relaxes the rules for the amount of output variables without
layout location qualifiers.
OpenGL continues to use GL_ARB_blend_func_extended for dual source
blending.
Review URL: https://codereview.chromium.org/1266773003
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index a064b6a..2b19f13 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -294,8 +294,14 @@
fMultisampleDisableSupport = ctxInfo.hasExtension("GL_EXT_multisample_compatibility");
}
- if (kGL_GrGLStandard == standard && version >= GR_GL_VER(3, 0)) {
- fBindFragDataLocationSupport = true;
+ if (kGL_GrGLStandard == standard) {
+ if (version >= GR_GL_VER(3, 0)) {
+ fBindFragDataLocationSupport = true;
+ }
+ } else {
+ if (version >= GR_GL_VER(3, 0) && ctxInfo.hasExtension("GL_EXT_blend_func_extended")) {
+ fBindFragDataLocationSupport = true;
+ }
}
/**************************************************************************
@@ -318,6 +324,8 @@
ctxInfo.glslGeneration() >= k150_GrGLSLGeneration;
}
else {
+ glslCaps->fDualSourceBlendingSupport = ctxInfo.hasExtension("GL_EXT_blend_func_extended");
+
glslCaps->fShaderDerivativeSupport = ctxInfo.version() >= GR_GL_VER(3, 0) ||
ctxInfo.hasExtension("GL_OES_standard_derivatives");
}