wined3d: Add support for updating part of a compressed surface.
hverbeet at gmail.com
Sat Sep 6 00:52:23 CDT 2008
2008/9/5 Christof Sigel <christof.sigel at intenode.on.net>:
> + /* since DXT compressed formats are specified in 4x4 pixel blocks devide pitch by 4 */
> + int srcPitch=srcLockedRect.Pitch>>2;
> + int destPitch=destLockedRect.Pitch>>2;
That will break with DXT1 surfaces. All the DXT formats are specified
in 4x4 blocks, but for DXT1 a 4x4 block is 8 bytes, while for the
other DXT formats a block is 16 bytes. This also has implications for
how you should handle copying row by row, since each row is 4 pixels
high. Strictly speaking you should also verify that the pitch exactly
corresponds to the surface width before using the "single memcpy"
path, since theory the surface layout in memory could look like this:
| surface |xxxxxxxxxxxxxxxx
In other words, for a DXT1 surface with height h, width w and pitch p,
you should copy h/4 rows of w*2 bytes, where each row starts at
pBits+p*row. For DXT2/3/4/5 you'd copy w*4 bytes for each row. A test
for this code would be appreciated.
More information about the wine-devel