IDXGIDevice::CreateSurface Method

Returns a surface. This method is used internally and you should not call it directly in your application.

Syntax

public:
HRESULT CreateSurface(
         const DXGI_SURFACE_DESC *pDesc,
         UINT NumSurfaces,
         DXGI_USAGE Usage,
         const DXGI_SHARED_RESOURCE *pSharedResource,
         IDXGISurface **ppSurface
)  

Parameters

pDesc
Type: DXGI_SURFACE_DESC *

[in] A pointer to a DXGI_SURFACE_DESC structure that describes the surface.

NumSurfaces
Type: UINT 

The number of surfaces to create.

Usage
Type: DXGI_USAGE 

A DXGI_USAGE flag that specifies how the surface is expected to be used.

pSharedResource
Type: DXGI_SHARED_RESOURCE *

[in, optional] An optional pointer to a DXGI_SHARED_RESOURCE structure that contains shared resource information for opening views of such resources.

ppSurface
Type: IDXGISurface **

[out] The address of an IDXGISurface interface pointer to the first created surface.

Return value

Type: HRESULT 

Returns S_OK if successful; an error code otherwise. For a list of error codes, see DXGI_ERROR.

Remarks

The CreateSurface method creates a buffer to exchange data between one or more devices. It is used internally, and you should not directly call it.

The runtime automatically creates an IDXGISurface interface when it creates a Direct3D resource object that represents a surface. For example, the runtime creates an IDXGISurface interface when it calls ID3D11Device::CreateTexture2D or ID3D10Device::CreateTexture2D to create a 2D texture. To retrieve the IDXGISurface interface that represents the 2D texture surface, call ID3D11Texture2D::QueryInterface or ID3D10Texture2D::QueryInterface. In this call, you must pass the identifier of IDXGISurface. If the 2D texture has only a single MIP-map level and does not consist of an array of textures, QueryInterface succeeds and returns a pointer to the IDXGISurface interface pointer. Otherwise, QueryInterface fails and does not return the pointer to IDXGISurface.

Requirements

Header: Declared in d3d11_x.h (dxgi.h on other Windows platforms).

Library: Use d3d11_x.lib (dxgi.lib on other Windows platforms).

See also

IDXGIDevice

IDXGIDevice Members