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 4×4 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 4×4 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.

Related posts:

  1. Virtual texture mapping, part 2
  2. Virtual texture mapping
  3. Updating
  4. Assisted texture assignment preprint availalbe
  5. Debugging shaders: Artifacts grouped into quads

This entry was posted in Realtime and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>