Sets application-defined data to the object and associates that data with a GUID.
- Name [in]
A GUID that identifies the data. Use this GUID in a call to GetPrivateData to get the data.
- DataSize [in]
The size of the object's data.
- pData [in]
Type: const void*
A pointer to the object's data.
Returns one of the DXGI_ERROR values.
SetPrivateData makes a copy of the specified data and stores it with the object.
Private data that SetPrivateData stores in the object occupies the same storage space as private data that is stored by associated Direct3D objects (for example, by a Microsoft Direct3D 11 device through ID3D11Device::SetPrivateData or by a Direct3D 11 child device through ID3D11DeviceChild::SetPrivateData).
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 well-known private data GUID (WKPDID_D3DDebugObjectName) 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 );
You can use WKPDID_D3DDebugObjectName to track down memory leaks and understand performance characteristics of your applications. This information is reflected in the output of the debug layer that is related to memory leaks (ID3D11Debug::ReportLiveDeviceObjects) and with the event tracing for Windows events that we've added to Windows 8.
Windows Phone 8: This API is supported.