summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/formatquery.c
diff options
context:
space:
mode:
authorAntia Puentes <apuentes@igalia.com>2015-12-21 15:57:25 +0100
committerEduardo Lima Mitev <elima@igalia.com>2016-03-03 15:14:07 +0100
commitb4ee9f56fd8e457c91a85bcebb124b088edee76e (patch)
treeb08d2b3a862c925432915d31a1a45d4911497514 /src/mesa/main/formatquery.c
parent557939c08faed7766aeee187c168ed4083c67e35 (diff)
downloadexternal_mesa3d-b4ee9f56fd8e457c91a85bcebb124b088edee76e.zip
external_mesa3d-b4ee9f56fd8e457c91a85bcebb124b088edee76e.tar.gz
external_mesa3d-b4ee9f56fd8e457c91a85bcebb124b088edee76e.tar.bz2
mesa/formatquery: Added texture gather/shadow related queries
From the ARB_internalformat_query2 specification: "- TEXTURE_SHADOW: The support for using the resource with shadow samplers is written to <params>. - TEXTURE_GATHER: The support for using the resource with texture gather operations is written to <params>. - TEXTURE_GATHER_SHADOW: The support for using resource with texture gather operations with shadow samplers is written to <params>." For all of them, "Possible values returned are FULL_SUPPORT, CAVEAT_SUPPORT, or NONE. If the resource or operation is not supported, NONE is returned." Reviewed-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'src/mesa/main/formatquery.c')
-rw-r--r--src/mesa/main/formatquery.c43
1 files changed, 36 insertions, 7 deletions
diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
index ac29bc8..e4ddb94 100644
--- a/src/mesa/main/formatquery.c
+++ b/src/mesa/main/formatquery.c
@@ -619,6 +619,9 @@ _mesa_query_internal_format_default(struct gl_context *ctx, GLenum target,
case GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE:
case GL_CLEAR_BUFFER:
case GL_TEXTURE_VIEW:
+ case GL_TEXTURE_SHADOW:
+ case GL_TEXTURE_GATHER:
+ case GL_TEXTURE_GATHER_SHADOW:
params[0] = GL_FULL_SUPPORT;
break;
@@ -1189,16 +1192,42 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
buffer);
break;
+ case GL_TEXTURE_GATHER:
+ case GL_TEXTURE_GATHER_SHADOW:
+ if (!_mesa_has_ARB_texture_gather(ctx))
+ goto end;
+
+ /* fallthrough */
case GL_TEXTURE_SHADOW:
- /* @TODO */
- break;
+ /* Only depth or depth-stencil image formats make sense in shadow
+ samplers */
+ if (pname != GL_TEXTURE_GATHER &&
+ !_mesa_is_depth_format(internalformat) &&
+ !_mesa_is_depthstencil_format(internalformat))
+ goto end;
- case GL_TEXTURE_GATHER:
- /* @TODO */
- break;
+ /* Validate the target for shadow and gather operations */
+ switch (target) {
+ case GL_TEXTURE_2D:
+ case GL_TEXTURE_2D_ARRAY:
+ case GL_TEXTURE_CUBE_MAP:
+ case GL_TEXTURE_CUBE_MAP_ARRAY:
+ case GL_TEXTURE_RECTANGLE:
+ break;
- case GL_TEXTURE_GATHER_SHADOW:
- /* @TODO */
+ case GL_TEXTURE_1D:
+ case GL_TEXTURE_1D_ARRAY:
+ /* 1D and 1DArray textures are not admitted in gather operations */
+ if (pname != GL_TEXTURE_SHADOW)
+ goto end;
+ break;
+
+ default:
+ goto end;
+ }
+
+ ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname,
+ buffer);
break;
case GL_SHADER_IMAGE_LOAD: