[Mesa-dev] [PATCH] mesa/texstore: Don't use the _mesa_swizzle_and_convert if we need transfer ops

Jason Ekstrand jason at jlekstrand.net
Wed Aug 13 17:21:09 PDT 2014


On Wed, Aug 13, 2014 at 5:18 PM, Roland Scheidegger <sroland at vmware.com>
wrote:

> Reviewed-by: Roland Scheidegger <sroland at vmware.com>
>
> Not sure though why you moved the function, it's declared elsewhere anyway.
>

Heh, I guess you're right.  I'll un-move the function to reduce churn.


> (And I bet there's cases where transfer ops wouldn't actually be
> required which aren't caught by this check, like for instance RGB
> formats with only alpha pixel scale, but that was already there, plus I
> guess we don't care all that much about performance for apps which
> fiddle with that stuff...)
>

Yeah, We could spend a lot of time optimizing that but I don't see a need.
--Jason


>
>
> Am 13.08.2014 20:05, schrieb Jason Ekstrand:
> > The _mesa_swizzle_and_convert path can't do transfer ops, so we should
> bail
> > if they're needed.
> >
> > Signed-off-by: Jason Ekstrand <jason.ekstrand at intel.com>
> > ---
> >  src/mesa/main/texstore.c | 63
> +++++++++++++++++++++++++-----------------------
> >  1 file changed, 33 insertions(+), 30 deletions(-)
> >
> > diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
> > index 42cebbd..50c7dde 100644
> > --- a/src/mesa/main/texstore.c
> > +++ b/src/mesa/main/texstore.c
> > @@ -1462,6 +1462,36 @@ invert_swizzle(uint8_t dst[4], const uint8_t
> src[4])
> >              dst[i] = j;
> >  }
> >
> > +GLboolean
> > +_mesa_texstore_needs_transfer_ops(struct gl_context *ctx,
> > +                                  GLenum baseInternalFormat,
> > +                                  mesa_format dstFormat)
> > +{
> > +   GLenum dstType;
> > +
> > +   /* There are different rules depending on the base format. */
> > +   switch (baseInternalFormat) {
> > +   case GL_DEPTH_COMPONENT:
> > +   case GL_DEPTH_STENCIL:
> > +      return ctx->Pixel.DepthScale != 1.0f ||
> > +             ctx->Pixel.DepthBias != 0.0f;
> > +
> > +   case GL_STENCIL_INDEX:
> > +      return GL_FALSE;
> > +
> > +   default:
> > +      /* Color formats.
> > +       * Pixel transfer ops (scale, bias, table lookup) do not apply
> > +       * to integer formats.
> > +       */
> > +      dstType = _mesa_get_format_datatype(dstFormat);
> > +
> > +      return dstType != GL_INT && dstType != GL_UNSIGNED_INT &&
> > +             ctx->_ImageTransferState;
> > +   }
> > +}
> > +
> > +
> >  /** Store a texture by per-channel conversions and swizzling.
> >   *
> >   * This function attempts to perform a texstore operation by doing
> simple
> > @@ -1495,6 +1525,9 @@ texstore_swizzle(TEXSTORE_PARAMS)
> >     if (!is_array)
> >        return GL_FALSE;
> >
> > +   if (_mesa_texstore_needs_transfer_ops(ctx, baseInternalFormat,
> dstFormat))
> > +      return GL_FALSE;
> > +
> >     switch (srcType) {
> >     case GL_FLOAT:
> >     case GL_UNSIGNED_BYTE:
> > @@ -1762,36 +1795,6 @@ texstore_rgba(TEXSTORE_PARAMS)
> >  }
> >
> >  GLboolean
> > -_mesa_texstore_needs_transfer_ops(struct gl_context *ctx,
> > -                                  GLenum baseInternalFormat,
> > -                                  mesa_format dstFormat)
> > -{
> > -   GLenum dstType;
> > -
> > -   /* There are different rules depending on the base format. */
> > -   switch (baseInternalFormat) {
> > -   case GL_DEPTH_COMPONENT:
> > -   case GL_DEPTH_STENCIL:
> > -      return ctx->Pixel.DepthScale != 1.0f ||
> > -             ctx->Pixel.DepthBias != 0.0f;
> > -
> > -   case GL_STENCIL_INDEX:
> > -      return GL_FALSE;
> > -
> > -   default:
> > -      /* Color formats.
> > -       * Pixel transfer ops (scale, bias, table lookup) do not apply
> > -       * to integer formats.
> > -       */
> > -      dstType = _mesa_get_format_datatype(dstFormat);
> > -
> > -      return dstType != GL_INT && dstType != GL_UNSIGNED_INT &&
> > -             ctx->_ImageTransferState;
> > -   }
> > -}
> > -
> > -
> > -GLboolean
> >  _mesa_texstore_can_use_memcpy(struct gl_context *ctx,
> >                                GLenum baseInternalFormat, mesa_format
> dstFormat,
> >                                GLenum srcFormat, GLenum srcType,
> >
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140813/698311ed/attachment.html>


More information about the mesa-dev mailing list