summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/fbobject.c
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2016-09-08 21:02:29 +0200
committerMarek Olšák <marek.olsak@amd.com>2016-09-16 22:35:08 +0200
commitd58a3906cba57b12035f6ec7a3da80edc6929d6f (patch)
treef9b4e6161df81c8534608a9687333003596fe46b /src/mesa/main/fbobject.c
parent1c8d4c694bfb95ab90f152da710a8a9459a20228 (diff)
downloadexternal_mesa3d-d58a3906cba57b12035f6ec7a3da80edc6929d6f.zip
external_mesa3d-d58a3906cba57b12035f6ec7a3da80edc6929d6f.tar.gz
external_mesa3d-d58a3906cba57b12035f6ec7a3da80edc6929d6f.tar.bz2
mesa: fix glGetFramebufferAttachmentParameteriv w/ on-demand FRONT_BACK alloc
This fixes 66 CTS tests on st/mesa. Cc: 12.0 <mesa-stable@lists.freedesktop.org> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Diffstat (limited to 'src/mesa/main/fbobject.c')
-rw-r--r--src/mesa/main/fbobject.c16
1 files 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
@@ -303,9 +303,21 @@ _mesa_get_fb0_attachment(struct gl_context *ctx, struct gl_framebuffer *fb,
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: