Device.UpdateTexture Method

Language:

Updates the dirty portions of a texture.

Definition

Visual Basic Public Sub UpdateTexture( _
    ByVal sourceTexture As BaseTexture, _
    ByVal destinationTexture As BaseTexture _
)
C# public void UpdateTexture(
    BaseTexture sourceTexture,
    BaseTexture destinationTexture
);
C++ public:
void UpdateTexture(
    BaseTexturesourceTexture,
    BaseTexturedestinationTexture
);
JScript public function UpdateTexture(
    sourceTexture : BaseTexture,
    destinationTexture : BaseTexture
);

Parameters

sourceTexture Microsoft.DirectX.Direct3D.BaseTexture
A BaseTexture object that represents the source texture, which must be in system memory (Pool.SystemMemory).
destinationTexture Microsoft.DirectX.Direct3D.BaseTexture
A BaseTexture object that represents the destination texture, which must be in the default memory pool (Pool.Default).

Remarks

To dirty a portion of a texture, either lock it or call one of the following methods.

Device.UpdateTexture retrieves the dirty portions of the texture by calculating what has been accumulated since the last update operation.

For performance reasons, dirty regions are recorded only for level 0 of a texture. For sublevels, it is assumed that the corresponding (scaled) rectangle or box is also dirty. Dirty regions are automatically recorded when Texture.LockRectangle or VolumeTexture.LockBox is called without LockFlags.NoDirtyUpdate or LockFlags.ReadOnly. Also, the destination surface of Device.UpdateSurface is marked dirty.

This method fails if the textures are of different types, if their bottom-level buffers are of different sizes, or if their matching levels do not match. For example, consider a six-level source texture with the following dimensions:

32x16, 16x8, 8x4, 4x2, 2x1, 1x1

This six-level source texture could be the source for the following one-level destination:

1x1

For the following two-level destination:

2x1, 1x1

Or for the following three-level destination:

4x2, 2x1, 1x1

In addition, this method fails if the textures are of different formats. If the destination texture has fewer levels than the source, only the matching levels are copied. If the source texture has fewer levels than the destination, the method fails.

If the source texture contains dirty regions, the copy operation can be optimized by restricting it to those regions only. It is not guaranteed that only those bytes marked dirty will be copied.

The following scenarios are supported for source and destination surface combinations.

Exceptions
InvalidCallException The method call is invalid. For example, a method's parameter might contain an invalid value.


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