ID3D11Device::SetPrivateData Method

Set data to a device and associate that data with a guid.

Syntax

HRESULT SetPrivateData(
  [in]  REFGUID guid,
  [in]  UINT DataSize,
  [in]  const void *pData
);

Parameter

  • guid [in]
    Typ: REFGUID

    Guid associated with the data.

  • DataSize [in]
    Typ: UINT

    Size of the data.

  • pData [in]
    Typ: const void*

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

Rückgabewert

Typ: HRESULT

This method returns one of the following Direct3D 11 Return Codes.

Hinweise

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

The data and guid set with this method will typically be application-defined.

If an application uses this method to change the device type using GUID_DeviceType, results are undefined. However, GUID_DeviceType can be used to retrieve the device type using ID3D11Device::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 );

Anforderungen

Header

D3D11.h

Bibliothek

D3D11.lib

Siehe auch

ID3D11Device