diff options
author | Antia Puentes <[email protected]> | 2015-12-19 20:29:31 +0100 |
---|---|---|
committer | Eduardo Lima Mitev <[email protected]> | 2016-03-03 15:14:07 +0100 |
commit | 557939c08faed7766aeee187c168ed4083c67e35 (patch) | |
tree | ad9b5b8f39838191822d1eda1360a95be6e426c4 /src/mesa | |
parent | 04e2e0b24a72dc4f66a0d56cee8b5d50233374a7 (diff) |
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 <params>.
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 <params>. 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 <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/formatquery.c | 22 |
1 files changed, 18 insertions, 4 deletions
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: |