summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2012-12-18 13:26:04 -0800
committerIan Romanick <[email protected]>2013-01-15 15:04:50 -0800
commitf727fc630462c91f19a59e8b48e3a4224dd0ec52 (patch)
tree5a212e8a4f2f3b65da3a4f52a7aaae479b2cbff4 /src/mesa
parentfd3891cbbe8f11c297edf0a6bf0580f69024722e (diff)
mesa: Make ES3 glDrawBuffers() only accept BACK/NONE for the winsys fbo.
Nothing was explicitly checking this. v2: Update GL3 spec reference. Signed-off-by: Anuj Phogat <[email protected]> Signed-off-by: Kenneth Graunke <[email protected]> Signed-off-by: Ian Romanick <[email protected]> [v2] Reviewed-by: Anuj Phogat <[email protected]> Reviewed-by: Ian Romanick <[email protected]> [v1]
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/buffers.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index b4f324c6c91..87848fb9379 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -318,17 +318,29 @@ _mesa_DrawBuffers(GLsizei n, const GLenum *buffers)
supportedMask = supported_buffer_bitmask(ctx, ctx->DrawBuffer);
usedBufferMask = 0x0;
+ /* From the ES 3.0 specification, page 180:
+ * "If the GL is bound to the default framebuffer, then n must be 1
+ * and the constant must be BACK or NONE."
+ */
+ if (_mesa_is_gles3(ctx) && _mesa_is_winsys_fbo(ctx->DrawBuffer) &&
+ (n != 1 || (buffers[0] != GL_NONE && buffers[0] != GL_BACK))) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawBuffers(buffer)");
+ return;
+ }
+
/* complicated error checking... */
for (output = 0; output < n; output++) {
if (buffers[output] == GL_NONE) {
destMask[output] = 0x0;
}
else {
- /* From the OpenGL 3.0 specification, page 258:
- * "If the GL is bound to a framebuffer object and DrawBuffers is
- * supplied with [...] COLOR_ATTACHMENTm where m is greater than or
- * equal to the value of MAX_COLOR_ATTACHMENTS, then the error
- * INVALID_OPERATION results."
+ /* Page 259 (page 275 of the PDF) in section 4.2.1 of the OpenGL 3.0
+ * spec (20080923) says:
+ *
+ * "If the GL is bound to a framebuffer object and DrawBuffers is
+ * supplied with [...] COLOR_ATTACHMENTm where m is greater than
+ * or equal to the value of MAX_COLOR_ATTACHMENTS, then the error
+ * INVALID_OPERATION results."
*/
if (_mesa_is_user_fbo(ctx->DrawBuffer) && buffers[output] >=
GL_COLOR_ATTACHMENT0 + ctx->Const.MaxDrawBuffers) {