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 <airlied@redhat.com>
This commit is contained in:
Antia Puentes
2015-12-19 20:29:31 +01:00
committed by Eduardo Lima Mitev
parent 04e2e0b24a
commit 557939c08f

View File

@@ -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: