mesa: Return LINEAR encoding for winsys FBO depth/stencil.
authorKenneth Graunke <kenneth@whitecape.org>
Sat, 10 Dec 2016 00:16:53 +0000 (16:16 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 12 Dec 2016 00:33:05 +0000 (16:33 -0800)
commit713cd23d8e5db82e64c81fff792a932a614d7006
tree3de675313f4210550a9aa6097ea9eeb51cef411b
parentb58d1eecc6516749c160942855a9d6b558f1e947
mesa: Return LINEAR encoding for winsys FBO depth/stencil.

GetFramebufferAttachmentParameteriv should return GL_LINEAR for the
window system default framebuffer's GL_DEPTH or GL_STENCIL attachments
when there are zero depth or stencil bits.

The GL 4.5 spec's GetFramebufferAttachmentParameteriv section says:

"If the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is not NONE,
 these queries apply to all other framebuffer types:

 [...]

 If attachment is not a color attachment, or no data storage or texture
 image has been specified for the attachment, then params will contain
 the value LINEAR."

Note that we already return LINEAR for the case where there is an actual
depth or stencil renderbuffer attached.  In the case modified by this
patch, FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE returns FRAMEBUFFER_DEFAULT
rather than NONE.

Fixes a CTS test when run in a visual without depth / stencil buffers:
GL45-CTS.gtf30.GL3Tests.framebuffer_srgb.framebuffer_srgb_default_encoding

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
src/mesa/main/fbobject.c