summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/buffers.c
diff options
context:
space:
mode:
authorGurchetan Singh <[email protected]>2016-06-30 15:20:34 -0700
committerChad Versace <[email protected]>2016-07-07 11:02:35 -0700
commit2e6d35809bf4ef60af62f9c84d394e97d5bbe2a7 (patch)
tree87b7d5e0f658370aa9466ed7323b1c77e46885b8 /src/mesa/main/buffers.c
parentf35f8464ecf35de769629d316db620472a92f995 (diff)
mesa: Make single-buffered GLES representation internally consistent
There are a few places in the code where clearing and reading are done on incorrect buffers for GLES contexts. See comments for details. This fixes 75 GLES3 dEQP tests on the surfaceless platform with no regressions. v2: Corrected unclear comment v3: Make the change in context.c instead of get.c v4: Removed whitespace Reviewed-by: Stéphane Marchesin <[email protected]> Reviewed-by: Chad Versace <[email protected]>
Diffstat (limited to 'src/mesa/main/buffers.c')
-rw-r--r--src/mesa/main/buffers.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index e8aedde8777..86696b80c87 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -173,12 +173,22 @@ draw_buffer_enum_to_bitmask(const struct gl_context *ctx, GLenum buffer)
* return -1 for an invalid buffer.
*/
static gl_buffer_index
-read_buffer_enum_to_index(GLenum buffer)
+read_buffer_enum_to_index(const struct gl_context *ctx, GLenum buffer)
{
switch (buffer) {
case GL_FRONT:
return BUFFER_FRONT_LEFT;
case GL_BACK:
+ if (_mesa_is_gles(ctx)) {
+ /* In draw_buffer_enum_to_bitmask, when GLES contexts draw to
+ * GL_BACK with a single-buffered configuration, we actually end
+ * up drawing to the sole front buffer in our internal
+ * representation. For consistency, we must read from that
+ * front left buffer too.
+ */
+ if (!ctx->DrawBuffer->Visual.doubleBufferMode)
+ return BUFFER_FRONT_LEFT;
+ }
return BUFFER_BACK_LEFT;
case GL_RIGHT:
return BUFFER_FRONT_RIGHT;
@@ -724,7 +734,7 @@ read_buffer(struct gl_context *ctx, struct gl_framebuffer *fb,
if (_mesa_is_gles3(ctx) && !is_legal_es3_readbuffer_enum(buffer))
srcBuffer = -1;
else
- srcBuffer = read_buffer_enum_to_index(buffer);
+ srcBuffer = read_buffer_enum_to_index(ctx, buffer);
if (srcBuffer == -1) {
_mesa_error(ctx, GL_INVALID_ENUM,