summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2019-10-14 09:58:57 -0700
committerKenneth Graunke <kenneth@whitecape.org>2019-10-15 15:44:16 -0700
commitd947276b4acc0b4ebb2745cbde82f7b2ccf11a4a (patch)
tree08c8b84290bb708228fe4c31024dc895ed014fa9
parent701e0ac077074e0534fa744ffa48872b8740fbf2 (diff)
mesa: Use ctx->ReadBuffer in glReadBuffer back-to-front tests
We were looking at ctx->DrawBuffer when asking about the read buffer, which was good enough for CTS purposes, but definitely not right. Reviewed-by: Eric Engestrom <eric.engestrom@intel.com> Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
-rw-r--r--src/mesa/main/buffers.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index a47438920b4..f6a347911c7 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -86,7 +86,8 @@ supported_buffer_bitmask(const struct gl_context *ctx,
}
static GLenum
-back_to_front_if_single_buffered(const struct gl_context *ctx, GLenum buffer)
+back_to_front_if_single_buffered(const struct gl_framebuffer *fb,
+ GLenum buffer)
{
/* If the front buffer is the only buffer, GL_BACK and all other flags
* that include BACK select the front buffer for drawing. There are
@@ -110,7 +111,7 @@ back_to_front_if_single_buffered(const struct gl_context *ctx, GLenum buffer)
* but they are front buffers from the Mesa point of view,
* because they are always single buffered.
*/
- if (!ctx->DrawBuffer->Visual.doubleBufferMode) {
+ if (!fb->Visual.doubleBufferMode) {
switch (buffer) {
case GL_BACK:
buffer = GL_FRONT;
@@ -135,7 +136,7 @@ back_to_front_if_single_buffered(const struct gl_context *ctx, GLenum buffer)
static GLbitfield
draw_buffer_enum_to_bitmask(const struct gl_context *ctx, GLenum buffer)
{
- buffer = back_to_front_if_single_buffered(ctx, buffer);
+ buffer = back_to_front_if_single_buffered(ctx->DrawBuffer, buffer);
switch (buffer) {
case GL_NONE:
@@ -200,7 +201,7 @@ draw_buffer_enum_to_bitmask(const struct gl_context *ctx, GLenum buffer)
static gl_buffer_index
read_buffer_enum_to_index(const struct gl_context *ctx, GLenum buffer)
{
- buffer = back_to_front_if_single_buffered(ctx, buffer);
+ buffer = back_to_front_if_single_buffered(ctx->ReadBuffer, buffer);
switch (buffer) {
case GL_FRONT: