7207b585f08b2209fb9dd3905c400876e2e08a9c
[mesa.git] / src / gallium / state_trackers / nine / swapchain9ex.c
1 /*
2 * Copyright 2011 Joakim Sindholt <opensource@zhasha.com>
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * on the rights to use, copy, modify, merge, publish, distribute, sub
8 * license, and/or sell copies of the Software, and to permit persons to whom
9 * the Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21 * USE OR OTHER DEALINGS IN THE SOFTWARE. */
22
23 #include "swapchain9ex.h"
24 #include "device9.h"
25
26 #include "nine_helpers.h"
27
28 #define DBG_CHANNEL DBG_SWAPCHAIN
29
30 static HRESULT
31 NineSwapChain9Ex_ctor( struct NineSwapChain9Ex *This,
32 struct NineUnknownParams *pParams,
33 BOOL implicit,
34 ID3DPresent *pPresent,
35 D3DPRESENT_PARAMETERS *pPresentationParameters,
36 struct d3dadapter9_context *pCTX,
37 HWND hFocusWindow,
38 D3DDISPLAYMODEEX *mode )
39 {
40 return NineSwapChain9_ctor(&This->base, pParams, implicit, pPresent,
41 pPresentationParameters, pCTX, hFocusWindow, mode);
42 }
43
44 static void
45 NineSwapChain9Ex_dtor( struct NineSwapChain9Ex *This )
46 {
47 NineSwapChain9_dtor(&This->base);
48 }
49
50 HRESULT WINAPI
51 NineSwapChain9Ex_GetLastPresentCount( struct NineSwapChain9Ex *This,
52 UINT *pLastPresentCount )
53 {
54 STUB(D3DERR_INVALIDCALL);
55 }
56
57 HRESULT WINAPI
58 NineSwapChain9Ex_GetPresentStats( struct NineSwapChain9Ex *This,
59 D3DPRESENTSTATS *pPresentationStatistics )
60 {
61 STUB(D3DERR_INVALIDCALL);
62 }
63
64 HRESULT WINAPI
65 NineSwapChain9Ex_GetDisplayModeEx( struct NineSwapChain9Ex *This,
66 D3DDISPLAYMODEEX *pMode,
67 D3DDISPLAYROTATION *pRotation )
68 {
69 D3DDISPLAYROTATION rot;
70
71 user_assert(pMode != NULL, E_POINTER);
72 if (!pRotation) { pRotation = &rot; }
73
74 return ID3DPresent_GetDisplayMode(This->base.present, pMode, pRotation);
75 }
76
77 IDirect3DSwapChain9ExVtbl NineSwapChain9Ex_vtable = {
78 (void *)NineUnknown_QueryInterface,
79 (void *)NineUnknown_AddRef,
80 (void *)NineUnknown_Release,
81 (void *)NineSwapChain9_Present,
82 (void *)NineSwapChain9_GetFrontBufferData,
83 (void *)NineSwapChain9_GetBackBuffer,
84 (void *)NineSwapChain9_GetRasterStatus,
85 (void *)NineSwapChain9_GetDisplayMode,
86 (void *)NineUnknown_GetDevice, /* actually part of NineSwapChain9 iface */
87 (void *)NineSwapChain9_GetPresentParameters,
88 (void *)NineSwapChain9Ex_GetLastPresentCount,
89 (void *)NineSwapChain9Ex_GetPresentStats,
90 (void *)NineSwapChain9Ex_GetDisplayModeEx
91 };
92
93 static const GUID *NineSwapChain9Ex_IIDs[] = {
94 &IID_IDirect3DSwapChain9Ex,
95 &IID_IDirect3DSwapChain9,
96 &IID_IUnknown,
97 NULL
98 };
99
100 HRESULT
101 NineSwapChain9Ex_new( struct NineDevice9 *pDevice,
102 BOOL implicit,
103 ID3DPresent *pPresent,
104 D3DPRESENT_PARAMETERS *pPresentationParameters,
105 struct d3dadapter9_context *pCTX,
106 HWND hFocusWindow,
107 D3DDISPLAYMODEEX *mode,
108 struct NineSwapChain9Ex **ppOut )
109 {
110 NINE_DEVICE_CHILD_NEW(SwapChain9Ex, ppOut, pDevice, /* args */
111 implicit, pPresent, pPresentationParameters,
112 pCTX, hFocusWindow, mode);
113 }