Device.UpdateSurface(Surface,Surface) Method (Microsoft.DirectX.Direct3D)

Copies rectangular subsets of pixels from one surface to another.

Definition

Visual Basic Public Sub UpdateSurface( _
    ByVal sourceSurface As Surface, _
    ByVal destinationSurface As Surface _
)
C# public void UpdateSurface(
    Surface sourceSurface,
    Surface destinationSurface
);
C++ public:
void UpdateSurface(
    SurfacesourceSurface,
    SurfacedestinationSurface
);
JScript public function UpdateSurface(
    sourceSurface : Surface,
    destinationSurface : Surface
);

Parameters

sourceSurface Microsoft.DirectX.Direct3D.Surface
A Surface object that represents the source surface; must point to a surface other than destinationSurface.
destinationSurface Microsoft.DirectX.Direct3D.Surface
A Surface object that represents the destination surface.

Remarks

This method has the following restrictions.

  • The source surface must have been created with Pool.SystemMemory.
  • The destination surface must have been created with Pool.Default.
  • Neither surface can be locked or hold an outstanding device context.
  • Neither surface can be created with multisampling. The only valid flag for both surfaces is MultiSampleType.None.
  • The surface format cannot be a depth stencil format.
  • The source and destination rectangles must fit within the surface.
  • No stretching or shrinking is allowed; that is, the rectangles must be the same size.
  • The source format must match the destination format.

The following table shows the supported format combinations.

Destination format
Source format Texture RT texture RT Off-screen plain
Texture Yes Yes Yes* Yes
RT texture No No No No
RT No No No No
Off-screen plain Yes Yes Yes Yes

* If the driver does not support the requested copy, it is emulated using locking and copying.

If the application needs to copy data from a Pool.Default render target to a Pool.SystemMemory surface, it can use Device.GetRenderTargetData.

Exceptions

InvalidCallException

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