Skip to content

Latest commit

 

History

History
124 lines (85 loc) · 5.25 KB

nc-d3dumddi-pfnd3dddi_setdisplaymodecb.md

File metadata and controls

124 lines (85 loc) · 5.25 KB
UID title description old-location tech.root ms.date keywords ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames f1_keywords topic_type api_type api_location api_name
NC:d3dumddi.PFND3DDDI_SETDISPLAYMODECB
PFND3DDDI_SETDISPLAYMODECB (d3dumddi.h)
The pfnSetDisplayModeCb function sets the allocation that is used to scan out to the display.
display\pfnsetdisplaymodecb.htm
display
05/10/2018
PFND3DDDI_SETDISPLAYMODECB callback function
D3Druntime_Functions_717329e1-853d-498e-8792-ba6468825cbb.xml, PFND3DDDI_SETDISPLAYMODECB, PFND3DDDI_SETDISPLAYMODECB callback, d3dumddi/pfnSetDisplayModeCb, display.pfnsetdisplaymodecb, pfnSetDisplayModeCb, pfnSetDisplayModeCb callback function [Display Devices]
d3dumddi.h
D3dumddi.h
Desktop
Available in Windows Vista and later versions of the Windows operating systems.
Windows
PFND3DDDI_SETDISPLAYMODECB
d3dumddi/PFND3DDDI_SETDISPLAYMODECB
APIRef
kbSyntax
UserDefined
d3dumddi.h
PFND3DDDI_SETDISPLAYMODECB

PFND3DDDI_SETDISPLAYMODECB callback function

-description

The pfnSetDisplayModeCb function sets the allocation that is used to scan out to the display.

-parameters

-param hDevice

A handle to the display device (graphics context).

-param unnamedParam2

pData [in, out]

A pointer to a D3DDDICB_SETDISPLAYMODE structure that describes the allocation that is used to scan out.

-returns

pfnSetDisplayModeCb returns one of the following values:

Return code Description
S_OK The display mode was successfully set.
E_INVALIDARG Parameters were validated and determined to be incorrect.
D3DDDIERR_INCOMPATIBLEPRIVATEFORMAT The user-mode display driver must convert the format of the surface that is associated with the allocation that the hPrimaryAllocation member of D3DDDICB_SETDISPLAYMODE specifies into the format attribute that the PrivateDriverFormatAttributemember of D3DDDICB_SETDISPLAYMODE specifies. The driver should then call pfnSetDisplayModeCb again. The driver could allocate a new allocation, perform a conversion bit-block transfer (bitblt) from the old primary surface to the new, and then destroy the old primary as long as the driver uses the new allocation handle for this allocation for all subsequent operations. The driver should repeat this process until pfnSetDisplayModeCb returns a different return value.

This function might also return other HRESULT values.

-remarks

After the Microsoft Direct3D runtime calls the user-mode display driver's SetDisplayMode or SetDisplayModeDXGI function to set the primary surface to be scanned out to the display, the user-mode display driver calls the pfnSetDisplayModeCb function to set the underlying primary allocation that is used for scanning out.

Note  Before the user-mode display driver calls pfnSetDisplayModeCb to set a new display mode that uses an extended format, a multiple-sampling method, or both, the driver must ensure that the current GDI display mode has the same resolution as the new display mode; otherwise, pfnSetDisplayModeCb returns E_INVALIDARG.
 

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

Examples

The following code example shows how to set the allocation for scanning out to the display.

HRESULT CD3DContext::SetDisplayMode(CONST D3DDDIARG_SETDISPLAYMODE* pSetDisplayMode) {
    DWORD   dwSrcSurf = ((DWORD)(DWORD_PTR)pSetDisplayMode->hResource) + pSetDisplayMode->SubResourceIndex;
    HRESULT hr;
    // Timestamp the source surface
    m_RTbl[dwSrcSurf].m_qwBatch = m_qwBatch;
    // Send the presentation request to the display miniport driver
    D3DDDICB_SETDISPLAYMODE SetDisplayModeCBData = {0};

    SetDisplayModeCBData.hPrimaryAllocation = R200GetSurfaceAllocHandle(m_pR200Ctx,
                                        dwSrcSurf);

    hr = m_d3dCallbacks.pfnSetDisplayModeCb(m_hD3D, &SetDisplayModeCBData);

    return (hr);
}

-see-also

D3DDDICB_SETDISPLAYMODE

D3DDDI_DEVICECALLBACKS

SetDisplayMode

SetDisplayModeDXGI