[Mesa-dev] [RFC 52/63] mesa/formatquery: Added texture view related queries
Eduardo Lima Mitev
elima at igalia.com
Tue Jan 19 08:42:32 PST 2016
From: Antia Puentes <apuentes at igalia.com>
>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."
---
src/mesa/main/formatquery.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
index 2f420a1..d3666d5 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)
@@ -615,6 +616,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;
@@ -1336,11 +1338,23 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
break;
case GL_TEXTURE_VIEW:
- /* @TODO */
- break;
-
case GL_VIEW_COMPATIBILITY_CLASS:
- /* @TODO */
+ if (!ctx->Extensions.ARB_texture_view ||
+ 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:
--
2.5.3
More information about the mesa-dev
mailing list