1 /*
2 * Copyright 2011 Joakim Sindholt <[email protected]>
3 * SPDX-License-Identifier: MIT
4 */
5
6 #include "swapchain9ex.h"
7 #include "device9.h"
8
9 #include "nine_helpers.h"
10
11 #define DBG_CHANNEL DBG_SWAPCHAIN
12
13 static HRESULT
NineSwapChain9Ex_ctor(struct NineSwapChain9Ex * This,struct NineUnknownParams * pParams,BOOL implicit,ID3DPresent * pPresent,D3DPRESENT_PARAMETERS * pPresentationParameters,struct d3dadapter9_context * pCTX,HWND hFocusWindow,D3DDISPLAYMODEEX * mode)14 NineSwapChain9Ex_ctor( struct NineSwapChain9Ex *This,
15 struct NineUnknownParams *pParams,
16 BOOL implicit,
17 ID3DPresent *pPresent,
18 D3DPRESENT_PARAMETERS *pPresentationParameters,
19 struct d3dadapter9_context *pCTX,
20 HWND hFocusWindow,
21 D3DDISPLAYMODEEX *mode )
22 {
23 DBG("This=%p pParams=%p implicit=%d pPresent=%p pPresentationParameters=%p "
24 "pCTX=%p hFocusWindow=%p mode=%p",
25 This, pParams, (int) implicit, pPresent, pPresentationParameters, pCTX, hFocusWindow, mode);
26
27 return NineSwapChain9_ctor(&This->base, pParams, implicit, pPresent,
28 pPresentationParameters, pCTX, hFocusWindow, mode);
29 }
30
31 static void
NineSwapChain9Ex_dtor(struct NineSwapChain9Ex * This)32 NineSwapChain9Ex_dtor( struct NineSwapChain9Ex *This )
33 {
34 NineSwapChain9_dtor(&This->base);
35 }
36
37 HRESULT NINE_WINAPI
NineSwapChain9Ex_GetLastPresentCount(struct NineSwapChain9Ex * This,UINT * pLastPresentCount)38 NineSwapChain9Ex_GetLastPresentCount( struct NineSwapChain9Ex *This,
39 UINT *pLastPresentCount )
40 {
41 STUB(D3DERR_INVALIDCALL);
42 }
43
44 HRESULT NINE_WINAPI
NineSwapChain9Ex_GetPresentStats(struct NineSwapChain9Ex * This,D3DPRESENTSTATS * pPresentationStatistics)45 NineSwapChain9Ex_GetPresentStats( struct NineSwapChain9Ex *This,
46 D3DPRESENTSTATS *pPresentationStatistics )
47 {
48 STUB(D3DERR_INVALIDCALL);
49 }
50
51 HRESULT NINE_WINAPI
NineSwapChain9Ex_GetDisplayModeEx(struct NineSwapChain9Ex * This,D3DDISPLAYMODEEX * pMode,D3DDISPLAYROTATION * pRotation)52 NineSwapChain9Ex_GetDisplayModeEx( struct NineSwapChain9Ex *This,
53 D3DDISPLAYMODEEX *pMode,
54 D3DDISPLAYROTATION *pRotation )
55 {
56 D3DDISPLAYROTATION rot;
57
58 user_assert(pMode != NULL, E_POINTER);
59 if (!pRotation) { pRotation = &rot; }
60
61 return ID3DPresent_GetDisplayMode(This->base.present, pMode, pRotation);
62 }
63
64 IDirect3DSwapChain9ExVtbl NineSwapChain9Ex_vtable = {
65 (void *)NineUnknown_QueryInterface,
66 (void *)NineUnknown_AddRef,
67 (void *)NineUnknown_Release,
68 (void *)NineSwapChain9_Present,
69 (void *)NineSwapChain9_GetFrontBufferData,
70 (void *)NineSwapChain9_GetBackBuffer,
71 (void *)NineSwapChain9_GetRasterStatus,
72 (void *)NineSwapChain9_GetDisplayMode,
73 (void *)NineUnknown_GetDevice, /* actually part of NineSwapChain9 iface */
74 (void *)NineSwapChain9_GetPresentParameters,
75 (void *)NineSwapChain9Ex_GetLastPresentCount,
76 (void *)NineSwapChain9Ex_GetPresentStats,
77 (void *)NineSwapChain9Ex_GetDisplayModeEx
78 };
79
80 static const GUID *NineSwapChain9Ex_IIDs[] = {
81 &IID_IDirect3DSwapChain9Ex,
82 &IID_IDirect3DSwapChain9,
83 &IID_IUnknown,
84 NULL
85 };
86
87 HRESULT
NineSwapChain9Ex_new(struct NineDevice9 * pDevice,BOOL implicit,ID3DPresent * pPresent,D3DPRESENT_PARAMETERS * pPresentationParameters,struct d3dadapter9_context * pCTX,HWND hFocusWindow,D3DDISPLAYMODEEX * mode,struct NineSwapChain9Ex ** ppOut)88 NineSwapChain9Ex_new( struct NineDevice9 *pDevice,
89 BOOL implicit,
90 ID3DPresent *pPresent,
91 D3DPRESENT_PARAMETERS *pPresentationParameters,
92 struct d3dadapter9_context *pCTX,
93 HWND hFocusWindow,
94 D3DDISPLAYMODEEX *mode,
95 struct NineSwapChain9Ex **ppOut )
96 {
97 NINE_DEVICE_CHILD_NEW(SwapChain9Ex, ppOut, pDevice, /* args */
98 implicit, pPresent, pPresentationParameters,
99 pCTX, hFocusWindow, mode);
100 }
101