Partager via


Texture Dirty Regions

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

Applications can optimize what subset of a texture is copied by specifying dirty regions on textures. Only those regions marked as dirty are copied by a call to IDirect3DMobileDevice::UpdateTexture. However, the dirty regions may be expanded to optimize alignment. When a texture is created, the entire texture is considered dirty. Only the following four operations affect the dirty state of a texture:

  • Adding a dirty region to a texture
  • Locking some buffer in the texture. This operation adds the locked region as a dirty region. The application can turn off this automatic dirty region update if it has better knowledge of the actual dirty regions.
  • Using the texture as a destination in IDirect3DMobileDevice::CopyRects marks the entire texture as dirty.
  • Using the texture as a source in UpdateTexture clears all the dirty regions on the source texture.

Dirty regions are set on the top level of a mipmapped texture using IDirect3DMobileTexture::AddDirtyRect. UpdateTexture can expand the dirty region down the mip chain in order to minimize the number of bytes copied for each sublevel. Note that the sublevel dirty region coordinates are rounded outward, that is, their fractional parts are rounded toward the nearest edge of the texture.

Passing NULL for the pDirtyRect parameters in IDirect3DMobileTexture::AddDirtyRect expands the dirty region to cover the entire texture.

Each lock method can take D3DMLOCK_NO_DIRTY_UPDATE (see D3DMLOCK Values) which prevents any changes to the dirty state of the texture. For more information, see Locking Resources.

Applications should use D3DLOCK_NO_DIRTY_UPDATE when further information about the true set of regions changed during a lock operation is available. You should note that a lock or copy to only a sublevel — that is, without locking or copying to the top level — of texture does not update the dirty regions for that texture. Applications assume the same responsibility for updating dirty regions when they lock lower levels without locking the topmost level.

See Also

Concepts

Textures