Ian Romanick wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm trying to get the patches attached to bug #2996 update.  As part of
that, I'm generating some smaller, more trivial patchs to commit to the
tree /before/ RC1.  I committed one really trivial one last night (the
EvalComputeK stuff).  This one is a little bit bigger, so I'd appreciate
some review before I commit it.

Basically, this refactors __glXImageSize and __glXImage3DSize into a
single function.  It replaces all calls to the old functions with calls
to __glXImageSize with the new parameter list.

I have also added 'target' as a parameter.  This is a stepping stone to
the code in patch #2410.  Basically, if the texture target is one of
GL_PROXY_*, the image size is always zero.  This gathers all the checks
for that into a single place.  I have *not* modified the existing
callers to take this into account.  They still do their own checks for
GL_PROXY_*.  However, when the generated versions of those functions are
added to the tree, they *will* rely on that.

The code growth is mainly due to the new 40 line comment before
__glXImageSize.

I have tested this with a few of the texture using demos and tests from
Mesa, including tunnel and texdown.

It's been a long time since I've looked at this stuff, but I'm not sure that __glXImageSize() is correct. Specifically, the last part of the function:

        [...]
        if (imageHeight > 0) {
            imageSize = (imageHeight + skipRows) * rowSize;
        } else {
            imageSize = (h + skipRows) * rowSize;
        }
        return ((d + skipImages) * imageSize);
    }
}


Why do skipRows and skipImages factor into the image size? I believe the dimensions of the image going over the wire is W * H * D. The skipRows and skipImages (and skipPixels) values just describe where to find the W*H*D image inside of a larger image.

See figure 3.8 on page 131 of the OpenGL 2.0 specification for a diagram.

Consider a scenario in which you're replacing a single texel in a 3D texture map. You've got a W*H*D 3D texture that in malloc'd memory which you previously uploaded with glTexImage3D. To upload a single changed texel in that volume at (x,y,z) you'd set GL_UNPACK_SKIP_PIXELS=x, GL_UNPACK_SKIP_ROWS=y, and GL_UNPACK_SKIP_IMAGES=z then call glTexSubImage3D(target, level, x, y, z, 1, 1, 1, type, volume).

Over the wire, we should send a single texel so the result of __glXImageSize should be pretty small. The __glFillImage() command on the client side doesn't seem to use SKIP_ROWS or SKIP_IMAGES in the way that __glXImageSize does.



Ian, you should test this with the drawpix demo: decrease the image height to about half by pressing 'h'. Then increase the skipRows value by pressing 'R'. Things should blow up on the server side if the __glXImageSize computation is wrong.

-Brian


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to