summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/formatquery.c
diff options
context:
space:
mode:
authorAntia Puentes <apuentes@igalia.com>2015-12-19 18:35:57 +0100
committerEduardo Lima Mitev <elima@igalia.com>2016-03-03 15:14:06 +0100
commitdf3a37311d2cb1bf83e6803a8c974b7269d4c3c9 (patch)
tree882e6650ff6c97d3b890166baf3f99e40576d2a3 /src/mesa/main/formatquery.c
parentc22ceb08bb4340b8f6e13e5b94fb288ce1bfeefa (diff)
downloadexternal_mesa3d-df3a37311d2cb1bf83e6803a8c974b7269d4c3c9.zip
external_mesa3d-df3a37311d2cb1bf83e6803a8c974b7269d4c3c9.tar.gz
external_mesa3d-df3a37311d2cb1bf83e6803a8c974b7269d4c3c9.tar.bz2
mesa/formatquery: Added {COLOR,DEPTH,STENCIL}_RENDERABLE <pname> queries
Reviewed-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'src/mesa/main/formatquery.c')
-rw-r--r--src/mesa/main/formatquery.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
index 5d7df15..339bee0 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: