blob: 5fd7497ee4a6ab32e7a5d7e57a0af67b16067de7 [file] [log] [blame]
From 0b90ffd534ff592b71190f4a6f779e32be4b534e Mon Sep 17 00:00:00 2001
From: Gurchetan Singh <gurchetansingh@chromium.org>
Date: Fri, 22 Apr 2016 10:29:56 -0700
Subject: [PATCH] CHROMIUM: mesa: Remove code that returns a desktop GL enum
When the draw_buffer_enum_to_bitmask function
is called while Mesa is in it's meta state,
the wrong GLbitfield is returned sometimes for
OpenGL ES contexts. This is because the
_mesa_meta_begin function makes the ctx->API always
equal to desktop GL during the meta state.
In the case of GL_BACK, the _mesa_is_gles(ctx)
function is checked when returning the enum.
This check evaluates to false during the meta state,
even on mobile devices.
BUG=b/27656575
TEST=Ran dEQP-GLES2.functional.clipping.line.line_attrib_clip
with the pbuffer option with on Cyan. Verified it
fails without the patch.
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
---
src/mesa/main/buffers.c | 39 ++++++++++++++++++---------------------
1 file changed, 18 insertions(+), 21 deletions(-)
diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index a28c583..36dbc8c 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -97,27 +97,24 @@ draw_buffer_enum_to_bitmask(const struct gl_context *ctx, GLenum buffer)
case GL_FRONT:
return BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_FRONT_RIGHT;
case GL_BACK:
- if (_mesa_is_gles(ctx)) {
- /* Page 181 (page 192 of the PDF) in section 4.2.1 of the OpenGL
- * ES 3.0.1 specification says:
- *
- * "When draw buffer zero is BACK, color values are written
- * into the sole buffer for single-buffered contexts, or into
- * the back buffer for double-buffered contexts."
- *
- * Since there is no stereo rendering in ES 3.0, only return the
- * LEFT bits. This also satisfies the "n must be 1" requirement.
- *
- * We also do this for GLES 1 and 2 because those APIs have no
- * concept of selecting the front and back buffer anyway and it's
- * convenient to be able to maintain the magic behaviour of
- * GL_BACK in that case.
- */
- if (ctx->DrawBuffer->Visual.doubleBufferMode)
- return BUFFER_BIT_BACK_LEFT;
- return BUFFER_BIT_FRONT_LEFT;
- }
- return BUFFER_BIT_BACK_LEFT | BUFFER_BIT_BACK_RIGHT;
+ /* Page 181 (page 192 of the PDF) in section 4.2.1 of the OpenGL
+ * ES 3.0.1 specification says:
+ *
+ * "When draw buffer zero is BACK, color values are written
+ * into the sole buffer for single-buffered contexts, or into
+ * the back buffer for double-buffered contexts."
+ *
+ * Since there is no stereo rendering in ES 3.0, only return the
+ * LEFT bits. This also satisfies the "n must be 1" requirement.
+ *
+ * We also do this for GLES 1 and 2 because those APIs have no
+ * concept of selecting the front and back buffer anyway and it's
+ * convenient to be able to maintain the magic behaviour of
+ * GL_BACK in that case.
+ */
+ if (ctx->DrawBuffer->Visual.doubleBufferMode)
+ return BUFFER_BIT_BACK_LEFT;
+ return BUFFER_BIT_FRONT_LEFT;
case GL_RIGHT:
return BUFFER_BIT_FRONT_RIGHT | BUFFER_BIT_BACK_RIGHT;
case GL_FRONT_RIGHT:
--
2.1.2