Add GLES3 support for EXT_blend_func_extended
This adds GLES3 API support for EXT_blend_func_extended. The patch
includes the API entrypoints, validation and also implementation on
the desktop GL backend.
Instead of having built-in fragment color variables, ESSL 3.00 has
custom output variables, which can now be bound to either primary or
secondary output color locations. The "index" set to a custom output
variable determines whether it's used a primary or secondary blending
source color.
The shader layout qualifier takes precedence over the bind call. This
is not specified in the EXT spec, but is specified in desktop OpenGL
specs.
BUG=angleproject:1085
TEST=angle_end2end_tests
Change-Id: Ia24e8e5dadcc165e5e8fbd7c653c7fab6217db88
Reviewed-on: https://chromium-review.googlesource.com/c/1249361
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/Context.cpp b/src/libANGLE/Context.cpp
index 7335733..58742c0 100644
--- a/src/libANGLE/Context.cpp
+++ b/src/libANGLE/Context.cpp
@@ -3183,11 +3183,6 @@
{
// FIXME(geofflang): Don't support EXT_sRGB in non-ES2 contexts
// supportedExtensions.sRGB = false;
-
- // EXT_blend_func_extended is only implemented against GLES2 now
- // TODO(http://anglebug.com/1085): remove this limitation once GLES3 binding API for the
- // outputs is in place.
- supportedExtensions.blendFuncExtended = false;
}
// Some extensions are always available because they are implemented in the GL layer.
@@ -5800,6 +5795,36 @@
UNIMPLEMENTED();
}
+void Context::bindFragDataLocationIndexed(GLuint program,
+ GLuint colorNumber,
+ GLuint index,
+ const char *name)
+{
+ Program *programObject = getProgramNoResolveLink(program);
+ programObject->bindFragmentOutputLocation(colorNumber, name);
+ programObject->bindFragmentOutputIndex(index, name);
+}
+
+void Context::bindFragDataLocation(GLuint program, GLuint colorNumber, const char *name)
+{
+ bindFragDataLocationIndexed(program, colorNumber, 0u, name);
+}
+
+int Context::getFragDataIndex(GLuint program, const char *name)
+{
+ Program *programObject = getProgramResolveLink(program);
+ return programObject->getFragDataIndex(name);
+}
+
+int Context::getProgramResourceLocationIndex(GLuint program,
+ GLenum programInterface,
+ const char *name)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programInterface == GL_PROGRAM_OUTPUT);
+ return programObject->getFragDataIndex(name);
+}
+
void Context::shaderSource(GLuint shader,
GLsizei count,
const GLchar *const *string,