Updating a DXTC texture with DX10

Updating a texture is usually straightforward: You call map, and mem-copy the stuff over the returned pointer, taking the stride into account. This is not so simple for DXTC though, as the data is organised in 4x4 pixels blocks.

With DX10, you have to copy one row of blocks before adding the row-pitch, even though the documentation states that the pitch is the number of bytes in a block:

RowPitch is the number of bytes in a block of 4x4 texels

This is not true, it's rather the number of bytes you have to skip after copying one row of blocks. Hope this helps you to save some time, I've been scratching my head for two hours yesterday, and I can tell you that even with Pix, debugging DXTC related problems is no fun, because you usually wind up with large randomly-colour texture areas with no clues where the problem appeared.

Comments

Comments powered by Disqus