Commit | Line | Data |
---|---|---|
26258ce0 JE |
1 | /* |
2 | * IDirect3D8 implementation | |
3 | * | |
4f568633 | 4 | * Copyright 2002-2004 Jason Edmeades |
c87fd95f | 5 | * Copyright 2003-2004 Raphael Junqueira |
4f568633 | 6 | * Copyright 2004 Christian Costa |
26258ce0 JE |
7 | * |
8 | * This library is free software; you can redistribute it and/or | |
9 | * modify it under the terms of the GNU Lesser General Public | |
10 | * License as published by the Free Software Foundation; either | |
11 | * version 2.1 of the License, or (at your option) any later version. | |
12 | * | |
13 | * This library is distributed in the hope that it will be useful, | |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 | * Lesser General Public License for more details. | |
17 | * | |
18 | * You should have received a copy of the GNU Lesser General Public | |
19 | * License along with this library; if not, write to the Free Software | |
360a3f91 | 20 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA |
26258ce0 JE |
21 | */ |
22 | ||
69361e08 AJ |
23 | #include "config.h" |
24 | ||
e37c6e18 AJ |
25 | #include <stdarg.h> |
26 | ||
297f3d89 DP |
27 | #define NONAMELESSUNION |
28 | #define NONAMELESSSTRUCT | |
26258ce0 JE |
29 | #include "windef.h" |
30 | #include "winbase.h" | |
26258ce0 | 31 | #include "wingdi.h" |
ad22804e | 32 | #include "winuser.h" |
26258ce0 | 33 | #include "wine/debug.h" |
24be3065 | 34 | #include "wine/unicode.h" |
26258ce0 | 35 | |
26258ce0 JE |
36 | #include "d3d8_private.h" |
37 | ||
d13469c1 | 38 | WINE_DEFAULT_DEBUG_CHANNEL(d3d8); |
26258ce0 | 39 | |
26258ce0 | 40 | /* IDirect3D IUnknown parts follow: */ |
c3bd09e5 | 41 | static HRESULT WINAPI IDirect3D8Impl_QueryInterface(LPDIRECT3D8 iface, REFIID riid,LPVOID *ppobj) |
26258ce0 | 42 | { |
f5f7a182 | 43 | IDirect3D8Impl *This = (IDirect3D8Impl *)iface; |
26258ce0 JE |
44 | |
45 | if (IsEqualGUID(riid, &IID_IUnknown) | |
e31ae926 | 46 | || IsEqualGUID(riid, &IID_IDirect3D8)) { |
d13469c1 | 47 | IUnknown_AddRef(iface); |
26258ce0 | 48 | *ppobj = This; |
d06aa8d8 | 49 | return S_OK; |
26258ce0 JE |
50 | } |
51 | ||
d13469c1 | 52 | WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid),ppobj); |
d06aa8d8 | 53 | *ppobj = NULL; |
26258ce0 JE |
54 | return E_NOINTERFACE; |
55 | } | |
56 | ||
c3bd09e5 | 57 | static ULONG WINAPI IDirect3D8Impl_AddRef(LPDIRECT3D8 iface) { |
f5f7a182 | 58 | IDirect3D8Impl *This = (IDirect3D8Impl *)iface; |
7a49e82d PV |
59 | ULONG ref = InterlockedIncrement(&This->ref); |
60 | ||
61 | TRACE("(%p) : AddRef from %ld\n", This, ref - 1); | |
62 | ||
63 | return ref; | |
26258ce0 JE |
64 | } |
65 | ||
c3bd09e5 | 66 | static ULONG WINAPI IDirect3D8Impl_Release(LPDIRECT3D8 iface) { |
f5f7a182 | 67 | IDirect3D8Impl *This = (IDirect3D8Impl *)iface; |
7a49e82d PV |
68 | ULONG ref = InterlockedDecrement(&This->ref); |
69 | ||
70 | TRACE("(%p) : ReleaseRef to %ld\n", This, ref); | |
71 | ||
ae5a4368 | 72 | if (ref == 0) { |
d13469c1 | 73 | TRACE("Releasing wined3d %p\n", This->WineD3D); |
ae5a4368 | 74 | IWineD3D_Release(This->WineD3D); |
26258ce0 | 75 | HeapFree(GetProcessHeap(), 0, This); |
ae5a4368 | 76 | } |
d13469c1 | 77 | |
26258ce0 JE |
78 | return ref; |
79 | } | |
80 | ||
d13469c1 | 81 | /* IDirect3D8 Interface follow: */ |
c3bd09e5 | 82 | static HRESULT WINAPI IDirect3D8Impl_RegisterSoftwareDevice (LPDIRECT3D8 iface, void* pInitializeFunction) { |
f5f7a182 | 83 | IDirect3D8Impl *This = (IDirect3D8Impl *)iface; |
ae5a4368 | 84 | return IWineD3D_RegisterSoftwareDevice(This->WineD3D, pInitializeFunction); |
26258ce0 JE |
85 | } |
86 | ||
c3bd09e5 | 87 | static UINT WINAPI IDirect3D8Impl_GetAdapterCount (LPDIRECT3D8 iface) { |
f5f7a182 | 88 | IDirect3D8Impl *This = (IDirect3D8Impl *)iface; |
ae5a4368 | 89 | return IWineD3D_GetAdapterCount(This->WineD3D); |
26258ce0 JE |
90 | } |
91 | ||
c3bd09e5 | 92 | static HRESULT WINAPI IDirect3D8Impl_GetAdapterIdentifier (LPDIRECT3D8 iface, |
26258ce0 | 93 | UINT Adapter, DWORD Flags, D3DADAPTER_IDENTIFIER8* pIdentifier) { |
f5f7a182 | 94 | IDirect3D8Impl *This = (IDirect3D8Impl *)iface; |
c3421ea4 JE |
95 | WINED3DADAPTER_IDENTIFIER adapter_id; |
96 | ||
97 | /* dx8 and dx9 have different structures to be filled in, with incompatible | |
98 | layouts so pass in pointers to the places to be filled via an internal | |
99 | structure */ | |
d13469c1 RC |
100 | adapter_id.Driver = pIdentifier->Driver; |
101 | adapter_id.Description = pIdentifier->Description; | |
102 | adapter_id.DeviceName = NULL; /* d3d9 only */ | |
103 | adapter_id.DriverVersion = &pIdentifier->DriverVersion; | |
104 | adapter_id.VendorId = &pIdentifier->VendorId; | |
105 | adapter_id.DeviceId = &pIdentifier->DeviceId; | |
106 | adapter_id.SubSysId = &pIdentifier->SubSysId; | |
107 | adapter_id.Revision = &pIdentifier->Revision; | |
c3421ea4 | 108 | adapter_id.DeviceIdentifier = &pIdentifier->DeviceIdentifier; |
d13469c1 | 109 | adapter_id.WHQLLevel = &pIdentifier->WHQLLevel; |
c3421ea4 JE |
110 | |
111 | return IWineD3D_GetAdapterIdentifier(This->WineD3D, Adapter, Flags, &adapter_id); | |
26258ce0 JE |
112 | } |
113 | ||
c3bd09e5 | 114 | static UINT WINAPI IDirect3D8Impl_GetAdapterModeCount (LPDIRECT3D8 iface,UINT Adapter) { |
f5f7a182 | 115 | IDirect3D8Impl *This = (IDirect3D8Impl *)iface; |
d13469c1 | 116 | return IWineD3D_GetAdapterModeCount(This->WineD3D, Adapter, 0 /* format */); |
26258ce0 JE |
117 | } |
118 | ||
c3bd09e5 | 119 | static HRESULT WINAPI IDirect3D8Impl_EnumAdapterModes (LPDIRECT3D8 iface, UINT Adapter, UINT Mode, D3DDISPLAYMODE* pMode) { |
f5f7a182 | 120 | IDirect3D8Impl *This = (IDirect3D8Impl *)iface; |
d13469c1 | 121 | /* FIXME: USe a constant WINED3DFOTMAT_ANY, or something similar */ |
fce54bcc | 122 | return IWineD3D_EnumAdapterModes(This->WineD3D, Adapter, 0 /* format */, Mode, (WINED3DDISPLAYMODE *) pMode); |
26258ce0 JE |
123 | } |
124 | ||
c3bd09e5 | 125 | static HRESULT WINAPI IDirect3D8Impl_GetAdapterDisplayMode (LPDIRECT3D8 iface, UINT Adapter, D3DDISPLAYMODE* pMode) { |
f5f7a182 | 126 | IDirect3D8Impl *This = (IDirect3D8Impl *)iface; |
fce54bcc | 127 | return IWineD3D_GetAdapterDisplayMode(This->WineD3D, Adapter, (WINED3DDISPLAYMODE *) pMode); |
26258ce0 JE |
128 | } |
129 | ||
c3bd09e5 | 130 | static HRESULT WINAPI IDirect3D8Impl_CheckDeviceType (LPDIRECT3D8 iface, |
26258ce0 JE |
131 | UINT Adapter, D3DDEVTYPE CheckType, D3DFORMAT DisplayFormat, |
132 | D3DFORMAT BackBufferFormat, BOOL Windowed) { | |
f5f7a182 | 133 | IDirect3D8Impl *This = (IDirect3D8Impl *)iface; |
c579fa62 JE |
134 | return IWineD3D_CheckDeviceType(This->WineD3D, Adapter, CheckType, DisplayFormat, |
135 | BackBufferFormat, Windowed); | |
26258ce0 JE |
136 | } |
137 | ||
c3bd09e5 | 138 | static HRESULT WINAPI IDirect3D8Impl_CheckDeviceFormat (LPDIRECT3D8 iface, |
26258ce0 JE |
139 | UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, |
140 | DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat) { | |
f5f7a182 | 141 | IDirect3D8Impl *This = (IDirect3D8Impl *)iface; |
c579fa62 JE |
142 | return IWineD3D_CheckDeviceFormat(This->WineD3D, Adapter, DeviceType, AdapterFormat, |
143 | Usage, RType, CheckFormat); | |
26258ce0 JE |
144 | } |
145 | ||
c3bd09e5 | 146 | static HRESULT WINAPI IDirect3D8Impl_CheckDeviceMultiSampleType(LPDIRECT3D8 iface, |
24be3065 RJ |
147 | UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat, |
148 | BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType) { | |
f5f7a182 | 149 | IDirect3D8Impl *This = (IDirect3D8Impl *)iface; |
c579fa62 | 150 | return IWineD3D_CheckDeviceMultiSampleType(This->WineD3D, Adapter, DeviceType, SurfaceFormat, |
b4b295c2 | 151 | Windowed, (WINED3DMULTISAMPLE_TYPE) MultiSampleType, NULL); |
26258ce0 JE |
152 | } |
153 | ||
c3bd09e5 | 154 | static HRESULT WINAPI IDirect3D8Impl_CheckDepthStencilMatch(LPDIRECT3D8 iface, |
24be3065 RJ |
155 | UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, |
156 | D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat) { | |
f5f7a182 | 157 | IDirect3D8Impl *This = (IDirect3D8Impl *)iface; |
c579fa62 JE |
158 | return IWineD3D_CheckDepthStencilMatch(This->WineD3D, Adapter, DeviceType, AdapterFormat, |
159 | RenderTargetFormat, DepthStencilFormat); | |
26258ce0 JE |
160 | } |
161 | ||
c3bd09e5 | 162 | static HRESULT WINAPI IDirect3D8Impl_GetDeviceCaps(LPDIRECT3D8 iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS8* pCaps) { |
f5f7a182 | 163 | IDirect3D8Impl *This = (IDirect3D8Impl *)iface; |
e70e3ba0 OS |
164 | HRESULT hrc = D3D_OK; |
165 | WINED3DCAPS *pWineCaps; | |
166 | ||
0edbaf7e | 167 | TRACE("(%p) Relay %d %u %p\n", This, Adapter, DeviceType, pCaps); |
e70e3ba0 OS |
168 | |
169 | if(NULL == pCaps){ | |
170 | return D3DERR_INVALIDCALL; | |
171 | } | |
172 | pWineCaps = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINED3DCAPS)); | |
173 | if(pWineCaps == NULL){ | |
174 | return D3DERR_INVALIDCALL; /*well this is what MSDN says to return*/ | |
175 | } | |
176 | D3D8CAPSTOWINECAPS(pCaps, pWineCaps) | |
177 | hrc = IWineD3D_GetDeviceCaps(This->WineD3D, Adapter, DeviceType, pWineCaps); | |
178 | HeapFree(GetProcessHeap(), 0, pWineCaps); | |
179 | TRACE("(%p) returning %p\n", This, pCaps); | |
180 | return hrc; | |
26258ce0 JE |
181 | } |
182 | ||
c3bd09e5 | 183 | static HMONITOR WINAPI IDirect3D8Impl_GetAdapterMonitor(LPDIRECT3D8 iface, UINT Adapter) { |
f5f7a182 | 184 | IDirect3D8Impl *This = (IDirect3D8Impl *)iface; |
ae5a4368 | 185 | return IWineD3D_GetAdapterMonitor(This->WineD3D, Adapter); |
26258ce0 JE |
186 | } |
187 | ||
41427857 JE |
188 | /* Internal function called back during the CreateDevice to create a render target */ |
189 | HRESULT WINAPI D3D8CB_CreateRenderTarget(IUnknown *device, UINT Width, UINT Height, | |
b4b295c2 | 190 | WINED3DFORMAT Format, WINED3DMULTISAMPLE_TYPE MultiSample, |
41427857 JE |
191 | DWORD MultisampleQuality, BOOL Lockable, |
192 | IWineD3DSurface** ppSurface, HANDLE* pSharedHandle) { | |
193 | HRESULT res = D3D_OK; | |
194 | IDirect3DSurface8Impl *d3dSurface = NULL; | |
195 | ||
d13469c1 | 196 | TRACE("(%p) call back\n", device); |
41427857 | 197 | res = IDirect3DDevice8_CreateRenderTarget((IDirect3DDevice8 *)device, Width, Height, |
67f2ad45 | 198 | (D3DFORMAT)Format, MultiSample, Lockable, |
41427857 | 199 | (IDirect3DSurface8 **)&d3dSurface); |
d13469c1 RC |
200 | |
201 | if (SUCCEEDED(res)) { | |
145442a7 VM |
202 | *ppSurface = d3dSurface->wineD3DSurface; |
203 | IUnknown_Release(d3dSurface->parentDevice); | |
204 | d3dSurface->parentDevice = NULL; | |
d13469c1 RC |
205 | } else { |
206 | *ppSurface = NULL; | |
41427857 JE |
207 | } |
208 | return res; | |
209 | } | |
210 | ||
46e7c30a | 211 | /* Callback for creating the inplicite swapchain when the device is created */ |
c3bd09e5 | 212 | static HRESULT WINAPI D3D8CB_CreateAdditionalSwapChain(IUnknown *device, |
46e7c30a OS |
213 | WINED3DPRESENT_PARAMETERS* pPresentationParameters, |
214 | IWineD3DSwapChain ** ppSwapChain){ | |
215 | HRESULT res = D3D_OK; | |
216 | IDirect3DSwapChain8Impl *d3dSwapChain = NULL; | |
46e7c30a | 217 | D3DPRESENT_PARAMETERS localParameters; |
d13469c1 RC |
218 | TRACE("(%p) call back\n", device); |
219 | ||
46e7c30a OS |
220 | localParameters.BackBufferWidth = *(pPresentationParameters->BackBufferWidth); |
221 | localParameters.BackBufferHeight = *(pPresentationParameters->BackBufferHeight); | |
222 | localParameters.BackBufferFormat = *(pPresentationParameters->BackBufferFormat); | |
223 | localParameters.BackBufferCount = *(pPresentationParameters->BackBufferCount); | |
224 | localParameters.MultiSampleType = *(pPresentationParameters->MultiSampleType); | |
d13469c1 RC |
225 | /* d3d9 only */ |
226 | /* localParameters.MultiSampleQuality = *(pPresentationParameters->MultiSampleQuality); */ | |
46e7c30a OS |
227 | localParameters.SwapEffect = *(pPresentationParameters->SwapEffect); |
228 | localParameters.hDeviceWindow = *(pPresentationParameters->hDeviceWindow); | |
229 | localParameters.Windowed = *(pPresentationParameters->Windowed); | |
230 | localParameters.EnableAutoDepthStencil = *(pPresentationParameters->EnableAutoDepthStencil); | |
231 | localParameters.AutoDepthStencilFormat = *(pPresentationParameters->AutoDepthStencilFormat); | |
232 | localParameters.Flags = *(pPresentationParameters->Flags); | |
233 | localParameters.FullScreen_RefreshRateInHz = *(pPresentationParameters->FullScreen_RefreshRateInHz); | |
d13469c1 RC |
234 | /* d3d9 only */ |
235 | /* localParameters.PresentationInterval = *(pPresentationParameters->PresentationInterval); */ | |
46e7c30a | 236 | |
46e7c30a OS |
237 | /*copy the presentation parameters*/ |
238 | res = IDirect3DDevice8_CreateAdditionalSwapChain((IDirect3DDevice8 *)device, &localParameters, (IDirect3DSwapChain8 **)&d3dSwapChain); | |
239 | ||
145442a7 | 240 | if (SUCCEEDED(res)) { |
46e7c30a | 241 | *ppSwapChain = d3dSwapChain->wineD3DSwapChain; |
145442a7 VM |
242 | IUnknown_Release(d3dSwapChain->parentDevice); |
243 | d3dSwapChain->parentDevice = NULL; | |
46e7c30a | 244 | } else { |
46e7c30a OS |
245 | *ppSwapChain = NULL; |
246 | } | |
d13469c1 RC |
247 | |
248 | /*Copy back the presentation parameters*/ | |
249 | *pPresentationParameters->BackBufferWidth = localParameters.BackBufferWidth; | |
250 | *pPresentationParameters->BackBufferHeight = localParameters.BackBufferHeight; | |
251 | *pPresentationParameters->BackBufferFormat = localParameters.BackBufferFormat; | |
252 | *pPresentationParameters->BackBufferCount = localParameters.BackBufferCount; | |
253 | *pPresentationParameters->MultiSampleType = localParameters.MultiSampleType; | |
254 | /* d3d9 only */ | |
255 | /* *pPresentationParameters->MultiSampleQuality = localParameters.MultiSampleQuality; */ | |
256 | *pPresentationParameters->SwapEffect = localParameters.SwapEffect; | |
257 | *pPresentationParameters->hDeviceWindow = localParameters.hDeviceWindow; | |
258 | *pPresentationParameters->Windowed = localParameters.Windowed; | |
259 | *pPresentationParameters->EnableAutoDepthStencil = localParameters.EnableAutoDepthStencil; | |
260 | *pPresentationParameters->AutoDepthStencilFormat = localParameters.AutoDepthStencilFormat; | |
261 | *pPresentationParameters->Flags = localParameters.Flags; | |
262 | *pPresentationParameters->FullScreen_RefreshRateInHz = localParameters.FullScreen_RefreshRateInHz; | |
263 | /* d3d9 only */ | |
264 | /* *pPresentationParameters->PresentationInterval = localParameters.PresentationInterval; */ | |
46e7c30a OS |
265 | |
266 | return res; | |
267 | } | |
268 | ||
d13469c1 RC |
269 | /* Internal function called back during the CreateDevice to create a render target */ |
270 | HRESULT WINAPI D3D8CB_CreateDepthStencilSurface(IUnknown *device, UINT Width, UINT Height, | |
b4b295c2 | 271 | WINED3DFORMAT Format, WINED3DMULTISAMPLE_TYPE MultiSample, |
d13469c1 RC |
272 | DWORD MultisampleQuality, BOOL Discard, |
273 | IWineD3DSurface** ppSurface, HANDLE* pSharedHandle) { | |
274 | HRESULT res = D3D_OK; | |
275 | IDirect3DSurface8Impl *d3dSurface = NULL; | |
276 | TRACE("(%p) call back\n", device); | |
26258ce0 | 277 | |
d13469c1 RC |
278 | res = IDirect3DDevice8_CreateDepthStencilSurface((IDirect3DDevice8 *)device, Width, Height, |
279 | (D3DFORMAT)Format, MultiSample, (IDirect3DSurface8 **)&d3dSurface); | |
145442a7 | 280 | if (SUCCEEDED(res)) { |
d13469c1 | 281 | *ppSurface = d3dSurface->wineD3DSurface; |
145442a7 VM |
282 | IUnknown_Release(d3dSurface->parentDevice); |
283 | d3dSurface->parentDevice = NULL; | |
d13469c1 RC |
284 | } |
285 | return res; | |
286 | } | |
287 | ||
c3bd09e5 | 288 | static HRESULT WINAPI IDirect3D8Impl_CreateDevice(LPDIRECT3D8 iface, UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, |
d13469c1 RC |
289 | DWORD BehaviourFlags, D3DPRESENT_PARAMETERS* pPresentationParameters, |
290 | IDirect3DDevice8** ppReturnedDeviceInterface) { | |
26258ce0 | 291 | |
d13469c1 RC |
292 | IDirect3D8Impl *This = (IDirect3D8Impl *)iface; |
293 | IDirect3DDevice8Impl *object = NULL; | |
294 | WINED3DPRESENT_PARAMETERS localParameters; | |
295 | HRESULT hr; | |
555a0607 | 296 | TRACE("(%p) Relay\n", This); |
d13469c1 RC |
297 | |
298 | /* Check the validity range of the adapter parameter */ | |
40dd9692 | 299 | if (Adapter >= IDirect3D8Impl_GetAdapterCount(iface)) { |
d13469c1 | 300 | *ppReturnedDeviceInterface = NULL; |
40dd9692 RJ |
301 | return D3DERR_INVALIDCALL; |
302 | } | |
303 | ||
d13469c1 | 304 | /* Allocate the storage for the device object */ |
26258ce0 | 305 | object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DDevice8Impl)); |
1df8f18e | 306 | if (NULL == object) { |
d13469c1 RC |
307 | FIXME("Allocation of memory failed\n"); |
308 | *ppReturnedDeviceInterface = NULL; | |
309 | return D3DERR_OUTOFVIDEOMEMORY; | |
1df8f18e | 310 | } |
d13469c1 | 311 | |
26258ce0 JE |
312 | object->lpVtbl = &Direct3DDevice8_Vtbl; |
313 | object->ref = 1; | |
4a48e38e V |
314 | object->shader_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, INITIAL_SHADER_HANDLE_TABLE_SIZE * sizeof(shader_handle)); |
315 | object->shader_handle_table_size = INITIAL_SHADER_HANDLE_TABLE_SIZE; | |
d13469c1 | 316 | *ppReturnedDeviceInterface = (IDirect3DDevice8 *)object; |
4b0297d8 | 317 | |
b9e2beda JE |
318 | /* Allocate an associated WineD3DDevice object */ |
319 | localParameters.BackBufferWidth = &pPresentationParameters->BackBufferWidth; | |
320 | localParameters.BackBufferHeight = &pPresentationParameters->BackBufferHeight; | |
d13469c1 RC |
321 | localParameters.BackBufferFormat = (WINED3DFORMAT *)&pPresentationParameters->BackBufferFormat; |
322 | localParameters.BackBufferCount = &pPresentationParameters->BackBufferCount; | |
b4b295c2 | 323 | localParameters.MultiSampleType = (WINED3DMULTISAMPLE_TYPE *) &pPresentationParameters->MultiSampleType; |
d13469c1 RC |
324 | /* d3d9 only */ |
325 | localParameters.MultiSampleQuality = NULL; | |
1d475561 | 326 | localParameters.SwapEffect = (WINED3DSWAPEFFECT *) &pPresentationParameters->SwapEffect; |
d13469c1 RC |
327 | localParameters.hDeviceWindow = &pPresentationParameters->hDeviceWindow; |
328 | localParameters.Windowed = &pPresentationParameters->Windowed; | |
329 | localParameters.EnableAutoDepthStencil = &pPresentationParameters->EnableAutoDepthStencil; | |
330 | localParameters.AutoDepthStencilFormat = (WINED3DFORMAT *)&pPresentationParameters->AutoDepthStencilFormat; | |
331 | localParameters.Flags = &pPresentationParameters->Flags; | |
332 | localParameters.FullScreen_RefreshRateInHz = &pPresentationParameters->FullScreen_RefreshRateInHz; | |
333 | localParameters.PresentationInterval = &pPresentationParameters->FullScreen_PresentationInterval;/* Renamed in dx9 */ | |
334 | ||
d04f0507 | 335 | hr =IWineD3D_CreateDevice(This->WineD3D, Adapter, DeviceType, hFocusWindow, BehaviourFlags, &object->WineD3DDevice, (IUnknown *)object); |
d2510847 SD |
336 | |
337 | if (hr != D3D_OK) { | |
338 | HeapFree(GetProcessHeap(), 0, object); | |
339 | *ppReturnedDeviceInterface = NULL; | |
340 | return hr; | |
341 | } | |
342 | ||
343 | TRACE("(%p) : Created Device %p\n", This, object); | |
344 | ||
d2510847 SD |
345 | hr = IWineD3DDevice_Init3D(object->WineD3DDevice, &localParameters, D3D8CB_CreateAdditionalSwapChain); |
346 | if (hr != D3D_OK) { | |
347 | FIXME("(%p) D3D Initialization failed for WineD3DDevice %p\n", This, object->WineD3DDevice); | |
d13469c1 RC |
348 | HeapFree(GetProcessHeap(), 0, object); |
349 | *ppReturnedDeviceInterface = NULL; | |
0b5e9d9f | 350 | } |
3cae8cfa | 351 | |
d13469c1 | 352 | return hr; |
26258ce0 JE |
353 | } |
354 | ||
4625628e | 355 | const IDirect3D8Vtbl Direct3D8_Vtbl = |
26258ce0 | 356 | { |
d13469c1 | 357 | /* IUnknown */ |
26258ce0 JE |
358 | IDirect3D8Impl_QueryInterface, |
359 | IDirect3D8Impl_AddRef, | |
360 | IDirect3D8Impl_Release, | |
d13469c1 | 361 | /* IDirect3D8 */ |
26258ce0 JE |
362 | IDirect3D8Impl_RegisterSoftwareDevice, |
363 | IDirect3D8Impl_GetAdapterCount, | |
364 | IDirect3D8Impl_GetAdapterIdentifier, | |
365 | IDirect3D8Impl_GetAdapterModeCount, | |
366 | IDirect3D8Impl_EnumAdapterModes, | |
367 | IDirect3D8Impl_GetAdapterDisplayMode, | |
368 | IDirect3D8Impl_CheckDeviceType, | |
369 | IDirect3D8Impl_CheckDeviceFormat, | |
370 | IDirect3D8Impl_CheckDeviceMultiSampleType, | |
371 | IDirect3D8Impl_CheckDepthStencilMatch, | |
372 | IDirect3D8Impl_GetDeviceCaps, | |
373 | IDirect3D8Impl_GetAdapterMonitor, | |
374 | IDirect3D8Impl_CreateDevice | |
375 | }; |