Thomas, I think there's a bug in this patch.  See end.

The other texture-related patches look good.

Keith may want to take a look at the tnl patch.  One thing I noticed 
though: I think the 'elts' parameter to 
_tnl_emit_indexed_vertices_to_buffer() could be const-qualified.

Feel free to commit to master.  I don't see any impact on 7.3.

-Brian


[email protected] wrote:
> From: Thomas Hellstrom <thellstrom-at-vmware-dot-com>

[...]

> diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
> index 4b2b129..ddaa2ba 100644
> --- a/src/mesa/main/texstore.c
> +++ b/src/mesa/main/texstore.c
> @@ -1898,6 +1898,60 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS)
>     return GL_TRUE;
>  }
> 
> +GLboolean
> +_mesa_texstore_rgba4444(TEXSTORE_PARAMS)
> +{
> +   ASSERT(dstFormat == &_mesa_texformat_rgba4444);
> +   ASSERT(dstFormat->TexelBytes == 2);
> +
> +   if (!ctx->_ImageTransferState &&
> +       !srcPacking->SwapBytes &&
> +       dstFormat == &_mesa_texformat_rgba4444 &&
> +       baseInternalFormat == GL_RGBA &&
> +       srcFormat == GL_RGBA &&
> +       srcType == GL_UNSIGNED_SHORT_4_4_4_4){
> +      /* simple memcpy path */
> +      memcpy_texture(ctx, dims,
> +                     dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
> +                     dstRowStride,
> +                     dstImageOffsets,
> +                     srcWidth, srcHeight, srcDepth, srcFormat, srcType,
> +                     srcAddr, srcPacking);
> +   }
> +   else {
> +      /* general path */
> +      const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
> +                                                 baseInternalFormat,
> +                                                 dstFormat->BaseFormat,
> +                                                 srcWidth, srcHeight, 
> srcDepth,
> +                                                 srcFormat, srcType, srcAddr,
> +                                                 srcPacking);
> +      const GLchan *src = tempImage;
> +      GLint img, row, col;
> +      if (!tempImage)
> +         return GL_FALSE;
> +      _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
> +      for (img = 0; img < srcDepth; img++) {
> +         GLubyte *dstRow = (GLubyte *) dstAddr
> +            + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
> +            + dstYoffset * dstRowStride
> +            + dstXoffset * dstFormat->TexelBytes;
> +         for (row = 0; row < srcHeight; row++) {
> +            GLushort *dstUS = (GLushort *) dstRow;
> +           for (col = 0; col < srcWidth; col++) {
> +             dstUS[col] = PACK_COLOR_4444( CHAN_TO_UBYTE(src[RCOMP]),
> +                                           CHAN_TO_UBYTE(src[GCOMP]),
> +                                           CHAN_TO_UBYTE(src[BCOMP]),
> +                                           CHAN_TO_UBYTE(src[ACOMP]) );
> +             src += 4;
> +            }
> +            dstRow += dstRowStride;
> +         }
> +      }
> +      _mesa_free((void *) tempImage);
> +   }
> +   return GL_TRUE;
> +}
> 
>  GLboolean
>  _mesa_texstore_argb4444(TEXSTORE_PARAMS)
> @@ -1966,7 +2020,60 @@ _mesa_texstore_argb4444(TEXSTORE_PARAMS)
>     return GL_TRUE;
>  }
> 
> +GLboolean
> +_mesa_texstore_rgba5551(TEXSTORE_PARAMS)
> +{
> +   ASSERT(dstFormat == &_mesa_texformat_rgba5551);
> +   ASSERT(dstFormat->TexelBytes == 2);
> 
> +   if (!ctx->_ImageTransferState &&
> +       !srcPacking->SwapBytes &&
> +       dstFormat == &_mesa_texformat_rgba5551 &&
> +       baseInternalFormat == GL_RGBA &&
> +       srcFormat == GL_RGBA &&
> +       srcType == GL_UNSIGNED_SHORT_5_5_5_1) {
> +      /* simple memcpy path */
> +      memcpy_texture(ctx, dims,
> +                     dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
> +                     dstRowStride,
> +                     dstImageOffsets,
> +                     srcWidth, srcHeight, srcDepth, srcFormat, srcType,
> +                     srcAddr, srcPacking);
> +   }
> +   else {
> +      /* general path */
> +      const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
> +                                                 baseInternalFormat,
> +                                                 dstFormat->BaseFormat,
> +                                                 srcWidth, srcHeight, 
> srcDepth,
> +                                                 srcFormat, srcType, srcAddr,
> +                                                 srcPacking);
> +      const GLchan *src =tempImage;
> +      GLint img, row, col;
> +      if (!tempImage)
> +         return GL_FALSE;
> +      _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
> +      for (img = 0; img < srcDepth; img++) {
> +         GLubyte *dstRow = (GLubyte *) dstAddr
> +            + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
> +            + dstYoffset * dstRowStride
> +            + dstXoffset * dstFormat->TexelBytes;
> +         for (row = 0; row < srcHeight; row++) {
> +            GLushort *dstUS = (GLushort *) dstRow;
> +           for (col = 0; col < srcWidth; col++) {
> +             dstUS[col] = PACK_COLOR_5551( CHAN_TO_UBYTE(src[ACOMP]),
> +                                           CHAN_TO_UBYTE(src[RCOMP]),
> +                                           CHAN_TO_UBYTE(src[GCOMP]),
> +                                           CHAN_TO_UBYTE(src[BCOMP]) );

I think the arguments to PACK_COLOR_5551 are in the wrong order (RGBA, 
ARGB).




------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to