[Mesa-dev] [PATCH 49/65] mesa/formatquery: Added simultaneous texture and depth/stencil queries
Eduardo Lima Mitev
elima at igalia.com
Wed Feb 3 15:45:34 UTC 2016
From: Antia Puentes <apuentes at igalia.com>
>From the ARB_internalformat_query2 specification:
"- SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST: The support for using the resource
both as a source for texture sampling while it is bound as a buffer for
depth test is written to <params>. For example, a depth (or stencil)
texture could be bound simultaneously for texturing while it is bound as
a depth (and/or stencil) buffer without causing a feedback loop, provided
that depth writes are disabled.
- SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST: The support for using the resource
both as a source for texture sampling while it is bound as a buffer for
stencil test is written to <params>. For example, a depth (or stencil)
texture could be bound simultaneously for texturing while it is bound as
a depth (and/or stencil) buffer without causing a feedback loop,
provided that stencil writes are disabled.
- SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE: The support for using the resource
both as a source for texture sampling while performing depth writes to
the resources is written to <params>. For example, a depth-stencil
texture could be bound simultaneously for stencil texturing while it
is bound as a depth buffer. Feedback loops cannot occur because sampling
a stencil texture only returns the stencil portion, and thus writes to
the depth buffer do not modify the stencil portions.
- SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE: The support for using the resource
both as a source for texture sampling while performing stencil writes to
the resources is written to <params>. For example, a depth-stencil
texture could be bound simultaneously for depth-texturing while it is
bound as a stencil buffer. Feedback loops cannot occur because sampling
a depth texture only returns the depth portion, and thus writes to
the stencil buffer could not modify the depth portions.
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."
---
src/mesa/main/formatquery.c | 29 +++++++++++++++++++----------
1 file changed, 19 insertions(+), 10 deletions(-)
diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
index f25bcec..a62a8ac 100644
--- a/src/mesa/main/formatquery.c
+++ b/src/mesa/main/formatquery.c
@@ -606,6 +606,10 @@ _mesa_query_internal_format_default(struct gl_context *ctx, GLenum target,
case GL_SHADER_IMAGE_LOAD:
case GL_SHADER_IMAGE_STORE:
case GL_SHADER_IMAGE_ATOMIC:
+ case GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST:
+ case GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST:
+ case GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE:
+ case GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE:
params[0] = GL_FULL_SUPPORT;
break;
@@ -1286,19 +1290,24 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
}
case GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST:
- /* @TODO */
- break;
-
case GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST:
- /* @TODO */
- break;
-
case GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE:
- /* @TODO */
- break;
-
case GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE:
- /* @TODO */
+ if (target == GL_RENDERBUFFER)
+ goto end;
+
+ if (!_mesa_is_depthstencil_format(internalformat)) {
+ if (((pname == GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST ||
+ pname == GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE) &&
+ !_mesa_is_depth_format(internalformat)) ||
+ ((pname == GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST ||
+ pname == GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE) &&
+ !_mesa_is_stencil_format(internalformat)))
+ goto end;
+ }
+
+ ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname,
+ buffer);
break;
case GL_TEXTURE_COMPRESSED:
--
2.5.3
More information about the mesa-dev
mailing list