|Microsoft DirectX 9.0|
Associates data with the resource that is intended for use by the application, not by Microsoft?Direct3D? Data is passed by value, and multiple sets of data can be associated with a single resource.
REFGUID refguid, const void *pData, DWORD SizeOfData, DWORD Flags );
- [in] Reference to (C++) or address of (C) the globally unique identifier that identifies the private data to set.
- [in] Pointer to a buffer that contains the data to be associated with the resource.
- [in] Size of the buffer at pData, in bytes.
- [in] Value that describes the type of data being passed, or indicates to the application that the data should be invalidated when the resource changes.
- If no flags are specified, Direct3D allocates memory to hold the data within the buffer and copies the data into the new buffer. The buffer allocated by Direct3D is automatically freed, as appropriate.
- The data at pData is a pointer to an IUnknown interface. SizeOfData must be set to the size of a pointer to an IUnknown interface, sizeof(IUnknown*). Direct3D automatically calls IUnknown::AddRef through pData and IUnknown::Release when the private data is destroyed. Private data will be destroyed by a subsequent call to IDirect3DResource9::SetPrivateData with the same GUID, a subsequent call to IDirect3DResource9::FreePrivateData, or when the IDirect3D9 object is released. For more information, see Remarks.
If the method succeeds, the return value is D3D_OK.
If the method fails, the return value can be one of the following values.
D3DERR_INVALIDCALL The method call is invalid. For example, a method's parameter may have an invalid value. E_OUTOFMEMORY Direct3D could not allocate sufficient memory to complete the call.
Direct3D does not manage the memory at pData. If this buffer was dynamically allocated, it is the calling application's responsibility to free the memory.
IDirect3DResource9::FreePrivateData, IDirect3DBaseTexture9::FreePrivateData, IDirect3DCubeTexture9::FreePrivateData, IDirect3DTexture9::FreePrivateData, IDirect3DVolumeTexture9::FreePrivateData, IDirect3DIndexBuffer9::FreePrivateData, IDirect3DVertexBuffer9::FreePrivateData, IDirect3DResource9::GetPrivateData, IDirect3DBaseTexture9::GetPrivateData, IDirect3DCubeTexture9::GetPrivateData, IDirect3DTexture9::GetPrivateData, IDirect3DVolumeTexture9::FreePrivateData, IDirect3DIndexBuffer9::FreePrivateData, IDirect3DVertexBuffer9::FreePrivateData