[Mesa-dev] [PATCH] mesa: default DepthMode to GL_RED on ES 3.0

Kenneth Graunke kenneth at whitecape.org
Wed Feb 17 07:14:37 UTC 2016


On Tuesday, February 16, 2016 6:29:39 PM PST Ilia Mirkin wrote:
> See commit 9db2098d which did it internally to the i965 driver. No
> reason not to have this more globally set though.
> 
> This fixes depth in a bunch of dEQP EXT_texture_border_clamp tests. And
> probably other items as well.
> 
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> Cc: Ian Romanick <idr at freedesktop.org>
> Cc: mesa-stable at lists.freedesktop.org
> ---
>  src/mesa/main/texobj.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
> index d8407f0..2b9c80a 100644
> --- a/src/mesa/main/texobj.c
> +++ b/src/mesa/main/texobj.c
> @@ -320,7 +320,8 @@ _mesa_initialize_texture_object( struct gl_context *ctx,
>     obj->Sampler.MaxAnisotropy = 1.0;
>     obj->Sampler.CompareMode = GL_NONE;         /* ARB_shadow */
>     obj->Sampler.CompareFunc = GL_LEQUAL;       /* ARB_shadow */
> -   obj->DepthMode = ctx->API == API_OPENGL_CORE ? GL_RED : GL_LUMINANCE;
> +   obj->DepthMode = (ctx->API == API_OPENGL_CORE || _mesa_is_gles3(ctx)) ?
> +      GL_RED : GL_LUMINANCE;
>     obj->StencilSampling = false;
>     obj->Sampler.CubeMapSeamless = GL_FALSE;
>     obj->Swizzle[0] = GL_RED;
> 

Now I'm a bit weirded out - three years later I can't recall why I wrote
an i965 specific patch for this.  Fixing it in core Mesa seems way
better.  I wonder why I didn't do that in the first place.

I don't think this is quite right, though...won't this default depth
mode to GL_RED for *all* formats?  The commit you and Ian cited explains
that we should default to GL_RED (X, 0, 0, 1) for *sized* formats, but
leave it as GL_LUMINANCE (X, X, X, 1) for the *unsized* ones.

We were sort of painted into a corner here...GLES 2 can be silently
promoted to GLES 3...and GLES 2 already specified this as GL_LUMINANCE,
but GLES 3 specified things as GL_RED...so there was a compromise.

Incidentally, we should figure out the GL 4.2 interaction I decided to
put off in 2013, since we're finally there :)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160216/2021d56f/attachment-0001.sig>


More information about the mesa-dev mailing list