From df3a37311d2cb1bf83e6803a8c974b7269d4c3c9 Mon Sep 17 00:00:00 2001 From: Antia Puentes Date: Sat, 19 Dec 2015 18:35:57 +0100 Subject: [PATCH] mesa/formatquery: Added {COLOR,DEPTH,STENCIL}_RENDERABLE queries Reviewed-by: Dave Airlie --- src/mesa/main/formatquery.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c index 5d7df15fd0d..339bee0d454 100644 --- a/src/mesa/main/formatquery.c +++ b/src/mesa/main/formatquery.c @@ -1001,15 +1001,23 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, break; case GL_COLOR_RENDERABLE: - /* @TODO */ - break; - case GL_DEPTH_RENDERABLE: - /* @TODO */ - break; - case GL_STENCIL_RENDERABLE: - /* @TODO */ + if (!_is_renderable(ctx, internalformat)) + goto end; + + if (pname == GL_COLOR_RENDERABLE) { + if (!_mesa_is_color_format(internalformat)) + goto end; + } else { + GLenum baseFormat = _mesa_base_fbo_format(ctx, internalformat); + if (baseFormat != GL_DEPTH_STENCIL && + ((pname == GL_DEPTH_RENDERABLE && baseFormat != GL_DEPTH_COMPONENT) || + (pname == GL_STENCIL_RENDERABLE && baseFormat != GL_STENCIL_INDEX))) + goto end; + } + + buffer[0] = GL_TRUE; break; case GL_FRAMEBUFFER_RENDERABLE: -- 2.30.2