Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

ID3DDestructionNotifier::RegisterDestructionCallback method (d3dcommon.h)

Registers a user-defined callback to be invoked on destruction of the object from which this ID3DDestructionNotifier was created.

Syntax

HRESULT RegisterDestructionCallback(
 PFN_DESTRUCTION_CALLBACK callbackFn,
 void *pData,
 UINT *pCallbackID
);

Parameters

callbackFn

Type: PFN_DESTRUCTION_CALLBACK

A user-defined callback to be invoked when the object is destroyed.

pData

Type: void*

The data to pass to callbackFn when invoked

pCallbackID

Type: UINT*

Pointer to a UINT used to identify the callback, and to pass to to unregister the callback.

Return value

Type: HRESULT

If this function succeeds, it returns S_OK.

Remarks

An example of this interface being used to log the destruction of an ID3D12Resource.

#include <d3dcommon.h> // for ID3DDestructionNotifier

ComPtr<ID3D12Resource> resource = ...;

ComPtr<ID3DDestructionNotifier> notifier;
if (SUCCEEDED(resource.As(&notifier)))
{
 UINT callbackId;
 ThrowIfFailed(notifier->RegisterDestructionCallback(LogResourceReleased, nullptr, &callbackId));
}

void LogResourceReleased(void* context)
{
 OutputDebugString("Resource released!\n");
}

Requirements

Requirement Value
Target Platform Windows
Header d3dcommon.h

See also

ID3DDestructionNotifier

ID3DDestructionNotifier::UnregisterDestructionCallback


Feedback

Was this page helpful?

Additional resources