• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef _NINE_ADAPTER9_H_
24 #define _NINE_ADAPTER9_H_
25 
26 #include "iunknown.h"
27 
28 #include "d3dadapter/d3dadapter9.h"
29 
30 struct pipe_screen;
31 struct pipe_resource;
32 
33 struct d3dadapter9_context
34 {
35     struct pipe_screen *hal, *ref;
36     D3DADAPTER_IDENTIFIER9 identifier;
37     BOOL linear_framebuffer;
38     BOOL throttling;
39     int throttling_value;
40     int vblank_mode;
41     BOOL thread_submit;
42     BOOL discard_delayed_release;
43     BOOL tearfree_discard;
44     int csmt_force;
45 
46     void (*destroy)( struct d3dadapter9_context *ctx );
47 };
48 
49 struct NineAdapter9
50 {
51     struct NineUnknown base;
52 
53     struct d3dadapter9_context *ctx;
54 };
55 static inline struct NineAdapter9 *
NineAdapter9(void * data)56 NineAdapter9( void *data )
57 {
58     return (struct NineAdapter9 *)data;
59 }
60 
61 HRESULT
62 NineAdapter9_new( struct d3dadapter9_context *pCTX,
63                   struct NineAdapter9 **ppOut );
64 
65 HRESULT
66 NineAdapter9_ctor( struct NineAdapter9 *This,
67                    struct NineUnknownParams *pParams,
68                    struct d3dadapter9_context *pCTX );
69 
70 void
71 NineAdapter9_dtor( struct NineAdapter9 *This );
72 
73 HRESULT NINE_WINAPI
74 NineAdapter9_GetAdapterIdentifier( struct NineAdapter9 *This,
75                                    DWORD Flags,
76                                    D3DADAPTER_IDENTIFIER9 *pIdentifier );
77 
78 HRESULT NINE_WINAPI
79 NineAdapter9_CheckDeviceType( struct NineAdapter9 *This,
80                               D3DDEVTYPE DevType,
81                               D3DFORMAT AdapterFormat,
82                               D3DFORMAT BackBufferFormat,
83                               BOOL bWindowed );
84 
85 HRESULT NINE_WINAPI
86 NineAdapter9_CheckDeviceFormat( struct NineAdapter9 *This,
87                                 D3DDEVTYPE DeviceType,
88                                 D3DFORMAT AdapterFormat,
89                                 DWORD Usage,
90                                 D3DRESOURCETYPE RType,
91                                 D3DFORMAT CheckFormat );
92 
93 HRESULT NINE_WINAPI
94 NineAdapter9_CheckDeviceMultiSampleType( struct NineAdapter9 *This,
95                                          D3DDEVTYPE DeviceType,
96                                          D3DFORMAT SurfaceFormat,
97                                          BOOL Windowed,
98                                          D3DMULTISAMPLE_TYPE MultiSampleType,
99                                          DWORD *pQualityLevels );
100 
101 HRESULT NINE_WINAPI
102 NineAdapter9_CheckDepthStencilMatch( struct NineAdapter9 *This,
103                                      D3DDEVTYPE DeviceType,
104                                      D3DFORMAT AdapterFormat,
105                                      D3DFORMAT RenderTargetFormat,
106                                      D3DFORMAT DepthStencilFormat );
107 
108 HRESULT NINE_WINAPI
109 NineAdapter9_CheckDeviceFormatConversion( struct NineAdapter9 *This,
110                                           D3DDEVTYPE DeviceType,
111                                           D3DFORMAT SourceFormat,
112                                           D3DFORMAT TargetFormat );
113 
114 HRESULT NINE_WINAPI
115 NineAdapter9_GetDeviceCaps( struct NineAdapter9 *This,
116                             D3DDEVTYPE DeviceType,
117                             D3DCAPS9 *pCaps );
118 
119 HRESULT NINE_WINAPI
120 NineAdapter9_CreateDevice( struct NineAdapter9 *This,
121                            UINT RealAdapter,
122                            D3DDEVTYPE DeviceType,
123                            HWND hFocusWindow,
124                            DWORD BehaviorFlags,
125                            D3DPRESENT_PARAMETERS *pPresentationParameters,
126                            IDirect3D9 *pD3D9,
127                            ID3DPresentGroup *pPresentationGroup,
128                            IDirect3DDevice9 **ppReturnedDeviceInterface );
129 
130 HRESULT NINE_WINAPI
131 NineAdapter9_CreateDeviceEx( struct NineAdapter9 *This,
132                              UINT RealAdapter,
133                              D3DDEVTYPE DeviceType,
134                              HWND hFocusWindow,
135                              DWORD BehaviorFlags,
136                              D3DPRESENT_PARAMETERS *pPresentationParameters,
137                              D3DDISPLAYMODEEX *pFullscreenDisplayMode,
138                              IDirect3D9Ex *pD3D9Ex,
139                              ID3DPresentGroup *pPresentationGroup,
140                              IDirect3DDevice9Ex **ppReturnedDeviceInterface );
141 
142 #endif /* _NINE_ADAPTER9_H_ */
143