Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

IDXGIResource1::CreateSubresourceSurface method

Creates a subresource surface object.


HRESULT CreateSubresourceSurface(
        UINT          index,
  [out] IDXGISurface2 **ppSurface



The index of the subresource surface object to enumerate.

ppSurface [out]

The address of a pointer to a IDXGISurface2 interface that represents the created subresource surface object at the position specified by the index parameter.

Return value

Returns S_OK if successful; otherwise, returns one of the following values:

  • DXGI_ERROR_INVALID_CALL if the index is out of range or if the subresource is not a valid surface.
  • E_OUTOFMEMORY if insufficient memory is available to create the subresource surface object.

A subresource is a valid surface if the original resource would have been a valid surface had its array size been equal to 1.


Subresource surface objects implement the IDXGISurface2 interface, which inherits from IDXGISurface1 and indirectly IDXGISurface. Therefore, the GDI-interoperable methods of IDXGISurface1 work if the original resource interface object was created with the GDI-interoperable flag (D3D11_RESOURCE_MISC_GDI_COMPATIBLE).

CreateSubresourceSurface creates a subresource surface that is based on the resource interface on which CreateSubresourceSurface is called. For example, if the original resource interface object is a 2D texture, the created subresource surface is also a 2D texture.

You can use CreateSubresourceSurface to create parts of a stereo resource so you can use Direct2D on either the left or right part of the stereo resource.


Minimum supported client

Windows 8 and Platform Update for Windows 7 [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2012 and Platform Update for Windows Server 2008 R2 [desktop apps | Windows Store apps]

Minimum supported phone

Windows Phone 8





See also




© 2017 Microsoft