Partager via


pfnCreateContextCb routine

The pfnCreateContextCb function creates a new graphics processing unit (GPU) thread of execution on the specified device.

Syntax

PFND3DDDI_CREATECONTEXTCB pfnCreateContextCb;

__checkReturn HRESULT APIENTRY CALLBACK pfnCreateContextCb(
  _In_    HANDLE                 hDevice,
  _Inout_ D3DDDICB_CREATECONTEXT *pData
)
{ ... }

Parameters

  • hDevice [in]
    A handle to the display device (that is, the graphics context).

  • pData [in, out]
    A pointer to a D3DDDICB_CREATECONTEXT structure that describes the context to create.

Return value

pfnCreateContextCb returns one of the following values:

Return code Description
S_OK

The context was successfully created.

E_OUTOFMEMORY

pfnCreateContextCb could not allocate memory that was required for it to complete.

E_INVALIDARG

Parameters were validated and determined to be incorrect.

 

This function might also return other HRESULT values.

Remarks

The pfnCreateContextCb function returns a handle to the newly created context in the hContext member of the D3DDDICB_CREATECONTEXT structure that the pData parameter points to. The user-mode display driver passes this handle in calls to the following functions:

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

The following code example shows how to create a default context for a display device.

    D3DDDICB_CREATECONTEXT CreateContext;
    HRESULT                hr;
    ZeroMemory(&CreateContext, sizeof(CreateContext));

    if (NULL != m_d3dCallbacks.pfnCreateContextCb) {
        CreateContext.NodeOrdinal = 0;
        CreateContext.EngineAffinity = 1;

        hr = m_d3dCallbacks.pfnCreateContextCb(m_hD3D, &CreateContext);
        if (FAILED(hr)) {
            DBG_BREAK;
            return FALSE;
        }
    }

Requirements

Target platform

Version

Available in Windows Vista and later versions of the Windows operating systems.

Header

D3dumddi.h (include D3dumddi.h)

See also

D3DDDICB_CREATECONTEXT

D3DDDI_DEVICECALLBACKS

pfnDestroyContextCb

pfnEscapeCb

pfnPresentCb

pfnRenderCb

pfnSignalSynchronizationObjectCb

pfnWaitForSynchronizationObjectCb

 

 

Send comments about this topic to Microsoft