[Mesa-dev] [PATCH] mesa: Return LINEAR encoding for winsys FBO depth/stencil.
Kenneth Graunke
kenneth at whitecape.org
Sat Dec 10 01:16:37 UTC 2016
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 at whitecape.org>
---
src/mesa/main/fbobject.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 64c4ab5..26fc15d 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -3788,8 +3788,13 @@ _mesa_get_framebuffer_attachment_parameter(struct gl_context *ctx,
goto invalid_pname_enum;
}
else if (att->Type == GL_NONE) {
- _mesa_error(ctx, err, "%s(invalid pname %s)", caller,
- _mesa_enum_to_string(pname));
+ if (_mesa_is_winsys_fbo(buffer) &&
+ (attachment == GL_DEPTH || attachment == GL_STENCIL)) {
+ *params = GL_LINEAR;
+ } else {
+ _mesa_error(ctx, err, "%s(invalid pname %s)", caller,
+ _mesa_enum_to_string(pname));
+ }
}
else {
if (ctx->Extensions.EXT_framebuffer_sRGB) {
--
2.10.2
More information about the mesa-dev
mailing list