[Mesa-dev] [PATCH] mesa: Don't use memcpy() in _mesa_texstore() for depth texture data
Anuj Phogat
anuj.phogat at gmail.com
Mon Jul 21 15:09:56 PDT 2014
On Fri, Jul 18, 2014 at 5:54 PM, Marek Olšák <maraeo at gmail.com> wrote:
>
> Shouldn't the function return TRUE for floating-point depth textures only?
>
Depth texture data needs clamping in following two cases:
1. Float texture format supplied with signed data needs clamping to [0.0, 1.0].
2. Fixed point texture format supplied with signed data needs clamping to
[0, 2^n -1].
But, all the cases except one (float texture supplied with float data) are ruled
out by _mesa_format_matches_format_and_type() in
_mesa_texstore_can_use_memcpy().
So, I think a better place to do this check will be at end of
_mesa_texstore_can_use_memcpy() function:
if (baseInternalFormat == GL_DEPTH_COMPONENT && srcType == GL_FLOAT))
return GL_FALSE; /* can't use memcpy */
I'll send out an updated patch if it looks good to you.
> Marek
>
> On Sat, Jul 19, 2014 at 12:53 AM, Anuj Phogat <anuj.phogat at gmail.com> wrote:
> > because depth texture data needs clamping to [0.0, 1.0]. Let the
> > _mesa_texstore() fallback to slower path.
> >
> > Fixes Khronos GLES3 CTS tests:
> > shadow_execution_vert
> > shadow_execution_frag
> >
> > Cc: <mesa-stable at lists.freedesktop.org>
> > Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
> > ---
> > src/mesa/main/texstore.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
> > index d363f9f..4bed62a 100644
> > --- a/src/mesa/main/texstore.c
> > +++ b/src/mesa/main/texstore.c
> > @@ -3790,8 +3790,8 @@ _mesa_texstore_needs_transfer_ops(struct gl_context *ctx,
> > switch (baseInternalFormat) {
> > case GL_DEPTH_COMPONENT:
> > case GL_DEPTH_STENCIL:
> > - return ctx->Pixel.DepthScale != 1.0f ||
> > - ctx->Pixel.DepthBias != 0.0f;
> > + /* Depth texture data needs clamping to [0.0, 1.0]. */
> > + return GL_TRUE;
> >
> > case GL_STENCIL_INDEX:
> > return GL_FALSE;
> > --
> > 1.9.3
> >
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list