Texture Dirty Regions


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

Dirty regions are set on the top level of a mipmapped texture, and Device.UpdateTexture can expand the dirty region down the mip chain 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.

Because each type of texture has different types of dirty regions, there are methods on each texture type, as shown in the following list. Two-dimensional (2-D) textures use dirty rectangles, and volume textures use boxes.

Omitting the rect or box parameters for the above methods expands the dirty region to cover the entire texture.

Each lock method can take LockFlags.NoDirtyUpdate, which prevents any changes to the dirty state of the texture. For more information, see Locking Resources.

When more information about the true set of regions that are changed during a lock operation is available, applications should use LockFlags.NoDirtyUpdate. Note that a lock or a copy to a texture sublevel only (that is, without locking or copying to the top level) 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.


Send comments about this topic to Microsoft. © Microsoft Corporation. All rights reserved.

Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center