?/TD>
Microsoft DirectX 9.0

D3DPRESENT_PARAMETERS Structure


Describes the presentation parameters.

Syntax

typedef struct _D3DPRESENT_PARAMETERS_ {
    UINT BackBufferWidth, BackBufferHeight;
    D3DFORMAT BackBufferFormat;
    UINT BackBufferCount;
    D3DMULTISAMPLE_TYPE MultiSampleType;
    DWORD MultiSampleQuality;
    D3DSWAPEFFECT SwapEffect;
    HWND hDeviceWindow;
    BOOL Windowed;
    BOOL EnableAutoDepthStencil;
    D3DFORMAT AutoDepthStencilFormat;
    DWORD Flags;
    UINT FullScreen_RefreshRateInHz;
    UINT PresentationInterval;
} D3DPRESENT_PARAMETERS;

Members

BackBufferWidth, BackBufferHeight

Width and height of the new swap chain's back buffers, in pixels. If Windowed is FALSE (the presentation is full-screen), these values must equal the width and height of one of the enumerated display modes found through IDirect3D9::EnumAdapterModes. If Windowed is TRUE and either of these values is zero, the corresponding dimension of the client area of the hDeviceWindow (or the focus window, if hDeviceWindow is NULL) is taken.

BackBufferFormat

The back buffer format. For more information about formats, see D3DFORMAT. This value must be one of the render target formats as validated by IDirect3D9::CheckDeviceType. You can use IDirect3DDevice9::GetDisplayMode to obtain the current format.

In fact, D3DFMT_UNKNOWN can be specified for the BackBufferFormat while in windowed mode. This tells the runtime to use the current display-mode format and eliminates the need to call IDirect3DDevice9::GetDisplayMode.

For windowed applications, the back buffer format no longer needs to match the display-mode format because color conversion can now be done by the hardware (if the hardware supports color conversion). The set of possible back buffer formats is constrained, but the runtime will allow any valid back buffer format to be presented to any desktop format. (There is the additional requirement that the device be operable in the desktop mode; devices typically do not operate in 8 bits per pixel modes.)

Full-screen applications cannot do color conversion.

BackBufferCount

This value can be 0 (or 1), 2, or 3. 0 is treated as 1. If the number of back buffers cannot be created, the runtime will fail the method call and fill this value with the number of back buffers that could be created. As a result, an application can call the method twice with the same D3DPRESENT_PARAMETERS structure and expect it to work the second time.

The method fails if one back buffer cannot be created. The value of BackBufferCount influences what set of swap effects are allowed. Specifically, any D3DSWAPEFFECT_COPY swap effect requires that there be exactly one back buffer.

MultiSampleType

Member of the D3DMULTISAMPLE_TYPE enumerated type. The value must be D3DMULTISAMPLE_NONE unless SwapEffect has been set to D3DSWAPEFFECT_DISCARD. Multisampling is supported only if the swap effect is D3DSWAPEFFECT_DISCARD.

MultiSampleQuality
Quality level. The valid range is between zero and one less than the level returned by pQualityLevels used by IDirect3D9::CheckDeviceMultiSampleType. Passing a larger value returns the error D3DERR_INVALIDCALL. Paired values of render targets or depth stencil surfaces, and D3DMULTISAMPLE_TYPE must match.

SwapEffect

Member of the D3DSWAPEFFECT enumerated type. The runtime will guarantee the implied semantics concerning buffer swap behavior. So if Windowed is TRUE and SwapEffect is set to D3DSWAPEFFECT_FLIP, the runtime will create one extra back buffer, and copy whichever becomes the front buffer at presentation time.

D3DSWAPEFFECT_COPY requires that BackBufferCount be set to 1.

D3DSWAPEFFECT_DISCARD will be enforced in the debug runtime by filling any buffer with noise after it is presented.

hDeviceWindow

If full-screen, this is the cover window. If windowed, this will be the default target window for IDirect3DDevice9::Present. If this value is NULL, the focus window will be taken. For applications that use multiple full-screen devices, such as a multimonitor system, exactly one device should use the focus window as the device window. All other devices should have unique device windows. Otherwise, behavior is undefined and applications will not work as expected.

Note that no attempt is made by the runtime to reflect user changes in window size. The back buffer is not implicitly reset when this window is reset. However, the IDirect3DDevice9::Present method does automatically track window position changes.

Windowed

TRUE if the application runs windowed; FALSE if the application runs full-screen.

EnableAutoDepthStencil

If this value is TRUE, Microsoft?Direct3D?will manage depth buffers for the application. The device will create a depth-stencil buffer when it is created. The depth-stencil buffer will be automatically set as the render target of the device. When the device is reset, the depth-stencil buffer will be automatically destroyed and re-created in the new size.

If EnableAutoDepthStencil is TRUE, then AutoDepthStencilFormat must be a valid depth-stencil format.

AutoDepthStencilFormat

Member of the D3DFORMAT enumerated type. The format of the automatic depth-stencil surface that the device will create. This member is ignored unless EnableAutoDepthStencil is TRUE.

Flags

One of the D3DPRESENTFLAG.

FullScreen_RefreshRateInHz

The rate at which the display adapter refreshes the screen. For windowed mode, this value must be 0. Otherwise, this value must be one of the refresh rates returned by IDirect3D9::EnumAdapterModes or one of the following values.

D3DPRESENT_RATE_DEFAULT
The runtime chooses the presentation rate or adopts the current rate, if windowed.
PresentationInterval

Refer to D3DPRESENT for a list of possible values and their meanings.

A windowed swap chain can use one of the following values: D3DPRESENT_INTERVAL_DEFAULT, D3DPRESENT_INTERVAL_ONE (this is equivalent to D3DPRESENT_INTERVAL_DEFAULT), or D3DPRESENT_INTERVAL_IMMEDIATE.

For a full-screen swap chain, the value can be D3DPRESENT_INTERVAL_DEFAULT or the value corresponding to exactly one of the flags enumerated in the PresentationIntervals member in D3DCAPS9. Note that for a full-screen swap chain, D3DPRESENT_INTERVAL_IMMEDIATE is always a valid option. If this presentation interval is selected and the driver does not support an immediate page-flipping operation, the runtime will implement an IDirect3DDevice9::Present operation by copying the back buffer contents to the front buffer using a blit operation.

Structure Information

Headerd3d9types.h
Minimum operating systems Windows 98

See Also

IDirect3D9::CreateDevice, IDirect3DDevice9::CreateAdditionalSwapChain, IDirect3DDevice9::Present, IDirect3DDevice9::Reset


© 2002 Microsoft Corporation. All rights reserved.