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