[Mesa-dev] [PATCH 2/4] mesa: implement EXT_packed_float
Eric Anholt
eric at anholt.net
Thu Apr 28 09:36:14 PDT 2011
On Thu, 28 Apr 2011 14:04:23 +0200, Marek Olšák <maraeo at gmail.com> wrote:
> +static GLboolean
> +_mesa_texstore_r11_g11_b10f(TEXSTORE_PARAMS)
> +{
> + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
> +
> + ASSERT(dstFormat == MESA_FORMAT_R11_G11_B10_FLOAT);
> + ASSERT(baseInternalFormat == GL_RGB);
> +
> + if (!ctx->_ImageTransferState &&
> + !srcPacking->SwapBytes &&
> + srcFormat == GL_RGB &&
> + srcType == GL_UNSIGNED_INT_10F_11F_11F_REV) {
> + /* 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 GLfloat *tempImage = _mesa_make_temp_float_image(ctx, dims,
> + baseInternalFormat,
> + baseFormat,
> + srcWidth, srcHeight, srcDepth,
> + srcFormat, srcType, srcAddr,
> + srcPacking,
> + ctx->_ImageTransferState);
> + const GLfloat *srcRow = tempImage;
> + GLint bytesPerRow;
> + GLint img, row, col;
> + if (!tempImage)
> + return GL_FALSE;
> + bytesPerRow = srcWidth * 3 * sizeof(GLfloat);
Unused variable bytesPerRow?
Other than that,
Reviewed-by: Eric Anholt <eric at anholt.net>
Seeing this same shape of function over and over, I wish we had
something that would try to come up with a MESA_FORMAT for a src
type/format, do the memcpy if it matches dst, and falls back to a
default make_temp_float_image otherwise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20110428/4c8759ee/attachment-0001.pgp>
More information about the mesa-dev
mailing list