[Mesa-dev] [PATCH 36/65] mesa/formatquery: Added {COLOR, DEPTH, STENCIL}_RENDERABLE <pname> queries
Eduardo Lima Mitev
elima at igalia.com
Wed Feb 3 15:45:21 UTC 2016
From: Antia Puentes <apuentes at igalia.com>
---
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 966d210..8b523a0 100644
--- a/src/mesa/main/formatquery.c
+++ b/src/mesa/main/formatquery.c
@@ -993,15 +993,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.5.3
More information about the mesa-dev
mailing list