Bewerken

Delen via


PFND3DDDI_DEALLOCATECB callback function (d3dumddi.h)

The pfnDeallocateCb callback function releases allocations or a kernel-mode resource object if the resource object was created.

Syntax

PFND3DDDI_DEALLOCATECB Pfnd3dddiDeallocatecb;

HRESULT Pfnd3dddiDeallocatecb(
  HANDLE hDevice,
  const D3DDDICB_DEALLOCATE *unnamedParam2
)
{...}

Parameters

hDevice

A handle to the display device (graphics context).

unnamedParam2

pData [in]

A pointer to a D3DDDICB_DEALLOCATE structure that describes the resource to release.

Return value

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.

Remarks

The user-mode display driver can release allocations in the following ways:

  • Individually, by setting the hResource member of the D3DDDICB_DEALLOCATE structure that is pointed to by pData to NULL and populating the array in the HandleList member of D3DDDICB_DEALLOCATE with handles of the allocations to release
  • In a group, by setting hResource to a resource handle whose allocations are to be released. If hResource is non-NULL, the HandleList and NumAllocations members of D3DDDICB_DEALLOCATE are ignored.
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;
    }

Requirements

Requirement Value
Minimum supported client Available in Windows Vista and later versions of the Windows operating systems.
Target Platform Desktop
Header d3dumddi.h (include D3dumddi.h)

See also

D3DDDICB_DEALLOCATE

D3DDDI_DEVICECALLBACKS

DestroyResource

DestroyResource(D3D10)

pfnAllocateCb