Make sure the default framebuffer has enough draw buffer states.
Querying the draw buffer states of the default framebuffer would lead to
crashes because it only had one state. The spec says that all non-zero
attachments default to GL_NONE and makes no mention of special cased
errors for querying the default framebuffer.
Also fix the validation to check for extensions and ES version when
querying draw buffer state.
BUG=703508
Change-Id: I7db5443141c65a3f9c638f07ba90f78d76e4e7b4
Reviewed-on: https://chromium-review.googlesource.com/457524
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/ContextState.cpp b/src/libANGLE/ContextState.cpp
index 5399a76..fa4f3d9 100644
--- a/src/libANGLE/ContextState.cpp
+++ b/src/libANGLE/ContextState.cpp
@@ -133,13 +133,6 @@
bool ValidationContext::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *numParams)
{
- if (pname >= GL_DRAW_BUFFER0_EXT && pname <= GL_DRAW_BUFFER15_EXT)
- {
- *type = GL_INT;
- *numParams = 1;
- return true;
- }
-
// Please note: the query type returned for DEPTH_CLEAR_VALUE in this implementation
// is FLOAT rather than INT, as would be suggested by the GL ES 2.0 spec. This is due
// to the fact that it is stored internally as a float, and so would require conversion
@@ -495,6 +488,17 @@
}
}
+ if (pname >= GL_DRAW_BUFFER0_EXT && pname <= GL_DRAW_BUFFER15_EXT)
+ {
+ if ((getClientVersion() < Version(3, 0)) && !getExtensions().drawBuffers)
+ {
+ return false;
+ }
+ *type = GL_INT;
+ *numParams = 1;
+ return true;
+ }
+
if (getClientVersion() < Version(3, 0))
{
return false;