Hi:

I'm the topic starter of "*is_color_format() and convolution calculation*",
because some reasons I dropped my original mail address of hotmail, instead,
I use gmail which I think more suitable here.

First, thanks for Brian's quick reply, then, I totally agree with you. In
function of _mesa_store_teximage_{1,2}d(), I found that the "postConvWidth"
and "postConvHeight" used for caculating buffer size but the dstRowStride is
caculated via texImage->RowStride! It means in this function we can assume
that the texImage object is valid yet, so its Width, Height, Width2,
Height2... should also be valid too. So why not drop off
_mesa_adjust_image_for_convolution() here and directly use texImage->Width
and texImage->Height for buffer size caculation? Below is my patch for this
function, some problems please point to for me, thanks very much. The mesa
version is 7.0.3.

diff -u
./Mesa-7.0.3/src/mesa/main/texstore.c ./Mesa/src/mesa/main/texstore.c
--- ./Mesa-7.0.3/src/mesa/main/texstore.c 2008-07-11 16:40:42.734570100
+0800
+++ ./Mesa/src/mesa/main/texstore.c 2008-10-23 10:32:24.259670800 +0800
@@ -2866,21 +2866,16 @@
                        struct gl_texture_object *texObj,
                        struct gl_texture_image *texImage)
 {
-   GLint postConvWidth = width;
    GLint sizeInBytes;
    (void) border;

-   if (ctx->_ImageTransferState & IMAGE_CONVOLUTION_BIT) {
-      _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL);
-   }
-
    choose_texture_format(ctx, texImage, 1, format, type, internalFormat);

    /* allocate memory */
    if (texImage->IsCompressed)
       sizeInBytes = texImage->CompressedSize;
    else
-      sizeInBytes = postConvWidth * texImage->TexFormat->TexelBytes;
+      sizeInBytes = texImage->Width * texImage->TexFormat->TexelBytes;
    texImage->Data = _mesa_alloc_texmemory(sizeInBytes);
    if (!texImage->Data) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D");
@@ -2942,15 +2937,9 @@
                        struct gl_texture_object *texObj,
                        struct gl_texture_image *texImage)
 {
-   GLint postConvWidth = width, postConvHeight = height;
    GLint texelBytes, sizeInBytes;
    (void) border;

-   if (ctx->_ImageTransferState & IMAGE_CONVOLUTION_BIT) {
-      _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth,
-                                         &postConvHeight);
-   }
-
    choose_texture_format(ctx, texImage, 2, format, type, internalFormat);

    texelBytes = texImage->TexFormat->TexelBytes;
@@ -2959,7 +2948,7 @@
    if (texImage->IsCompressed)
       sizeInBytes = texImage->CompressedSize;
    else
-      sizeInBytes = postConvWidth * postConvHeight * texelBytes;
+      sizeInBytes = texImage->Width * texImage->Height * texelBytes;
    texImage->Data = _mesa_alloc_texmemory(sizeInBytes);
    if (!texImage->Data) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");

Regards

Westermann
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to