1bf215546Sopenharmony_ci/*
2bf215546Sopenharmony_ci * Copyright 2011 Joakim Sindholt <opensource@zhasha.com>
3bf215546Sopenharmony_ci *
4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
5bf215546Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
6bf215546Sopenharmony_ci * to deal in the Software without restriction, including without limitation
7bf215546Sopenharmony_ci * on the rights to use, copy, modify, merge, publish, distribute, sub
8bf215546Sopenharmony_ci * license, and/or sell copies of the Software, and to permit persons to whom
9bf215546Sopenharmony_ci * the Software is furnished to do so, subject to the following conditions:
10bf215546Sopenharmony_ci *
11bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the next
12bf215546Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the
13bf215546Sopenharmony_ci * Software.
14bf215546Sopenharmony_ci *
15bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16bf215546Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18bf215546Sopenharmony_ci * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19bf215546Sopenharmony_ci * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20bf215546Sopenharmony_ci * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21bf215546Sopenharmony_ci * USE OR OTHER DEALINGS IN THE SOFTWARE. */
22bf215546Sopenharmony_ci
23bf215546Sopenharmony_ci#ifndef _NINE_ADAPTER9_H_
24bf215546Sopenharmony_ci#define _NINE_ADAPTER9_H_
25bf215546Sopenharmony_ci
26bf215546Sopenharmony_ci#include "iunknown.h"
27bf215546Sopenharmony_ci
28bf215546Sopenharmony_ci#include "d3dadapter/d3dadapter9.h"
29bf215546Sopenharmony_ci
30bf215546Sopenharmony_cistruct pipe_screen;
31bf215546Sopenharmony_cistruct pipe_resource;
32bf215546Sopenharmony_ci
33bf215546Sopenharmony_cistruct d3dadapter9_context
34bf215546Sopenharmony_ci{
35bf215546Sopenharmony_ci    struct pipe_screen *hal, *ref;
36bf215546Sopenharmony_ci    D3DADAPTER_IDENTIFIER9 identifier;
37bf215546Sopenharmony_ci    BOOL linear_framebuffer;
38bf215546Sopenharmony_ci    BOOL throttling;
39bf215546Sopenharmony_ci    int throttling_value;
40bf215546Sopenharmony_ci    int vblank_mode;
41bf215546Sopenharmony_ci    BOOL thread_submit;
42bf215546Sopenharmony_ci    BOOL discard_delayed_release;
43bf215546Sopenharmony_ci    BOOL tearfree_discard;
44bf215546Sopenharmony_ci    int csmt_force;
45bf215546Sopenharmony_ci    BOOL dynamic_texture_workaround;
46bf215546Sopenharmony_ci    BOOL shader_inline_constants;
47bf215546Sopenharmony_ci    int memfd_virtualsizelimit;
48bf215546Sopenharmony_ci    int override_vram_size;
49bf215546Sopenharmony_ci
50bf215546Sopenharmony_ci    void (*destroy)( struct d3dadapter9_context *ctx );
51bf215546Sopenharmony_ci};
52bf215546Sopenharmony_ci
53bf215546Sopenharmony_cistruct NineAdapter9
54bf215546Sopenharmony_ci{
55bf215546Sopenharmony_ci    struct NineUnknown base;
56bf215546Sopenharmony_ci
57bf215546Sopenharmony_ci    struct d3dadapter9_context *ctx;
58bf215546Sopenharmony_ci};
59bf215546Sopenharmony_cistatic inline struct NineAdapter9 *
60bf215546Sopenharmony_ciNineAdapter9( void *data )
61bf215546Sopenharmony_ci{
62bf215546Sopenharmony_ci    return (struct NineAdapter9 *)data;
63bf215546Sopenharmony_ci}
64bf215546Sopenharmony_ci
65bf215546Sopenharmony_ciHRESULT
66bf215546Sopenharmony_ciNineAdapter9_new( struct d3dadapter9_context *pCTX,
67bf215546Sopenharmony_ci                  struct NineAdapter9 **ppOut );
68bf215546Sopenharmony_ci
69bf215546Sopenharmony_ciHRESULT
70bf215546Sopenharmony_ciNineAdapter9_ctor( struct NineAdapter9 *This,
71bf215546Sopenharmony_ci                   struct NineUnknownParams *pParams,
72bf215546Sopenharmony_ci                   struct d3dadapter9_context *pCTX );
73bf215546Sopenharmony_ci
74bf215546Sopenharmony_civoid
75bf215546Sopenharmony_ciNineAdapter9_dtor( struct NineAdapter9 *This );
76bf215546Sopenharmony_ci
77bf215546Sopenharmony_ciHRESULT NINE_WINAPI
78bf215546Sopenharmony_ciNineAdapter9_GetAdapterIdentifier( struct NineAdapter9 *This,
79bf215546Sopenharmony_ci                                   DWORD Flags,
80bf215546Sopenharmony_ci                                   D3DADAPTER_IDENTIFIER9 *pIdentifier );
81bf215546Sopenharmony_ci
82bf215546Sopenharmony_ciHRESULT NINE_WINAPI
83bf215546Sopenharmony_ciNineAdapter9_CheckDeviceType( struct NineAdapter9 *This,
84bf215546Sopenharmony_ci                              D3DDEVTYPE DevType,
85bf215546Sopenharmony_ci                              D3DFORMAT AdapterFormat,
86bf215546Sopenharmony_ci                              D3DFORMAT BackBufferFormat,
87bf215546Sopenharmony_ci                              BOOL bWindowed );
88bf215546Sopenharmony_ci
89bf215546Sopenharmony_ciHRESULT NINE_WINAPI
90bf215546Sopenharmony_ciNineAdapter9_CheckDeviceFormat( struct NineAdapter9 *This,
91bf215546Sopenharmony_ci                                D3DDEVTYPE DeviceType,
92bf215546Sopenharmony_ci                                D3DFORMAT AdapterFormat,
93bf215546Sopenharmony_ci                                DWORD Usage,
94bf215546Sopenharmony_ci                                D3DRESOURCETYPE RType,
95bf215546Sopenharmony_ci                                D3DFORMAT CheckFormat );
96bf215546Sopenharmony_ci
97bf215546Sopenharmony_ciHRESULT NINE_WINAPI
98bf215546Sopenharmony_ciNineAdapter9_CheckDeviceMultiSampleType( struct NineAdapter9 *This,
99bf215546Sopenharmony_ci                                         D3DDEVTYPE DeviceType,
100bf215546Sopenharmony_ci                                         D3DFORMAT SurfaceFormat,
101bf215546Sopenharmony_ci                                         BOOL Windowed,
102bf215546Sopenharmony_ci                                         D3DMULTISAMPLE_TYPE MultiSampleType,
103bf215546Sopenharmony_ci                                         DWORD *pQualityLevels );
104bf215546Sopenharmony_ci
105bf215546Sopenharmony_ciHRESULT NINE_WINAPI
106bf215546Sopenharmony_ciNineAdapter9_CheckDepthStencilMatch( struct NineAdapter9 *This,
107bf215546Sopenharmony_ci                                     D3DDEVTYPE DeviceType,
108bf215546Sopenharmony_ci                                     D3DFORMAT AdapterFormat,
109bf215546Sopenharmony_ci                                     D3DFORMAT RenderTargetFormat,
110bf215546Sopenharmony_ci                                     D3DFORMAT DepthStencilFormat );
111bf215546Sopenharmony_ci
112bf215546Sopenharmony_ciHRESULT NINE_WINAPI
113bf215546Sopenharmony_ciNineAdapter9_CheckDeviceFormatConversion( struct NineAdapter9 *This,
114bf215546Sopenharmony_ci                                          D3DDEVTYPE DeviceType,
115bf215546Sopenharmony_ci                                          D3DFORMAT SourceFormat,
116bf215546Sopenharmony_ci                                          D3DFORMAT TargetFormat );
117bf215546Sopenharmony_ci
118bf215546Sopenharmony_ciHRESULT NINE_WINAPI
119bf215546Sopenharmony_ciNineAdapter9_GetDeviceCaps( struct NineAdapter9 *This,
120bf215546Sopenharmony_ci                            D3DDEVTYPE DeviceType,
121bf215546Sopenharmony_ci                            D3DCAPS9 *pCaps );
122bf215546Sopenharmony_ci
123bf215546Sopenharmony_ciHRESULT NINE_WINAPI
124bf215546Sopenharmony_ciNineAdapter9_CreateDevice( struct NineAdapter9 *This,
125bf215546Sopenharmony_ci                           UINT RealAdapter,
126bf215546Sopenharmony_ci                           D3DDEVTYPE DeviceType,
127bf215546Sopenharmony_ci                           HWND hFocusWindow,
128bf215546Sopenharmony_ci                           DWORD BehaviorFlags,
129bf215546Sopenharmony_ci                           D3DPRESENT_PARAMETERS *pPresentationParameters,
130bf215546Sopenharmony_ci                           IDirect3D9 *pD3D9,
131bf215546Sopenharmony_ci                           ID3DPresentGroup *pPresentationGroup,
132bf215546Sopenharmony_ci                           IDirect3DDevice9 **ppReturnedDeviceInterface );
133bf215546Sopenharmony_ci
134bf215546Sopenharmony_ciHRESULT NINE_WINAPI
135bf215546Sopenharmony_ciNineAdapter9_CreateDeviceEx( struct NineAdapter9 *This,
136bf215546Sopenharmony_ci                             UINT RealAdapter,
137bf215546Sopenharmony_ci                             D3DDEVTYPE DeviceType,
138bf215546Sopenharmony_ci                             HWND hFocusWindow,
139bf215546Sopenharmony_ci                             DWORD BehaviorFlags,
140bf215546Sopenharmony_ci                             D3DPRESENT_PARAMETERS *pPresentationParameters,
141bf215546Sopenharmony_ci                             D3DDISPLAYMODEEX *pFullscreenDisplayMode,
142bf215546Sopenharmony_ci                             IDirect3D9Ex *pD3D9Ex,
143bf215546Sopenharmony_ci                             ID3DPresentGroup *pPresentationGroup,
144bf215546Sopenharmony_ci                             IDirect3DDevice9Ex **ppReturnedDeviceInterface );
145bf215546Sopenharmony_ci
146bf215546Sopenharmony_ci#endif /* _NINE_ADAPTER9_H_ */
147