From 557939c08faed7766aeee187c168ed4083c67e35 Mon Sep 17 00:00:00 2001 From: Antia Puentes Date: Sat, 19 Dec 2015 20:29:31 +0100 Subject: mesa/formatquery: Added texture view related queries From the ARB_internalformat_query2 specification: "- TEXTURE_VIEW: The support for using the resource with the TextureView command is returned in . Possible values returned are FULL_SUPPORT, CAVEAT_SUPPORT, or NONE. If the resource or operation is not supported, NONE is returned. - VIEW_COMPATIBILITY_CLASS: The compatibility class of the resource when used as a texture view is returned in . The compatibility class is one of the values from the /Class/ column of Table 3.X.2. If the resource has no other formats that are compatible, the resource does not support views, or if texture views are not supported, NONE is returned." Reviewed-by: Dave Airlie --- src/mesa/main/formatquery.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c index 9fe9072a781..ac29bc80385 100644 --- a/src/mesa/main/formatquery.c +++ b/src/mesa/main/formatquery.c @@ -35,6 +35,7 @@ #include "genmipmap.h" #include "shaderimage.h" #include "texcompress.h" +#include "textureview.h" static bool _is_renderable(struct gl_context *ctx, GLenum internalformat) @@ -617,6 +618,7 @@ _mesa_query_internal_format_default(struct gl_context *ctx, GLenum target, case GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE: case GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE: case GL_CLEAR_BUFFER: + case GL_TEXTURE_VIEW: params[0] = GL_FULL_SUPPORT; break; @@ -1376,11 +1378,23 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, break; case GL_TEXTURE_VIEW: - /* @TODO */ - break; - case GL_VIEW_COMPATIBILITY_CLASS: - /* @TODO */ + if (!_mesa_has_ARB_texture_view(ctx) || + target == GL_TEXTURE_BUFFER || + target == GL_RENDERBUFFER) + goto end; + + if (pname == GL_TEXTURE_VIEW) { + ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname, + buffer); + } else { + GLenum view_class = _mesa_texture_view_lookup_view_class(ctx, + internalformat); + if (view_class == GL_FALSE) + goto end; + + buffer[0] = view_class; + } break; default: -- cgit v1.2.3