• 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     BOOL dynamic_texture_workaround;
46     BOOL shader_inline_constants;
47 
48     void (*destroy)( struct d3dadapter9_context *ctx );
49 };
50 
51 struct NineAdapter9
52 {
53     struct NineUnknown base;
54 
55     struct d3dadapter9_context *ctx;
56 };
57 static inline struct NineAdapter9 *
NineAdapter9(void * data)58 NineAdapter9( void *data )
59 {
60     return (struct NineAdapter9 *)data;
61 }
62 
63 HRESULT
64 NineAdapter9_new( struct d3dadapter9_context *pCTX,
65                   struct NineAdapter9 **ppOut );
66 
67 HRESULT
68 NineAdapter9_ctor( struct NineAdapter9 *This,
69                    struct NineUnknownParams *pParams,
70                    struct d3dadapter9_context *pCTX );
71 
72 void
73 NineAdapter9_dtor( struct NineAdapter9 *This );
74 
75 HRESULT NINE_WINAPI
76 NineAdapter9_GetAdapterIdentifier( struct NineAdapter9 *This,
77                                    DWORD Flags,
78                                    D3DADAPTER_IDENTIFIER9 *pIdentifier );
79 
80 HRESULT NINE_WINAPI
81 NineAdapter9_CheckDeviceType( struct NineAdapter9 *This,
82                               D3DDEVTYPE DevType,
83                               D3DFORMAT AdapterFormat,
84                               D3DFORMAT BackBufferFormat,
85                               BOOL bWindowed );
86 
87 HRESULT NINE_WINAPI
88 NineAdapter9_CheckDeviceFormat( struct NineAdapter9 *This,
89                                 D3DDEVTYPE DeviceType,
90                                 D3DFORMAT AdapterFormat,
91                                 DWORD Usage,
92                                 D3DRESOURCETYPE RType,
93                                 D3DFORMAT CheckFormat );
94 
95 HRESULT NINE_WINAPI
96 NineAdapter9_CheckDeviceMultiSampleType( struct NineAdapter9 *This,
97                                          D3DDEVTYPE DeviceType,
98                                          D3DFORMAT SurfaceFormat,
99                                          BOOL Windowed,
100                                          D3DMULTISAMPLE_TYPE MultiSampleType,
101                                          DWORD *pQualityLevels );
102 
103 HRESULT NINE_WINAPI
104 NineAdapter9_CheckDepthStencilMatch( struct NineAdapter9 *This,
105                                      D3DDEVTYPE DeviceType,
106                                      D3DFORMAT AdapterFormat,
107                                      D3DFORMAT RenderTargetFormat,
108                                      D3DFORMAT DepthStencilFormat );
109 
110 HRESULT NINE_WINAPI
111 NineAdapter9_CheckDeviceFormatConversion( struct NineAdapter9 *This,
112                                           D3DDEVTYPE DeviceType,
113                                           D3DFORMAT SourceFormat,
114                                           D3DFORMAT TargetFormat );
115 
116 HRESULT NINE_WINAPI
117 NineAdapter9_GetDeviceCaps( struct NineAdapter9 *This,
118                             D3DDEVTYPE DeviceType,
119                             D3DCAPS9 *pCaps );
120 
121 HRESULT NINE_WINAPI
122 NineAdapter9_CreateDevice( struct NineAdapter9 *This,
123                            UINT RealAdapter,
124                            D3DDEVTYPE DeviceType,
125                            HWND hFocusWindow,
126                            DWORD BehaviorFlags,
127                            D3DPRESENT_PARAMETERS *pPresentationParameters,
128                            IDirect3D9 *pD3D9,
129                            ID3DPresentGroup *pPresentationGroup,
130                            IDirect3DDevice9 **ppReturnedDeviceInterface );
131 
132 HRESULT NINE_WINAPI
133 NineAdapter9_CreateDeviceEx( struct NineAdapter9 *This,
134                              UINT RealAdapter,
135                              D3DDEVTYPE DeviceType,
136                              HWND hFocusWindow,
137                              DWORD BehaviorFlags,
138                              D3DPRESENT_PARAMETERS *pPresentationParameters,
139                              D3DDISPLAYMODEEX *pFullscreenDisplayMode,
140                              IDirect3D9Ex *pD3D9Ex,
141                              ID3DPresentGroup *pPresentationGroup,
142                              IDirect3DDevice9Ex **ppReturnedDeviceInterface );
143 
144 #endif /* _NINE_ADAPTER9_H_ */
145