ID3D11DeviceChild::SetPrivateData Method

Set application-defined data to a device child and associate that data with an application-defined guid.

Syntax

public:
HRESULT SetPrivateData(
         REFGUID guid,
         UINT DataSize,
         const void *pData
)  

Parameters

guid
Type: REFGUID 

[in] Guid associated with the data.

DataSize
Type: UINT 

[in] Size of the data.

pData
Type: void *

[in, optional] Pointer to the data to be stored with this device child. If pData is NULL, DataSize must also be 0, and any data previously associated with the specified guid will be destroyed.

Return value

Type: HRESULT 

This method returns one of the following Direct3D 11 return codes.

Remarks

On Xbox One, this method is superseded by ID3D11DeviceChild::SetName; use SetName instead of SetPrivateData.

The data stored in the device child with this method can be retrieved with ID3D11DeviceChild::GetPrivateData.

The Debug Layer reports memory leaks by outputting a list of object interface pointers along with their friendly names. The default friendly name is “<unnamed>”. You can set the friendly name so that you can determine if the corresponding object interface pointer caused the leak. To set the friendly name, use the SetPrivateData method and the WKPDID_D3DDebugObjectName GUID that is in D3Dcommon.h. For example, to give pContext a friendly name of My name, use the following code:

static const char c_szName[] = "My name";
hr = pContext->SetPrivateData( WKPDID_D3DDebugObjectName, sizeof( c_szName ) - 1, c_szName );  

Requirements

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

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

See also

ID3D11DeviceChild

ID3D11DeviceChild Members