[Mesa-dev] [PATCH] mesa: fix glGetFramebufferAttachmentParameteriv w/ on-demand FRONT_BACK alloc
Marek Olšák
maraeo at gmail.com
Fri Sep 9 14:06:17 UTC 2016
From: Marek Olšák <marek.olsak at amd.com>
This fixes 66 CTS tests on st/mesa.
Cc: 12.0 <mesa-stable at lists.freedesktop.org>
---
src/mesa/main/fbobject.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 2c01526..09da6b7 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -296,23 +296,35 @@ _mesa_get_fb0_attachment(struct gl_context *ctx, struct gl_framebuffer *fb,
return &fb->Attachment[BUFFER_FRONT_LEFT];
case GL_DEPTH:
return &fb->Attachment[BUFFER_DEPTH];
case GL_STENCIL:
return &fb->Attachment[BUFFER_STENCIL];
}
}
switch (attachment) {
case GL_FRONT_LEFT:
- return &fb->Attachment[BUFFER_FRONT_LEFT];
+ /* Front buffers can be allocated on the first use, but
+ * glGetFramebufferAttachmentParameteriv must work even if that
+ * allocation hasn't happened yet. In such case, use the back buffer,
+ * which should be the same.
+ */
+ if (fb->Attachment[BUFFER_FRONT_LEFT].Type == GL_NONE)
+ return &fb->Attachment[BUFFER_BACK_LEFT];
+ else
+ return &fb->Attachment[BUFFER_FRONT_LEFT];
case GL_FRONT_RIGHT:
- return &fb->Attachment[BUFFER_FRONT_RIGHT];
+ /* Same as above. */
+ if (fb->Attachment[BUFFER_FRONT_RIGHT].Type == GL_NONE)
+ return &fb->Attachment[BUFFER_BACK_RIGHT];
+ else
+ return &fb->Attachment[BUFFER_FRONT_RIGHT];
case GL_BACK_LEFT:
return &fb->Attachment[BUFFER_BACK_LEFT];
case GL_BACK_RIGHT:
return &fb->Attachment[BUFFER_BACK_RIGHT];
case GL_AUX0:
if (fb->Visual.numAuxBuffers == 1) {
return &fb->Attachment[BUFFER_AUX0];
}
return NULL;
--
2.7.4
More information about the mesa-dev
mailing list