// d3dumddi.h
PFND3DDDI_DEALLOCATECB Pfnd3dddiDeallocatecb;
HRESULT Pfnd3dddiDeallocatecb(
HANDLE hDevice,
const D3DDDICB_DEALLOCATE *unnamedParam2
)
{...}
View the official Windows Driver Kit DDI referenceNo description available.
The pfnDeallocateCb callback function releases allocations or a kernel-mode resource object if the resource object was created.
hDeviceA handle to the display device (graphics context).
unnamedParam2pData [in]
A pointer to a D3DDDICB_DEALLOCATE structure that describes the resource to release.
pfnDeallocateCb returns one of the following values:
| Return code | Description |
|---|---|
| S_OK | The memory was successfully released. |
| E_INVALIDARG | Parameters were validated and determined to be incorrect. |
This function might also return other HRESULT values.
The user-mode display driver can release allocations in the following ways:
Note that if the user-mode display driver sets hResource to NULL and populates all array elements in HandleList to release all allocations, the driver must subsequently call the pfnDeallocateCb function again to only release the resource by setting hResource to the handle to the resource.
Note that the pfnDeallocateCb function is distinct from the user-mode display driver's DestroyResource or DestroyResource(D3D10) function. However, the user-mode display driver typically calls pfnDeallocateCb in response to a call to its DestroyResource or DestroyResource(D3D10) function.
Direct3D Version 9 Note: For more information about creating and destroying resources, see Handling Resource Creation and Destruction.
Direct3D Version 11 Note: For more information about how the driver calls pfnDeallocateCb, see Changes from Direct3D 10.
The following code example shows how to release a resource.
D3DDDICB_DEALLOCATE deAllocCB;
HRESULT hr;
D3DKMT_HANDLE hKMAllocHandle;
memset(&deAllocCB, 0, sizeof(deAllocCB));
deAllocCB.hResource = m_hCurResRuntime;
hr = m_d3dCallbacks.pfnDeallocateCb(m_hD3D, &deAllocCB);
if ((m_hCurResRuntime) && (SUCCEEDED(hr))) {
m_bCurResFreed = TRUE;
}