PFND3DDDI_PRESENTCB callback function (d3dumddi.h)

The pfnPresentCb function copies content from a source allocation.

Syntax

PFND3DDDI_PRESENTCB Pfnd3dddiPresentcb;

HRESULT Pfnd3dddiPresentcb(
  HANDLE hDevice,
  D3DDDICB_PRESENT *unnamedParam2
)
{...}

Parameters

hDevice

A handle to a display device (graphics context).

unnamedParam2

pData [in]

A pointer to a D3DDDICB_PRESENT structure that describes the source allocation that content is copied from.

Return value

pfnPresentCb returns one of the following values:

Return code Description
S_OK Content was successfully copied.
E_OUTOFMEMORY pfnPresentCb could not complete because of insufficient memory.
E_INVALIDARG Parameters were validated and determined to be incorrect.

This function might also return other HRESULT values.

Remarks

The user-mode display driver sets the hContext member of the D3DDDICB_PRESENT structure that is pointed to by the pData parameter to a context that it previously created by calling the pfnCreateContextCb function. The user-mode display driver must create at least one context when the Microsoft Direct3D runtime calls the driver's CreateDevice or CreateDevice(D3D10) function to create a device. The Direct3D runtime sends the present operation to a created context.

Direct3D Version 11 Note:  For more information about how the driver calls pfnPresentCb, see Changes from Direct3D 10.

Examples

The following code example shows how to color-fill a destination surface.

    HRESULT hr=S_OK;
    // A color-fill request that does not have a source surface
    D3DDDICB_PRESENT    PresentCBData = {0};

    PresentCBData.hContext = m_sContexts[MULTI_ENGINE_NODE_3D].hContext;
    PresentCBData.hSrcAllocation = NULL;

    if (pPresent->hDstResource) {
        DWORD   dwDstSurf = ((DWORD)(DWORD_PTR)pPresent->hDstResource) + pPresent->DstSubResourceIndex;
        _ASSERT(dwDstSurf < m_RTbl.Size());
        m_RTbl[dwDstSurf].m_qwBatch = m_qwBatch;
        PresentCBData.hDstAllocation = R200GetSurfaceAllocHandle(m_pR200Ctx, dwDstSurf);
    }

    hr = m_d3dCallbacks.pfnPresentCb(m_hD3D, &PresentCBData);

    return hr;

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

CreateDevice

CreateDevice(D3D10)

D3DDDICB_PRESENT

D3DDDI_DEVICECALLBACKS

pfnCreateContextCb