From: Antia Puentes Date: Tue, 10 Nov 2015 12:53:45 +0000 (+0100) Subject: mesa/formatquery: Added {COLOR,DEPTH,STENCIL}_COMPONENTS queries X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c22ceb08bb4340b8f6e13e5b94fb288ce1bfeefa;p=mesa.git mesa/formatquery: Added {COLOR,DEPTH,STENCIL}_COMPONENTS queries Reviewed-by: Dave Airlie --- diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c index ef2b270dd0f..5d7df15fd0d 100644 --- a/src/mesa/main/formatquery.c +++ b/src/mesa/main/formatquery.c @@ -965,15 +965,39 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, } case GL_COLOR_COMPONENTS: - /* @TODO */ + /* The ARB_internalformat_query2 spec says: + * + * "- COLOR_COMPONENTS: If the internal format contains any color + * components (R, G, B, or A), TRUE is returned in . + * If the internal format is unsupported or contains no color + * components, FALSE is returned." + */ + if (_mesa_is_color_format(internalformat)) + buffer[0] = GL_TRUE; break; case GL_DEPTH_COMPONENTS: - /* @TODO */ + /* The ARB_internalformat_query2 spec says: + * + * "- DEPTH_COMPONENTS: If the internal format contains a depth + * component (D), TRUE is returned in . If the internal format + * is unsupported or contains no depth component, FALSE is returned." + */ + if (_mesa_is_depth_format(internalformat) || + _mesa_is_depthstencil_format(internalformat)) + buffer[0] = GL_TRUE; break; case GL_STENCIL_COMPONENTS: - /* @TODO */ + /* The ARB_internalformat_query2 spec says: + * + * "- STENCIL_COMPONENTS: If the internal format contains a stencil + * component (S), TRUE is returned in . If the internal format + * is unsupported or contains no stencil component, FALSE is returned. + */ + if (_mesa_is_stencil_format(internalformat) || + _mesa_is_depthstencil_format(internalformat)) + buffer[0] = GL_TRUE; break; case GL_COLOR_RENDERABLE: