1 /*
2 * Copyright 2013 Joakim Sindholt <[email protected]>
3 * SPDX-License-Identifier: MIT
4 */
5
6 #include "authenticatedchannel9.h"
7 #include "basetexture9.h"
8 #include "cryptosession9.h"
9 #include "cubetexture9.h"
10 #include "device9.h"
11 #include "device9ex.h"
12 #include "device9video.h"
13 #include "indexbuffer9.h"
14 #include "pixelshader9.h"
15 #include "query9.h"
16 #include "resource9.h"
17 #include "stateblock9.h"
18 #include "surface9.h"
19 #include "swapchain9.h"
20 #include "swapchain9ex.h"
21 #include "texture9.h"
22 #include "vertexbuffer9.h"
23 #include "vertexdeclaration9.h"
24 #include "vertexshader9.h"
25 #include "volume9.h"
26 #include "volumetexture9.h"
27
28 #include "d3d9.h"
29 #include "nine_lock.h"
30
31 #include "util/simple_mtx.h"
32 #include "util/u_thread.h"
33
34 /* Global mutex as described by MSDN */
35 static simple_mtx_t d3dlock_global = SIMPLE_MTX_INITIALIZER;
36
37 void
NineLockGlobalMutex()38 NineLockGlobalMutex()
39 {
40 simple_mtx_lock(&d3dlock_global);
41 }
42
43 void
NineUnlockGlobalMutex()44 NineUnlockGlobalMutex()
45 {
46 simple_mtx_unlock(&d3dlock_global);
47 }
48
49 static HRESULT NINE_WINAPI
LockAuthenticatedChannel9_GetCertificateSize(struct NineAuthenticatedChannel9 * This,UINT * pCertificateSize)50 LockAuthenticatedChannel9_GetCertificateSize( struct NineAuthenticatedChannel9 *This,
51 UINT *pCertificateSize )
52 {
53 HRESULT r;
54 simple_mtx_lock(&d3dlock_global);
55 r = NineAuthenticatedChannel9_GetCertificateSize(This, pCertificateSize);
56 simple_mtx_unlock(&d3dlock_global);
57 return r;
58 }
59
60 static HRESULT NINE_WINAPI
LockAuthenticatedChannel9_GetCertificate(struct NineAuthenticatedChannel9 * This,UINT CertifacteSize,BYTE * ppCertificate)61 LockAuthenticatedChannel9_GetCertificate( struct NineAuthenticatedChannel9 *This,
62 UINT CertifacteSize,
63 BYTE *ppCertificate )
64 {
65 HRESULT r;
66 simple_mtx_lock(&d3dlock_global);
67 r = NineAuthenticatedChannel9_GetCertificate(This, CertifacteSize, ppCertificate);
68 simple_mtx_unlock(&d3dlock_global);
69 return r;
70 }
71
72 static HRESULT NINE_WINAPI
LockAuthenticatedChannel9_NegotiateKeyExchange(struct NineAuthenticatedChannel9 * This,UINT DataSize,void * pData)73 LockAuthenticatedChannel9_NegotiateKeyExchange( struct NineAuthenticatedChannel9 *This,
74 UINT DataSize,
75 void *pData )
76 {
77 HRESULT r;
78 simple_mtx_lock(&d3dlock_global);
79 r = NineAuthenticatedChannel9_NegotiateKeyExchange(This, DataSize, pData);
80 simple_mtx_unlock(&d3dlock_global);
81 return r;
82 }
83
84 static HRESULT NINE_WINAPI
LockAuthenticatedChannel9_Query(struct NineAuthenticatedChannel9 * This,UINT InputSize,const void * pInput,UINT OutputSize,void * pOutput)85 LockAuthenticatedChannel9_Query( struct NineAuthenticatedChannel9 *This,
86 UINT InputSize,
87 const void *pInput,
88 UINT OutputSize,
89 void *pOutput )
90 {
91 HRESULT r;
92 simple_mtx_lock(&d3dlock_global);
93 r = NineAuthenticatedChannel9_Query(This, InputSize, pInput, OutputSize, pOutput);
94 simple_mtx_unlock(&d3dlock_global);
95 return r;
96 }
97
98 static HRESULT NINE_WINAPI
LockAuthenticatedChannel9_Configure(struct NineAuthenticatedChannel9 * This,UINT InputSize,const void * pInput,D3DAUTHENTICATEDCHANNEL_CONFIGURE_OUTPUT * pOutput)99 LockAuthenticatedChannel9_Configure( struct NineAuthenticatedChannel9 *This,
100 UINT InputSize,
101 const void *pInput,
102 D3DAUTHENTICATEDCHANNEL_CONFIGURE_OUTPUT *pOutput )
103 {
104 HRESULT r;
105 simple_mtx_lock(&d3dlock_global);
106 r = NineAuthenticatedChannel9_Configure(This, InputSize, pInput, pOutput);
107 simple_mtx_unlock(&d3dlock_global);
108 return r;
109 }
110
111 IDirect3DAuthenticatedChannel9Vtbl LockAuthenticatedChannel9_vtable = {
112 (void *)NineUnknown_QueryInterface,
113 (void *)NineUnknown_AddRef,
114 (void *)NineUnknown_ReleaseWithDtorLock,
115 (void *)LockAuthenticatedChannel9_GetCertificateSize,
116 (void *)LockAuthenticatedChannel9_GetCertificate,
117 (void *)LockAuthenticatedChannel9_NegotiateKeyExchange,
118 (void *)LockAuthenticatedChannel9_Query,
119 (void *)LockAuthenticatedChannel9_Configure
120 };
121
122 static HRESULT NINE_WINAPI
LockUnknown_SetPrivateData(struct NineUnknown * This,REFGUID refguid,const void * pData,DWORD SizeOfData,DWORD Flags)123 LockUnknown_SetPrivateData( struct NineUnknown *This,
124 REFGUID refguid,
125 const void *pData,
126 DWORD SizeOfData,
127 DWORD Flags )
128 {
129 HRESULT r;
130 simple_mtx_lock(&d3dlock_global);
131 r = NineUnknown_SetPrivateData(This, refguid, pData, SizeOfData, Flags);
132 simple_mtx_unlock(&d3dlock_global);
133 return r;
134 }
135
136 static HRESULT NINE_WINAPI
LockUnknown_GetPrivateData(struct NineUnknown * This,REFGUID refguid,void * pData,DWORD * pSizeOfData)137 LockUnknown_GetPrivateData( struct NineUnknown *This,
138 REFGUID refguid,
139 void *pData,
140 DWORD *pSizeOfData )
141 {
142 HRESULT r;
143 simple_mtx_lock(&d3dlock_global);
144 r = NineUnknown_GetPrivateData(This, refguid, pData, pSizeOfData);
145 simple_mtx_unlock(&d3dlock_global);
146 return r;
147 }
148
149 static HRESULT NINE_WINAPI
LockUnknown_FreePrivateData(struct NineUnknown * This,REFGUID refguid)150 LockUnknown_FreePrivateData( struct NineUnknown *This,
151 REFGUID refguid )
152 {
153 HRESULT r;
154 simple_mtx_lock(&d3dlock_global);
155 r = NineUnknown_FreePrivateData(This, refguid);
156 simple_mtx_unlock(&d3dlock_global);
157 return r;
158 }
159
160 #if 0
161 static HRESULT NINE_WINAPI
162 LockResource9_GetDevice( struct NineResource9 *This,
163 IDirect3DDevice9 **ppDevice )
164 {
165 HRESULT r;
166 simple_mtx_lock(&d3dlock_global);
167 r = NineUnknown_GetDevice(NineUnknown(This), ppDevice);
168 simple_mtx_unlock(&d3dlock_global);
169 return r;
170 }
171 #endif
172
173 static DWORD NINE_WINAPI
LockResource9_SetPriority(struct NineResource9 * This,DWORD PriorityNew)174 LockResource9_SetPriority( struct NineResource9 *This,
175 DWORD PriorityNew )
176 {
177 DWORD r;
178 simple_mtx_lock(&d3dlock_global);
179 r = NineResource9_SetPriority(This, PriorityNew);
180 simple_mtx_unlock(&d3dlock_global);
181 return r;
182 }
183
184 static DWORD NINE_WINAPI
LockResource9_GetPriority(struct NineResource9 * This)185 LockResource9_GetPriority( struct NineResource9 *This )
186 {
187 DWORD r;
188 simple_mtx_lock(&d3dlock_global);
189 r = NineResource9_GetPriority(This);
190 simple_mtx_unlock(&d3dlock_global);
191 return r;
192 }
193
194 #if 0
195 static void NINE_WINAPI
196 LockResource9_PreLoad( struct NineResource9 *This )
197 {
198 simple_mtx_lock(&d3dlock_global);
199 NineResource9_PreLoad(This);
200 simple_mtx_unlock(&d3dlock_global);
201 }
202 #endif
203
204 #if 0
205 static D3DRESOURCETYPE NINE_WINAPI
206 LockResource9_GetType( struct NineResource9 *This )
207 {
208 D3DRESOURCETYPE r;
209 simple_mtx_lock(&d3dlock_global);
210 r = NineResource9_GetType(This);
211 simple_mtx_unlock(&d3dlock_global);
212 return r;
213 }
214 #endif
215
216 static DWORD NINE_WINAPI
LockBaseTexture9_SetLOD(struct NineBaseTexture9 * This,DWORD LODNew)217 LockBaseTexture9_SetLOD( struct NineBaseTexture9 *This,
218 DWORD LODNew )
219 {
220 DWORD r;
221 simple_mtx_lock(&d3dlock_global);
222 r = NineBaseTexture9_SetLOD(This, LODNew);
223 simple_mtx_unlock(&d3dlock_global);
224 return r;
225 }
226
227 static DWORD NINE_WINAPI
LockBaseTexture9_GetLOD(struct NineBaseTexture9 * This)228 LockBaseTexture9_GetLOD( struct NineBaseTexture9 *This )
229 {
230 DWORD r;
231 simple_mtx_lock(&d3dlock_global);
232 r = NineBaseTexture9_GetLOD(This);
233 simple_mtx_unlock(&d3dlock_global);
234 return r;
235 }
236
237 static DWORD NINE_WINAPI
LockBaseTexture9_GetLevelCount(struct NineBaseTexture9 * This)238 LockBaseTexture9_GetLevelCount( struct NineBaseTexture9 *This )
239 {
240 DWORD r;
241 simple_mtx_lock(&d3dlock_global);
242 r = NineBaseTexture9_GetLevelCount(This);
243 simple_mtx_unlock(&d3dlock_global);
244 return r;
245 }
246
247 static HRESULT NINE_WINAPI
LockBaseTexture9_SetAutoGenFilterType(struct NineBaseTexture9 * This,D3DTEXTUREFILTERTYPE FilterType)248 LockBaseTexture9_SetAutoGenFilterType( struct NineBaseTexture9 *This,
249 D3DTEXTUREFILTERTYPE FilterType )
250 {
251 HRESULT r;
252 simple_mtx_lock(&d3dlock_global);
253 r = NineBaseTexture9_SetAutoGenFilterType(This, FilterType);
254 simple_mtx_unlock(&d3dlock_global);
255 return r;
256 }
257
258 static D3DTEXTUREFILTERTYPE NINE_WINAPI
LockBaseTexture9_GetAutoGenFilterType(struct NineBaseTexture9 * This)259 LockBaseTexture9_GetAutoGenFilterType( struct NineBaseTexture9 *This )
260 {
261 D3DTEXTUREFILTERTYPE r;
262 simple_mtx_lock(&d3dlock_global);
263 r = NineBaseTexture9_GetAutoGenFilterType(This);
264 simple_mtx_unlock(&d3dlock_global);
265 return r;
266 }
267
268 static void NINE_WINAPI
LockBaseTexture9_PreLoad(struct NineBaseTexture9 * This)269 LockBaseTexture9_PreLoad( struct NineBaseTexture9 *This )
270 {
271 simple_mtx_lock(&d3dlock_global);
272 NineBaseTexture9_PreLoad(This);
273 simple_mtx_unlock(&d3dlock_global);
274 }
275
276 static void NINE_WINAPI
LockBaseTexture9_GenerateMipSubLevels(struct NineBaseTexture9 * This)277 LockBaseTexture9_GenerateMipSubLevels( struct NineBaseTexture9 *This )
278 {
279 simple_mtx_lock(&d3dlock_global);
280 NineBaseTexture9_GenerateMipSubLevels(This);
281 simple_mtx_unlock(&d3dlock_global);
282 }
283
284 static HRESULT NINE_WINAPI
LockCryptoSession9_GetCertificateSize(struct NineCryptoSession9 * This,UINT * pCertificateSize)285 LockCryptoSession9_GetCertificateSize( struct NineCryptoSession9 *This,
286 UINT *pCertificateSize )
287 {
288 HRESULT r;
289 simple_mtx_lock(&d3dlock_global);
290 r = NineCryptoSession9_GetCertificateSize(This, pCertificateSize);
291 simple_mtx_unlock(&d3dlock_global);
292 return r;
293 }
294
295 static HRESULT NINE_WINAPI
LockCryptoSession9_GetCertificate(struct NineCryptoSession9 * This,UINT CertifacteSize,BYTE * ppCertificate)296 LockCryptoSession9_GetCertificate( struct NineCryptoSession9 *This,
297 UINT CertifacteSize,
298 BYTE *ppCertificate )
299 {
300 HRESULT r;
301 simple_mtx_lock(&d3dlock_global);
302 r = NineCryptoSession9_GetCertificate(This, CertifacteSize, ppCertificate);
303 simple_mtx_unlock(&d3dlock_global);
304 return r;
305 }
306
307 static HRESULT NINE_WINAPI
LockCryptoSession9_NegotiateKeyExchange(struct NineCryptoSession9 * This,UINT DataSize,void * pData)308 LockCryptoSession9_NegotiateKeyExchange( struct NineCryptoSession9 *This,
309 UINT DataSize,
310 void *pData )
311 {
312 HRESULT r;
313 simple_mtx_lock(&d3dlock_global);
314 r = NineCryptoSession9_NegotiateKeyExchange(This, DataSize, pData);
315 simple_mtx_unlock(&d3dlock_global);
316 return r;
317 }
318
319 static HRESULT NINE_WINAPI
LockCryptoSession9_EncryptionBlt(struct NineCryptoSession9 * This,IDirect3DSurface9 * pSrcSurface,IDirect3DSurface9 * pDstSurface,UINT DstSurfaceSize,void * pIV)320 LockCryptoSession9_EncryptionBlt( struct NineCryptoSession9 *This,
321 IDirect3DSurface9 *pSrcSurface,
322 IDirect3DSurface9 *pDstSurface,
323 UINT DstSurfaceSize,
324 void *pIV )
325 {
326 HRESULT r;
327 simple_mtx_lock(&d3dlock_global);
328 r = NineCryptoSession9_EncryptionBlt(This, pSrcSurface, pDstSurface, DstSurfaceSize, pIV);
329 simple_mtx_unlock(&d3dlock_global);
330 return r;
331 }
332
333 static HRESULT NINE_WINAPI
LockCryptoSession9_DecryptionBlt(struct NineCryptoSession9 * This,IDirect3DSurface9 * pSrcSurface,IDirect3DSurface9 * pDstSurface,UINT SrcSurfaceSize,D3DENCRYPTED_BLOCK_INFO * pEncryptedBlockInfo,void * pContentKey,void * pIV)334 LockCryptoSession9_DecryptionBlt( struct NineCryptoSession9 *This,
335 IDirect3DSurface9 *pSrcSurface,
336 IDirect3DSurface9 *pDstSurface,
337 UINT SrcSurfaceSize,
338 D3DENCRYPTED_BLOCK_INFO *pEncryptedBlockInfo,
339 void *pContentKey,
340 void *pIV )
341 {
342 HRESULT r;
343 simple_mtx_lock(&d3dlock_global);
344 r = NineCryptoSession9_DecryptionBlt(This, pSrcSurface, pDstSurface, SrcSurfaceSize, pEncryptedBlockInfo, pContentKey, pIV);
345 simple_mtx_unlock(&d3dlock_global);
346 return r;
347 }
348
349 static HRESULT NINE_WINAPI
LockCryptoSession9_GetSurfacePitch(struct NineCryptoSession9 * This,IDirect3DSurface9 * pSrcSurface,UINT * pSurfacePitch)350 LockCryptoSession9_GetSurfacePitch( struct NineCryptoSession9 *This,
351 IDirect3DSurface9 *pSrcSurface,
352 UINT *pSurfacePitch )
353 {
354 HRESULT r;
355 simple_mtx_lock(&d3dlock_global);
356 r = NineCryptoSession9_GetSurfacePitch(This, pSrcSurface, pSurfacePitch);
357 simple_mtx_unlock(&d3dlock_global);
358 return r;
359 }
360
361 static HRESULT NINE_WINAPI
LockCryptoSession9_StartSessionKeyRefresh(struct NineCryptoSession9 * This,void * pRandomNumber,UINT RandomNumberSize)362 LockCryptoSession9_StartSessionKeyRefresh( struct NineCryptoSession9 *This,
363 void *pRandomNumber,
364 UINT RandomNumberSize )
365 {
366 HRESULT r;
367 simple_mtx_lock(&d3dlock_global);
368 r = NineCryptoSession9_StartSessionKeyRefresh(This, pRandomNumber, RandomNumberSize);
369 simple_mtx_unlock(&d3dlock_global);
370 return r;
371 }
372
373 static HRESULT NINE_WINAPI
LockCryptoSession9_FinishSessionKeyRefresh(struct NineCryptoSession9 * This)374 LockCryptoSession9_FinishSessionKeyRefresh( struct NineCryptoSession9 *This )
375 {
376 HRESULT r;
377 simple_mtx_lock(&d3dlock_global);
378 r = NineCryptoSession9_FinishSessionKeyRefresh(This);
379 simple_mtx_unlock(&d3dlock_global);
380 return r;
381 }
382
383 static HRESULT NINE_WINAPI
LockCryptoSession9_GetEncryptionBltKey(struct NineCryptoSession9 * This,void * pReadbackKey,UINT KeySize)384 LockCryptoSession9_GetEncryptionBltKey( struct NineCryptoSession9 *This,
385 void *pReadbackKey,
386 UINT KeySize )
387 {
388 HRESULT r;
389 simple_mtx_lock(&d3dlock_global);
390 r = NineCryptoSession9_GetEncryptionBltKey(This, pReadbackKey, KeySize);
391 simple_mtx_unlock(&d3dlock_global);
392 return r;
393 }
394
395 IDirect3DCryptoSession9Vtbl LockCryptoSession9_vtable = {
396 (void *)NineUnknown_QueryInterface,
397 (void *)NineUnknown_AddRef,
398 (void *)NineUnknown_ReleaseWithDtorLock,
399 (void *)LockCryptoSession9_GetCertificateSize,
400 (void *)LockCryptoSession9_GetCertificate,
401 (void *)LockCryptoSession9_NegotiateKeyExchange,
402 (void *)LockCryptoSession9_EncryptionBlt,
403 (void *)LockCryptoSession9_DecryptionBlt,
404 (void *)LockCryptoSession9_GetSurfacePitch,
405 (void *)LockCryptoSession9_StartSessionKeyRefresh,
406 (void *)LockCryptoSession9_FinishSessionKeyRefresh,
407 (void *)LockCryptoSession9_GetEncryptionBltKey
408 };
409
410 #if 0
411 static HRESULT NINE_WINAPI
412 LockCubeTexture9_GetLevelDesc( struct NineCubeTexture9 *This,
413 UINT Level,
414 D3DSURFACE_DESC *pDesc )
415 {
416 HRESULT r;
417 simple_mtx_lock(&d3dlock_global);
418 r = NineCubeTexture9_GetLevelDesc(This, Level, pDesc);
419 simple_mtx_unlock(&d3dlock_global);
420 return r;
421 }
422 #endif
423
424 #if 0
425 static HRESULT NINE_WINAPI
426 LockCubeTexture9_GetCubeMapSurface( struct NineCubeTexture9 *This,
427 D3DCUBEMAP_FACES FaceType,
428 UINT Level,
429 IDirect3DSurface9 **ppCubeMapSurface )
430 {
431 HRESULT r;
432 simple_mtx_lock(&d3dlock_global);
433 r = NineCubeTexture9_GetCubeMapSurface(This, FaceType, Level, ppCubeMapSurface);
434 simple_mtx_unlock(&d3dlock_global);
435 return r;
436 }
437 #endif
438
439 static HRESULT NINE_WINAPI
LockCubeTexture9_LockRect(struct NineCubeTexture9 * This,D3DCUBEMAP_FACES FaceType,UINT Level,D3DLOCKED_RECT * pLockedRect,const RECT * pRect,DWORD Flags)440 LockCubeTexture9_LockRect( struct NineCubeTexture9 *This,
441 D3DCUBEMAP_FACES FaceType,
442 UINT Level,
443 D3DLOCKED_RECT *pLockedRect,
444 const RECT *pRect,
445 DWORD Flags )
446 {
447 HRESULT r;
448 simple_mtx_lock(&d3dlock_global);
449 r = NineCubeTexture9_LockRect(This, FaceType, Level, pLockedRect, pRect, Flags);
450 simple_mtx_unlock(&d3dlock_global);
451 return r;
452 }
453
454 static HRESULT NINE_WINAPI
LockCubeTexture9_UnlockRect(struct NineCubeTexture9 * This,D3DCUBEMAP_FACES FaceType,UINT Level)455 LockCubeTexture9_UnlockRect( struct NineCubeTexture9 *This,
456 D3DCUBEMAP_FACES FaceType,
457 UINT Level )
458 {
459 HRESULT r;
460 simple_mtx_lock(&d3dlock_global);
461 r = NineCubeTexture9_UnlockRect(This, FaceType, Level);
462 simple_mtx_unlock(&d3dlock_global);
463 return r;
464 }
465
466 static HRESULT NINE_WINAPI
LockCubeTexture9_AddDirtyRect(struct NineCubeTexture9 * This,D3DCUBEMAP_FACES FaceType,const RECT * pDirtyRect)467 LockCubeTexture9_AddDirtyRect( struct NineCubeTexture9 *This,
468 D3DCUBEMAP_FACES FaceType,
469 const RECT *pDirtyRect )
470 {
471 HRESULT r;
472 simple_mtx_lock(&d3dlock_global);
473 r = NineCubeTexture9_AddDirtyRect(This, FaceType, pDirtyRect);
474 simple_mtx_unlock(&d3dlock_global);
475 return r;
476 }
477
478 IDirect3DCubeTexture9Vtbl LockCubeTexture9_vtable = {
479 (void *)NineUnknown_QueryInterface,
480 (void *)NineUnknown_AddRef,
481 (void *)NineUnknown_ReleaseWithDtorLock,
482 (void *)NineUnknown_GetDevice, /* actually part of Resource9 iface */
483 (void *)LockUnknown_SetPrivateData,
484 (void *)LockUnknown_GetPrivateData,
485 (void *)LockUnknown_FreePrivateData,
486 (void *)LockResource9_SetPriority,
487 (void *)LockResource9_GetPriority,
488 (void *)LockBaseTexture9_PreLoad,
489 (void *)NineResource9_GetType, /* immutable */
490 (void *)LockBaseTexture9_SetLOD,
491 (void *)LockBaseTexture9_GetLOD,
492 (void *)LockBaseTexture9_GetLevelCount,
493 (void *)LockBaseTexture9_SetAutoGenFilterType,
494 (void *)LockBaseTexture9_GetAutoGenFilterType,
495 (void *)LockBaseTexture9_GenerateMipSubLevels,
496 (void *)NineCubeTexture9_GetLevelDesc, /* immutable */
497 (void *)NineCubeTexture9_GetCubeMapSurface, /* AddRef */
498 (void *)LockCubeTexture9_LockRect,
499 (void *)LockCubeTexture9_UnlockRect,
500 (void *)LockCubeTexture9_AddDirtyRect
501 };
502
503 static HRESULT NINE_WINAPI
LockDevice9_TestCooperativeLevel(struct NineDevice9 * This)504 LockDevice9_TestCooperativeLevel( struct NineDevice9 *This )
505 {
506 HRESULT r;
507 simple_mtx_lock(&d3dlock_global);
508 r = NineDevice9_TestCooperativeLevel(This);
509 simple_mtx_unlock(&d3dlock_global);
510 return r;
511 }
512
513 static UINT NINE_WINAPI
LockDevice9_GetAvailableTextureMem(struct NineDevice9 * This)514 LockDevice9_GetAvailableTextureMem( struct NineDevice9 *This )
515 {
516 UINT r;
517 simple_mtx_lock(&d3dlock_global);
518 r = NineDevice9_GetAvailableTextureMem(This);
519 simple_mtx_unlock(&d3dlock_global);
520 return r;
521 }
522
523 static HRESULT NINE_WINAPI
LockDevice9_EvictManagedResources(struct NineDevice9 * This)524 LockDevice9_EvictManagedResources( struct NineDevice9 *This )
525 {
526 HRESULT r;
527 simple_mtx_lock(&d3dlock_global);
528 r = NineDevice9_EvictManagedResources(This);
529 simple_mtx_unlock(&d3dlock_global);
530 return r;
531 }
532
533 static HRESULT NINE_WINAPI
LockDevice9_GetDirect3D(struct NineDevice9 * This,IDirect3D9 ** ppD3D9)534 LockDevice9_GetDirect3D( struct NineDevice9 *This,
535 IDirect3D9 **ppD3D9 )
536 {
537 HRESULT r;
538 simple_mtx_lock(&d3dlock_global);
539 r = NineDevice9_GetDirect3D(This, ppD3D9);
540 simple_mtx_unlock(&d3dlock_global);
541 return r;
542 }
543
544 #if 0
545 static HRESULT NINE_WINAPI
546 LockDevice9_GetDeviceCaps( struct NineDevice9 *This,
547 D3DCAPS9 *pCaps )
548 {
549 HRESULT r;
550 simple_mtx_lock(&d3dlock_global);
551 r = NineDevice9_GetDeviceCaps(This, pCaps);
552 simple_mtx_unlock(&d3dlock_global);
553 return r;
554 }
555 #endif
556
557 static HRESULT NINE_WINAPI
LockDevice9_GetDisplayMode(struct NineDevice9 * This,UINT iSwapChain,D3DDISPLAYMODE * pMode)558 LockDevice9_GetDisplayMode( struct NineDevice9 *This,
559 UINT iSwapChain,
560 D3DDISPLAYMODE *pMode )
561 {
562 HRESULT r;
563 simple_mtx_lock(&d3dlock_global);
564 r = NineDevice9_GetDisplayMode(This, iSwapChain, pMode);
565 simple_mtx_unlock(&d3dlock_global);
566 return r;
567 }
568
569 #if 0
570 static HRESULT NINE_WINAPI
571 LockDevice9_GetCreationParameters( struct NineDevice9 *This,
572 D3DDEVICE_CREATION_PARAMETERS *pParameters )
573 {
574 HRESULT r;
575 simple_mtx_lock(&d3dlock_global);
576 r = NineDevice9_GetCreationParameters(This, pParameters);
577 simple_mtx_unlock(&d3dlock_global);
578 return r;
579 }
580 #endif
581
582 static HRESULT NINE_WINAPI
LockDevice9_SetCursorProperties(struct NineDevice9 * This,UINT XHotSpot,UINT YHotSpot,IDirect3DSurface9 * pCursorBitmap)583 LockDevice9_SetCursorProperties( struct NineDevice9 *This,
584 UINT XHotSpot,
585 UINT YHotSpot,
586 IDirect3DSurface9 *pCursorBitmap )
587 {
588 HRESULT r;
589 simple_mtx_lock(&d3dlock_global);
590 r = NineDevice9_SetCursorProperties(This, XHotSpot, YHotSpot, pCursorBitmap);
591 simple_mtx_unlock(&d3dlock_global);
592 return r;
593 }
594
595 static void NINE_WINAPI
LockDevice9_SetCursorPosition(struct NineDevice9 * This,int X,int Y,DWORD Flags)596 LockDevice9_SetCursorPosition( struct NineDevice9 *This,
597 int X,
598 int Y,
599 DWORD Flags )
600 {
601 simple_mtx_lock(&d3dlock_global);
602 NineDevice9_SetCursorPosition(This, X, Y, Flags);
603 simple_mtx_unlock(&d3dlock_global);
604 }
605
606 static BOOL NINE_WINAPI
LockDevice9_ShowCursor(struct NineDevice9 * This,BOOL bShow)607 LockDevice9_ShowCursor( struct NineDevice9 *This,
608 BOOL bShow )
609 {
610 BOOL r;
611 simple_mtx_lock(&d3dlock_global);
612 r = NineDevice9_ShowCursor(This, bShow);
613 simple_mtx_unlock(&d3dlock_global);
614 return r;
615 }
616
617 static HRESULT NINE_WINAPI
LockDevice9_CreateAdditionalSwapChain(struct NineDevice9 * This,D3DPRESENT_PARAMETERS * pPresentationParameters,IDirect3DSwapChain9 ** pSwapChain)618 LockDevice9_CreateAdditionalSwapChain( struct NineDevice9 *This,
619 D3DPRESENT_PARAMETERS *pPresentationParameters,
620 IDirect3DSwapChain9 **pSwapChain )
621 {
622 HRESULT r;
623 simple_mtx_lock(&d3dlock_global);
624 r = NineDevice9_CreateAdditionalSwapChain(This, pPresentationParameters, pSwapChain);
625 simple_mtx_unlock(&d3dlock_global);
626 return r;
627 }
628
629 static HRESULT NINE_WINAPI
LockDevice9_GetSwapChain(struct NineDevice9 * This,UINT iSwapChain,IDirect3DSwapChain9 ** pSwapChain)630 LockDevice9_GetSwapChain( struct NineDevice9 *This,
631 UINT iSwapChain,
632 IDirect3DSwapChain9 **pSwapChain )
633 {
634 HRESULT r;
635 simple_mtx_lock(&d3dlock_global);
636 r = NineDevice9_GetSwapChain(This, iSwapChain, pSwapChain);
637 simple_mtx_unlock(&d3dlock_global);
638 return r;
639 }
640
641 static UINT NINE_WINAPI
LockDevice9_GetNumberOfSwapChains(struct NineDevice9 * This)642 LockDevice9_GetNumberOfSwapChains( struct NineDevice9 *This )
643 {
644 UINT r;
645 simple_mtx_lock(&d3dlock_global);
646 r = NineDevice9_GetNumberOfSwapChains(This);
647 simple_mtx_unlock(&d3dlock_global);
648 return r;
649 }
650
651 static HRESULT NINE_WINAPI
LockDevice9_Reset(struct NineDevice9 * This,D3DPRESENT_PARAMETERS * pPresentationParameters)652 LockDevice9_Reset( struct NineDevice9 *This,
653 D3DPRESENT_PARAMETERS *pPresentationParameters )
654 {
655 HRESULT r;
656 simple_mtx_lock(&d3dlock_global);
657 r = NineDevice9_Reset(This, pPresentationParameters);
658 simple_mtx_unlock(&d3dlock_global);
659 return r;
660 }
661
662 static HRESULT NINE_WINAPI
LockDevice9_Present(struct NineDevice9 * This,const RECT * pSourceRect,const RECT * pDestRect,HWND hDestWindowOverride,const RGNDATA * pDirtyRegion)663 LockDevice9_Present( struct NineDevice9 *This,
664 const RECT *pSourceRect,
665 const RECT *pDestRect,
666 HWND hDestWindowOverride,
667 const RGNDATA *pDirtyRegion )
668 {
669 HRESULT r;
670 simple_mtx_lock(&d3dlock_global);
671 r = NineDevice9_Present(This, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
672 simple_mtx_unlock(&d3dlock_global);
673 return r;
674 }
675
676 static HRESULT NINE_WINAPI
LockDevice9_GetBackBuffer(struct NineDevice9 * This,UINT iSwapChain,UINT iBackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface9 ** ppBackBuffer)677 LockDevice9_GetBackBuffer( struct NineDevice9 *This,
678 UINT iSwapChain,
679 UINT iBackBuffer,
680 D3DBACKBUFFER_TYPE Type,
681 IDirect3DSurface9 **ppBackBuffer )
682 {
683 HRESULT r;
684 simple_mtx_lock(&d3dlock_global);
685 r = NineDevice9_GetBackBuffer(This, iSwapChain, iBackBuffer, Type, ppBackBuffer);
686 simple_mtx_unlock(&d3dlock_global);
687 return r;
688 }
689
690 static HRESULT NINE_WINAPI
LockDevice9_GetRasterStatus(struct NineDevice9 * This,UINT iSwapChain,D3DRASTER_STATUS * pRasterStatus)691 LockDevice9_GetRasterStatus( struct NineDevice9 *This,
692 UINT iSwapChain,
693 D3DRASTER_STATUS *pRasterStatus )
694 {
695 HRESULT r;
696 simple_mtx_lock(&d3dlock_global);
697 r = NineDevice9_GetRasterStatus(This, iSwapChain, pRasterStatus);
698 simple_mtx_unlock(&d3dlock_global);
699 return r;
700 }
701
702 static HRESULT NINE_WINAPI
LockDevice9_SetDialogBoxMode(struct NineDevice9 * This,BOOL bEnableDialogs)703 LockDevice9_SetDialogBoxMode( struct NineDevice9 *This,
704 BOOL bEnableDialogs )
705 {
706 HRESULT r;
707 simple_mtx_lock(&d3dlock_global);
708 r = NineDevice9_SetDialogBoxMode(This, bEnableDialogs);
709 simple_mtx_unlock(&d3dlock_global);
710 return r;
711 }
712
713 static void NINE_WINAPI
LockDevice9_SetGammaRamp(struct NineDevice9 * This,UINT iSwapChain,DWORD Flags,const D3DGAMMARAMP * pRamp)714 LockDevice9_SetGammaRamp( struct NineDevice9 *This,
715 UINT iSwapChain,
716 DWORD Flags,
717 const D3DGAMMARAMP *pRamp )
718 {
719 simple_mtx_lock(&d3dlock_global);
720 NineDevice9_SetGammaRamp(This, iSwapChain, Flags, pRamp);
721 simple_mtx_unlock(&d3dlock_global);
722 }
723
724 static void NINE_WINAPI
LockDevice9_GetGammaRamp(struct NineDevice9 * This,UINT iSwapChain,D3DGAMMARAMP * pRamp)725 LockDevice9_GetGammaRamp( struct NineDevice9 *This,
726 UINT iSwapChain,
727 D3DGAMMARAMP *pRamp )
728 {
729 simple_mtx_lock(&d3dlock_global);
730 NineDevice9_GetGammaRamp(This, iSwapChain, pRamp);
731 simple_mtx_unlock(&d3dlock_global);
732 }
733
734 static HRESULT NINE_WINAPI
LockDevice9_CreateTexture(struct NineDevice9 * This,UINT Width,UINT Height,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DTexture9 ** ppTexture,HANDLE * pSharedHandle)735 LockDevice9_CreateTexture( struct NineDevice9 *This,
736 UINT Width,
737 UINT Height,
738 UINT Levels,
739 DWORD Usage,
740 D3DFORMAT Format,
741 D3DPOOL Pool,
742 IDirect3DTexture9 **ppTexture,
743 HANDLE *pSharedHandle )
744 {
745 HRESULT r;
746 simple_mtx_lock(&d3dlock_global);
747 r = NineDevice9_CreateTexture(This, Width, Height, Levels, Usage, Format, Pool, ppTexture, pSharedHandle);
748 simple_mtx_unlock(&d3dlock_global);
749 return r;
750 }
751
752 static HRESULT NINE_WINAPI
LockDevice9_CreateVolumeTexture(struct NineDevice9 * This,UINT Width,UINT Height,UINT Depth,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DVolumeTexture9 ** ppVolumeTexture,HANDLE * pSharedHandle)753 LockDevice9_CreateVolumeTexture( struct NineDevice9 *This,
754 UINT Width,
755 UINT Height,
756 UINT Depth,
757 UINT Levels,
758 DWORD Usage,
759 D3DFORMAT Format,
760 D3DPOOL Pool,
761 IDirect3DVolumeTexture9 **ppVolumeTexture,
762 HANDLE *pSharedHandle )
763 {
764 HRESULT r;
765 simple_mtx_lock(&d3dlock_global);
766 r = NineDevice9_CreateVolumeTexture(This, Width, Height, Depth, Levels, Usage, Format, Pool, ppVolumeTexture, pSharedHandle);
767 simple_mtx_unlock(&d3dlock_global);
768 return r;
769 }
770
771 static HRESULT NINE_WINAPI
LockDevice9_CreateCubeTexture(struct NineDevice9 * This,UINT EdgeLength,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DCubeTexture9 ** ppCubeTexture,HANDLE * pSharedHandle)772 LockDevice9_CreateCubeTexture( struct NineDevice9 *This,
773 UINT EdgeLength,
774 UINT Levels,
775 DWORD Usage,
776 D3DFORMAT Format,
777 D3DPOOL Pool,
778 IDirect3DCubeTexture9 **ppCubeTexture,
779 HANDLE *pSharedHandle )
780 {
781 HRESULT r;
782 simple_mtx_lock(&d3dlock_global);
783 r = NineDevice9_CreateCubeTexture(This, EdgeLength, Levels, Usage, Format, Pool, ppCubeTexture, pSharedHandle);
784 simple_mtx_unlock(&d3dlock_global);
785 return r;
786 }
787
788 static HRESULT NINE_WINAPI
LockDevice9_CreateVertexBuffer(struct NineDevice9 * This,UINT Length,DWORD Usage,DWORD FVF,D3DPOOL Pool,IDirect3DVertexBuffer9 ** ppVertexBuffer,HANDLE * pSharedHandle)789 LockDevice9_CreateVertexBuffer( struct NineDevice9 *This,
790 UINT Length,
791 DWORD Usage,
792 DWORD FVF,
793 D3DPOOL Pool,
794 IDirect3DVertexBuffer9 **ppVertexBuffer,
795 HANDLE *pSharedHandle )
796 {
797 HRESULT r;
798 simple_mtx_lock(&d3dlock_global);
799 r = NineDevice9_CreateVertexBuffer(This, Length, Usage, FVF, Pool, ppVertexBuffer, pSharedHandle);
800 simple_mtx_unlock(&d3dlock_global);
801 return r;
802 }
803
804 static HRESULT NINE_WINAPI
LockDevice9_CreateIndexBuffer(struct NineDevice9 * This,UINT Length,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DIndexBuffer9 ** ppIndexBuffer,HANDLE * pSharedHandle)805 LockDevice9_CreateIndexBuffer( struct NineDevice9 *This,
806 UINT Length,
807 DWORD Usage,
808 D3DFORMAT Format,
809 D3DPOOL Pool,
810 IDirect3DIndexBuffer9 **ppIndexBuffer,
811 HANDLE *pSharedHandle )
812 {
813 HRESULT r;
814 simple_mtx_lock(&d3dlock_global);
815 r = NineDevice9_CreateIndexBuffer(This, Length, Usage, Format, Pool, ppIndexBuffer, pSharedHandle);
816 simple_mtx_unlock(&d3dlock_global);
817 return r;
818 }
819
820 static HRESULT NINE_WINAPI
LockDevice9_CreateRenderTarget(struct NineDevice9 * This,UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Lockable,IDirect3DSurface9 ** ppSurface,HANDLE * pSharedHandle)821 LockDevice9_CreateRenderTarget( struct NineDevice9 *This,
822 UINT Width,
823 UINT Height,
824 D3DFORMAT Format,
825 D3DMULTISAMPLE_TYPE MultiSample,
826 DWORD MultisampleQuality,
827 BOOL Lockable,
828 IDirect3DSurface9 **ppSurface,
829 HANDLE *pSharedHandle )
830 {
831 HRESULT r;
832 simple_mtx_lock(&d3dlock_global);
833 r = NineDevice9_CreateRenderTarget(This, Width, Height, Format, MultiSample, MultisampleQuality, Lockable, ppSurface, pSharedHandle);
834 simple_mtx_unlock(&d3dlock_global);
835 return r;
836 }
837
838 static HRESULT NINE_WINAPI
LockDevice9_CreateDepthStencilSurface(struct NineDevice9 * This,UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Discard,IDirect3DSurface9 ** ppSurface,HANDLE * pSharedHandle)839 LockDevice9_CreateDepthStencilSurface( struct NineDevice9 *This,
840 UINT Width,
841 UINT Height,
842 D3DFORMAT Format,
843 D3DMULTISAMPLE_TYPE MultiSample,
844 DWORD MultisampleQuality,
845 BOOL Discard,
846 IDirect3DSurface9 **ppSurface,
847 HANDLE *pSharedHandle )
848 {
849 HRESULT r;
850 simple_mtx_lock(&d3dlock_global);
851 r = NineDevice9_CreateDepthStencilSurface(This, Width, Height, Format, MultiSample, MultisampleQuality, Discard, ppSurface, pSharedHandle);
852 simple_mtx_unlock(&d3dlock_global);
853 return r;
854 }
855
856 static HRESULT NINE_WINAPI
LockDevice9_UpdateSurface(struct NineDevice9 * This,IDirect3DSurface9 * pSourceSurface,const RECT * pSourceRect,IDirect3DSurface9 * pDestinationSurface,const POINT * pDestPoint)857 LockDevice9_UpdateSurface( struct NineDevice9 *This,
858 IDirect3DSurface9 *pSourceSurface,
859 const RECT *pSourceRect,
860 IDirect3DSurface9 *pDestinationSurface,
861 const POINT *pDestPoint )
862 {
863 HRESULT r;
864 simple_mtx_lock(&d3dlock_global);
865 r = NineDevice9_UpdateSurface(This, pSourceSurface, pSourceRect, pDestinationSurface, pDestPoint);
866 simple_mtx_unlock(&d3dlock_global);
867 return r;
868 }
869
870 static HRESULT NINE_WINAPI
LockDevice9_UpdateTexture(struct NineDevice9 * This,IDirect3DBaseTexture9 * pSourceTexture,IDirect3DBaseTexture9 * pDestinationTexture)871 LockDevice9_UpdateTexture( struct NineDevice9 *This,
872 IDirect3DBaseTexture9 *pSourceTexture,
873 IDirect3DBaseTexture9 *pDestinationTexture )
874 {
875 HRESULT r;
876 simple_mtx_lock(&d3dlock_global);
877 r = NineDevice9_UpdateTexture(This, pSourceTexture, pDestinationTexture);
878 simple_mtx_unlock(&d3dlock_global);
879 return r;
880 }
881
882 static HRESULT NINE_WINAPI
LockDevice9_GetRenderTargetData(struct NineDevice9 * This,IDirect3DSurface9 * pRenderTarget,IDirect3DSurface9 * pDestSurface)883 LockDevice9_GetRenderTargetData( struct NineDevice9 *This,
884 IDirect3DSurface9 *pRenderTarget,
885 IDirect3DSurface9 *pDestSurface )
886 {
887 HRESULT r;
888 simple_mtx_lock(&d3dlock_global);
889 r = NineDevice9_GetRenderTargetData(This, pRenderTarget, pDestSurface);
890 simple_mtx_unlock(&d3dlock_global);
891 return r;
892 }
893
894 static HRESULT NINE_WINAPI
LockDevice9_GetFrontBufferData(struct NineDevice9 * This,UINT iSwapChain,IDirect3DSurface9 * pDestSurface)895 LockDevice9_GetFrontBufferData( struct NineDevice9 *This,
896 UINT iSwapChain,
897 IDirect3DSurface9 *pDestSurface )
898 {
899 HRESULT r;
900 simple_mtx_lock(&d3dlock_global);
901 r = NineDevice9_GetFrontBufferData(This, iSwapChain, pDestSurface);
902 simple_mtx_unlock(&d3dlock_global);
903 return r;
904 }
905
906 static HRESULT NINE_WINAPI
LockDevice9_StretchRect(struct NineDevice9 * This,IDirect3DSurface9 * pSourceSurface,const RECT * pSourceRect,IDirect3DSurface9 * pDestSurface,const RECT * pDestRect,D3DTEXTUREFILTERTYPE Filter)907 LockDevice9_StretchRect( struct NineDevice9 *This,
908 IDirect3DSurface9 *pSourceSurface,
909 const RECT *pSourceRect,
910 IDirect3DSurface9 *pDestSurface,
911 const RECT *pDestRect,
912 D3DTEXTUREFILTERTYPE Filter )
913 {
914 HRESULT r;
915 simple_mtx_lock(&d3dlock_global);
916 r = NineDevice9_StretchRect(This, pSourceSurface, pSourceRect, pDestSurface, pDestRect, Filter);
917 simple_mtx_unlock(&d3dlock_global);
918 return r;
919 }
920
921 static HRESULT NINE_WINAPI
LockDevice9_ColorFill(struct NineDevice9 * This,IDirect3DSurface9 * pSurface,const RECT * pRect,D3DCOLOR color)922 LockDevice9_ColorFill( struct NineDevice9 *This,
923 IDirect3DSurface9 *pSurface,
924 const RECT *pRect,
925 D3DCOLOR color )
926 {
927 HRESULT r;
928 simple_mtx_lock(&d3dlock_global);
929 r = NineDevice9_ColorFill(This, pSurface, pRect, color);
930 simple_mtx_unlock(&d3dlock_global);
931 return r;
932 }
933
934 static HRESULT NINE_WINAPI
LockDevice9_CreateOffscreenPlainSurface(struct NineDevice9 * This,UINT Width,UINT Height,D3DFORMAT Format,D3DPOOL Pool,IDirect3DSurface9 ** ppSurface,HANDLE * pSharedHandle)935 LockDevice9_CreateOffscreenPlainSurface( struct NineDevice9 *This,
936 UINT Width,
937 UINT Height,
938 D3DFORMAT Format,
939 D3DPOOL Pool,
940 IDirect3DSurface9 **ppSurface,
941 HANDLE *pSharedHandle )
942 {
943 HRESULT r;
944 simple_mtx_lock(&d3dlock_global);
945 r = NineDevice9_CreateOffscreenPlainSurface(This, Width, Height, Format, Pool, ppSurface, pSharedHandle);
946 simple_mtx_unlock(&d3dlock_global);
947 return r;
948 }
949
950 static HRESULT NINE_WINAPI
LockDevice9_SetRenderTarget(struct NineDevice9 * This,DWORD RenderTargetIndex,IDirect3DSurface9 * pRenderTarget)951 LockDevice9_SetRenderTarget( struct NineDevice9 *This,
952 DWORD RenderTargetIndex,
953 IDirect3DSurface9 *pRenderTarget )
954 {
955 HRESULT r;
956 simple_mtx_lock(&d3dlock_global);
957 r = NineDevice9_SetRenderTarget(This, RenderTargetIndex, pRenderTarget);
958 simple_mtx_unlock(&d3dlock_global);
959 return r;
960 }
961
962 static HRESULT NINE_WINAPI
LockDevice9_GetRenderTarget(struct NineDevice9 * This,DWORD RenderTargetIndex,IDirect3DSurface9 ** ppRenderTarget)963 LockDevice9_GetRenderTarget( struct NineDevice9 *This,
964 DWORD RenderTargetIndex,
965 IDirect3DSurface9 **ppRenderTarget )
966 {
967 HRESULT r;
968 simple_mtx_lock(&d3dlock_global);
969 r = NineDevice9_GetRenderTarget(This, RenderTargetIndex, ppRenderTarget);
970 simple_mtx_unlock(&d3dlock_global);
971 return r;
972 }
973
974 static HRESULT NINE_WINAPI
LockDevice9_SetDepthStencilSurface(struct NineDevice9 * This,IDirect3DSurface9 * pNewZStencil)975 LockDevice9_SetDepthStencilSurface( struct NineDevice9 *This,
976 IDirect3DSurface9 *pNewZStencil )
977 {
978 HRESULT r;
979 simple_mtx_lock(&d3dlock_global);
980 r = NineDevice9_SetDepthStencilSurface(This, pNewZStencil);
981 simple_mtx_unlock(&d3dlock_global);
982 return r;
983 }
984
985 static HRESULT NINE_WINAPI
LockDevice9_GetDepthStencilSurface(struct NineDevice9 * This,IDirect3DSurface9 ** ppZStencilSurface)986 LockDevice9_GetDepthStencilSurface( struct NineDevice9 *This,
987 IDirect3DSurface9 **ppZStencilSurface )
988 {
989 HRESULT r;
990 simple_mtx_lock(&d3dlock_global);
991 r = NineDevice9_GetDepthStencilSurface(This, ppZStencilSurface);
992 simple_mtx_unlock(&d3dlock_global);
993 return r;
994 }
995
996 static HRESULT NINE_WINAPI
LockDevice9_BeginScene(struct NineDevice9 * This)997 LockDevice9_BeginScene( struct NineDevice9 *This )
998 {
999 HRESULT r;
1000 simple_mtx_lock(&d3dlock_global);
1001 r = NineDevice9_BeginScene(This);
1002 simple_mtx_unlock(&d3dlock_global);
1003 return r;
1004 }
1005
1006 static HRESULT NINE_WINAPI
LockDevice9_EndScene(struct NineDevice9 * This)1007 LockDevice9_EndScene( struct NineDevice9 *This )
1008 {
1009 HRESULT r;
1010 simple_mtx_lock(&d3dlock_global);
1011 r = NineDevice9_EndScene(This);
1012 simple_mtx_unlock(&d3dlock_global);
1013 return r;
1014 }
1015
1016 static HRESULT NINE_WINAPI
LockDevice9_Clear(struct NineDevice9 * This,DWORD Count,const D3DRECT * pRects,DWORD Flags,D3DCOLOR Color,float Z,DWORD Stencil)1017 LockDevice9_Clear( struct NineDevice9 *This,
1018 DWORD Count,
1019 const D3DRECT *pRects,
1020 DWORD Flags,
1021 D3DCOLOR Color,
1022 float Z,
1023 DWORD Stencil )
1024 {
1025 HRESULT r;
1026 simple_mtx_lock(&d3dlock_global);
1027 r = NineDevice9_Clear(This, Count, pRects, Flags, Color, Z, Stencil);
1028 simple_mtx_unlock(&d3dlock_global);
1029 return r;
1030 }
1031
1032 static HRESULT NINE_WINAPI
LockDevice9_SetTransform(struct NineDevice9 * This,D3DTRANSFORMSTATETYPE State,const D3DMATRIX * pMatrix)1033 LockDevice9_SetTransform( struct NineDevice9 *This,
1034 D3DTRANSFORMSTATETYPE State,
1035 const D3DMATRIX *pMatrix )
1036 {
1037 HRESULT r;
1038 simple_mtx_lock(&d3dlock_global);
1039 r = NineDevice9_SetTransform(This, State, pMatrix);
1040 simple_mtx_unlock(&d3dlock_global);
1041 return r;
1042 }
1043
1044 static HRESULT NINE_WINAPI
LockDevice9_GetTransform(struct NineDevice9 * This,D3DTRANSFORMSTATETYPE State,D3DMATRIX * pMatrix)1045 LockDevice9_GetTransform( struct NineDevice9 *This,
1046 D3DTRANSFORMSTATETYPE State,
1047 D3DMATRIX *pMatrix )
1048 {
1049 HRESULT r;
1050 simple_mtx_lock(&d3dlock_global);
1051 r = NineDevice9_GetTransform(This, State, pMatrix);
1052 simple_mtx_unlock(&d3dlock_global);
1053 return r;
1054 }
1055
1056 static HRESULT NINE_WINAPI
LockDevice9_MultiplyTransform(struct NineDevice9 * This,D3DTRANSFORMSTATETYPE State,const D3DMATRIX * pMatrix)1057 LockDevice9_MultiplyTransform( struct NineDevice9 *This,
1058 D3DTRANSFORMSTATETYPE State,
1059 const D3DMATRIX *pMatrix )
1060 {
1061 HRESULT r;
1062 simple_mtx_lock(&d3dlock_global);
1063 r = NineDevice9_MultiplyTransform(This, State, pMatrix);
1064 simple_mtx_unlock(&d3dlock_global);
1065 return r;
1066 }
1067
1068 static HRESULT NINE_WINAPI
LockDevice9_SetViewport(struct NineDevice9 * This,const D3DVIEWPORT9 * pViewport)1069 LockDevice9_SetViewport( struct NineDevice9 *This,
1070 const D3DVIEWPORT9 *pViewport )
1071 {
1072 HRESULT r;
1073 simple_mtx_lock(&d3dlock_global);
1074 r = NineDevice9_SetViewport(This, pViewport);
1075 simple_mtx_unlock(&d3dlock_global);
1076 return r;
1077 }
1078
1079 static HRESULT NINE_WINAPI
LockDevice9_GetViewport(struct NineDevice9 * This,D3DVIEWPORT9 * pViewport)1080 LockDevice9_GetViewport( struct NineDevice9 *This,
1081 D3DVIEWPORT9 *pViewport )
1082 {
1083 HRESULT r;
1084 simple_mtx_lock(&d3dlock_global);
1085 r = NineDevice9_GetViewport(This, pViewport);
1086 simple_mtx_unlock(&d3dlock_global);
1087 return r;
1088 }
1089
1090 static HRESULT NINE_WINAPI
LockDevice9_SetMaterial(struct NineDevice9 * This,const D3DMATERIAL9 * pMaterial)1091 LockDevice9_SetMaterial( struct NineDevice9 *This,
1092 const D3DMATERIAL9 *pMaterial )
1093 {
1094 HRESULT r;
1095 simple_mtx_lock(&d3dlock_global);
1096 r = NineDevice9_SetMaterial(This, pMaterial);
1097 simple_mtx_unlock(&d3dlock_global);
1098 return r;
1099 }
1100
1101 static HRESULT NINE_WINAPI
LockDevice9_GetMaterial(struct NineDevice9 * This,D3DMATERIAL9 * pMaterial)1102 LockDevice9_GetMaterial( struct NineDevice9 *This,
1103 D3DMATERIAL9 *pMaterial )
1104 {
1105 HRESULT r;
1106 simple_mtx_lock(&d3dlock_global);
1107 r = NineDevice9_GetMaterial(This, pMaterial);
1108 simple_mtx_unlock(&d3dlock_global);
1109 return r;
1110 }
1111
1112 static HRESULT NINE_WINAPI
LockDevice9_SetLight(struct NineDevice9 * This,DWORD Index,const D3DLIGHT9 * pLight)1113 LockDevice9_SetLight( struct NineDevice9 *This,
1114 DWORD Index,
1115 const D3DLIGHT9 *pLight )
1116 {
1117 HRESULT r;
1118 simple_mtx_lock(&d3dlock_global);
1119 r = NineDevice9_SetLight(This, Index, pLight);
1120 simple_mtx_unlock(&d3dlock_global);
1121 return r;
1122 }
1123
1124 static HRESULT NINE_WINAPI
LockDevice9_GetLight(struct NineDevice9 * This,DWORD Index,D3DLIGHT9 * pLight)1125 LockDevice9_GetLight( struct NineDevice9 *This,
1126 DWORD Index,
1127 D3DLIGHT9 *pLight )
1128 {
1129 HRESULT r;
1130 simple_mtx_lock(&d3dlock_global);
1131 r = NineDevice9_GetLight(This, Index, pLight);
1132 simple_mtx_unlock(&d3dlock_global);
1133 return r;
1134 }
1135
1136 static HRESULT NINE_WINAPI
LockDevice9_LightEnable(struct NineDevice9 * This,DWORD Index,BOOL Enable)1137 LockDevice9_LightEnable( struct NineDevice9 *This,
1138 DWORD Index,
1139 BOOL Enable )
1140 {
1141 HRESULT r;
1142 simple_mtx_lock(&d3dlock_global);
1143 r = NineDevice9_LightEnable(This, Index, Enable);
1144 simple_mtx_unlock(&d3dlock_global);
1145 return r;
1146 }
1147
1148 static HRESULT NINE_WINAPI
LockDevice9_GetLightEnable(struct NineDevice9 * This,DWORD Index,BOOL * pEnable)1149 LockDevice9_GetLightEnable( struct NineDevice9 *This,
1150 DWORD Index,
1151 BOOL *pEnable )
1152 {
1153 HRESULT r;
1154 simple_mtx_lock(&d3dlock_global);
1155 r = NineDevice9_GetLightEnable(This, Index, pEnable);
1156 simple_mtx_unlock(&d3dlock_global);
1157 return r;
1158 }
1159
1160 static HRESULT NINE_WINAPI
LockDevice9_SetClipPlane(struct NineDevice9 * This,DWORD Index,const float * pPlane)1161 LockDevice9_SetClipPlane( struct NineDevice9 *This,
1162 DWORD Index,
1163 const float *pPlane )
1164 {
1165 HRESULT r;
1166 simple_mtx_lock(&d3dlock_global);
1167 r = NineDevice9_SetClipPlane(This, Index, pPlane);
1168 simple_mtx_unlock(&d3dlock_global);
1169 return r;
1170 }
1171
1172 static HRESULT NINE_WINAPI
LockDevice9_GetClipPlane(struct NineDevice9 * This,DWORD Index,float * pPlane)1173 LockDevice9_GetClipPlane( struct NineDevice9 *This,
1174 DWORD Index,
1175 float *pPlane )
1176 {
1177 HRESULT r;
1178 simple_mtx_lock(&d3dlock_global);
1179 r = NineDevice9_GetClipPlane(This, Index, pPlane);
1180 simple_mtx_unlock(&d3dlock_global);
1181 return r;
1182 }
1183
1184 static HRESULT NINE_WINAPI
LockDevice9_SetRenderState(struct NineDevice9 * This,D3DRENDERSTATETYPE State,DWORD Value)1185 LockDevice9_SetRenderState( struct NineDevice9 *This,
1186 D3DRENDERSTATETYPE State,
1187 DWORD Value )
1188 {
1189 HRESULT r;
1190 simple_mtx_lock(&d3dlock_global);
1191 r = NineDevice9_SetRenderState(This, State, Value);
1192 simple_mtx_unlock(&d3dlock_global);
1193 return r;
1194 }
1195
1196 static HRESULT NINE_WINAPI
LockDevice9_GetRenderState(struct NineDevice9 * This,D3DRENDERSTATETYPE State,DWORD * pValue)1197 LockDevice9_GetRenderState( struct NineDevice9 *This,
1198 D3DRENDERSTATETYPE State,
1199 DWORD *pValue )
1200 {
1201 HRESULT r;
1202 simple_mtx_lock(&d3dlock_global);
1203 r = NineDevice9_GetRenderState(This, State, pValue);
1204 simple_mtx_unlock(&d3dlock_global);
1205 return r;
1206 }
1207
1208 static HRESULT NINE_WINAPI
LockDevice9_CreateStateBlock(struct NineDevice9 * This,D3DSTATEBLOCKTYPE Type,IDirect3DStateBlock9 ** ppSB)1209 LockDevice9_CreateStateBlock( struct NineDevice9 *This,
1210 D3DSTATEBLOCKTYPE Type,
1211 IDirect3DStateBlock9 **ppSB )
1212 {
1213 HRESULT r;
1214 simple_mtx_lock(&d3dlock_global);
1215 r = NineDevice9_CreateStateBlock(This, Type, ppSB);
1216 simple_mtx_unlock(&d3dlock_global);
1217 return r;
1218 }
1219
1220 static HRESULT NINE_WINAPI
LockDevice9_BeginStateBlock(struct NineDevice9 * This)1221 LockDevice9_BeginStateBlock( struct NineDevice9 *This )
1222 {
1223 HRESULT r;
1224 simple_mtx_lock(&d3dlock_global);
1225 r = NineDevice9_BeginStateBlock(This);
1226 simple_mtx_unlock(&d3dlock_global);
1227 return r;
1228 }
1229
1230 static HRESULT NINE_WINAPI
LockDevice9_EndStateBlock(struct NineDevice9 * This,IDirect3DStateBlock9 ** ppSB)1231 LockDevice9_EndStateBlock( struct NineDevice9 *This,
1232 IDirect3DStateBlock9 **ppSB )
1233 {
1234 HRESULT r;
1235 simple_mtx_lock(&d3dlock_global);
1236 r = NineDevice9_EndStateBlock(This, ppSB);
1237 simple_mtx_unlock(&d3dlock_global);
1238 return r;
1239 }
1240
1241 static HRESULT NINE_WINAPI
LockDevice9_SetClipStatus(struct NineDevice9 * This,const D3DCLIPSTATUS9 * pClipStatus)1242 LockDevice9_SetClipStatus( struct NineDevice9 *This,
1243 const D3DCLIPSTATUS9 *pClipStatus )
1244 {
1245 HRESULT r;
1246 simple_mtx_lock(&d3dlock_global);
1247 r = NineDevice9_SetClipStatus(This, pClipStatus);
1248 simple_mtx_unlock(&d3dlock_global);
1249 return r;
1250 }
1251
1252 static HRESULT NINE_WINAPI
LockDevice9_GetClipStatus(struct NineDevice9 * This,D3DCLIPSTATUS9 * pClipStatus)1253 LockDevice9_GetClipStatus( struct NineDevice9 *This,
1254 D3DCLIPSTATUS9 *pClipStatus )
1255 {
1256 HRESULT r;
1257 simple_mtx_lock(&d3dlock_global);
1258 r = NineDevice9_GetClipStatus(This, pClipStatus);
1259 simple_mtx_unlock(&d3dlock_global);
1260 return r;
1261 }
1262
1263 static HRESULT NINE_WINAPI
LockDevice9_GetTexture(struct NineDevice9 * This,DWORD Stage,IDirect3DBaseTexture9 ** ppTexture)1264 LockDevice9_GetTexture( struct NineDevice9 *This,
1265 DWORD Stage,
1266 IDirect3DBaseTexture9 **ppTexture )
1267 {
1268 HRESULT r;
1269 simple_mtx_lock(&d3dlock_global);
1270 r = NineDevice9_GetTexture(This, Stage, ppTexture);
1271 simple_mtx_unlock(&d3dlock_global);
1272 return r;
1273 }
1274
1275 static HRESULT NINE_WINAPI
LockDevice9_SetTexture(struct NineDevice9 * This,DWORD Stage,IDirect3DBaseTexture9 * pTexture)1276 LockDevice9_SetTexture( struct NineDevice9 *This,
1277 DWORD Stage,
1278 IDirect3DBaseTexture9 *pTexture )
1279 {
1280 HRESULT r;
1281 simple_mtx_lock(&d3dlock_global);
1282 r = NineDevice9_SetTexture(This, Stage, pTexture);
1283 simple_mtx_unlock(&d3dlock_global);
1284 return r;
1285 }
1286
1287 static HRESULT NINE_WINAPI
LockDevice9_GetTextureStageState(struct NineDevice9 * This,DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD * pValue)1288 LockDevice9_GetTextureStageState( struct NineDevice9 *This,
1289 DWORD Stage,
1290 D3DTEXTURESTAGESTATETYPE Type,
1291 DWORD *pValue )
1292 {
1293 HRESULT r;
1294 simple_mtx_lock(&d3dlock_global);
1295 r = NineDevice9_GetTextureStageState(This, Stage, Type, pValue);
1296 simple_mtx_unlock(&d3dlock_global);
1297 return r;
1298 }
1299
1300 static HRESULT NINE_WINAPI
LockDevice9_SetTextureStageState(struct NineDevice9 * This,DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD Value)1301 LockDevice9_SetTextureStageState( struct NineDevice9 *This,
1302 DWORD Stage,
1303 D3DTEXTURESTAGESTATETYPE Type,
1304 DWORD Value )
1305 {
1306 HRESULT r;
1307 simple_mtx_lock(&d3dlock_global);
1308 r = NineDevice9_SetTextureStageState(This, Stage, Type, Value);
1309 simple_mtx_unlock(&d3dlock_global);
1310 return r;
1311 }
1312
1313 static HRESULT NINE_WINAPI
LockDevice9_GetSamplerState(struct NineDevice9 * This,DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD * pValue)1314 LockDevice9_GetSamplerState( struct NineDevice9 *This,
1315 DWORD Sampler,
1316 D3DSAMPLERSTATETYPE Type,
1317 DWORD *pValue )
1318 {
1319 HRESULT r;
1320 simple_mtx_lock(&d3dlock_global);
1321 r = NineDevice9_GetSamplerState(This, Sampler, Type, pValue);
1322 simple_mtx_unlock(&d3dlock_global);
1323 return r;
1324 }
1325
1326 static HRESULT NINE_WINAPI
LockDevice9_SetSamplerState(struct NineDevice9 * This,DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD Value)1327 LockDevice9_SetSamplerState( struct NineDevice9 *This,
1328 DWORD Sampler,
1329 D3DSAMPLERSTATETYPE Type,
1330 DWORD Value )
1331 {
1332 HRESULT r;
1333 simple_mtx_lock(&d3dlock_global);
1334 r = NineDevice9_SetSamplerState(This, Sampler, Type, Value);
1335 simple_mtx_unlock(&d3dlock_global);
1336 return r;
1337 }
1338
1339 static HRESULT NINE_WINAPI
LockDevice9_ValidateDevice(struct NineDevice9 * This,DWORD * pNumPasses)1340 LockDevice9_ValidateDevice( struct NineDevice9 *This,
1341 DWORD *pNumPasses )
1342 {
1343 HRESULT r;
1344 simple_mtx_lock(&d3dlock_global);
1345 r = NineDevice9_ValidateDevice(This, pNumPasses);
1346 simple_mtx_unlock(&d3dlock_global);
1347 return r;
1348 }
1349
1350 static HRESULT NINE_WINAPI
LockDevice9_SetPaletteEntries(struct NineDevice9 * This,UINT PaletteNumber,const PALETTEENTRY * pEntries)1351 LockDevice9_SetPaletteEntries( struct NineDevice9 *This,
1352 UINT PaletteNumber,
1353 const PALETTEENTRY *pEntries )
1354 {
1355 HRESULT r;
1356 simple_mtx_lock(&d3dlock_global);
1357 r = NineDevice9_SetPaletteEntries(This, PaletteNumber, pEntries);
1358 simple_mtx_unlock(&d3dlock_global);
1359 return r;
1360 }
1361
1362 static HRESULT NINE_WINAPI
LockDevice9_GetPaletteEntries(struct NineDevice9 * This,UINT PaletteNumber,PALETTEENTRY * pEntries)1363 LockDevice9_GetPaletteEntries( struct NineDevice9 *This,
1364 UINT PaletteNumber,
1365 PALETTEENTRY *pEntries )
1366 {
1367 HRESULT r;
1368 simple_mtx_lock(&d3dlock_global);
1369 r = NineDevice9_GetPaletteEntries(This, PaletteNumber, pEntries);
1370 simple_mtx_unlock(&d3dlock_global);
1371 return r;
1372 }
1373
1374 static HRESULT NINE_WINAPI
LockDevice9_SetCurrentTexturePalette(struct NineDevice9 * This,UINT PaletteNumber)1375 LockDevice9_SetCurrentTexturePalette( struct NineDevice9 *This,
1376 UINT PaletteNumber )
1377 {
1378 HRESULT r;
1379 simple_mtx_lock(&d3dlock_global);
1380 r = NineDevice9_SetCurrentTexturePalette(This, PaletteNumber);
1381 simple_mtx_unlock(&d3dlock_global);
1382 return r;
1383 }
1384
1385 static HRESULT NINE_WINAPI
LockDevice9_GetCurrentTexturePalette(struct NineDevice9 * This,UINT * PaletteNumber)1386 LockDevice9_GetCurrentTexturePalette( struct NineDevice9 *This,
1387 UINT *PaletteNumber )
1388 {
1389 HRESULT r;
1390 simple_mtx_lock(&d3dlock_global);
1391 r = NineDevice9_GetCurrentTexturePalette(This, PaletteNumber);
1392 simple_mtx_unlock(&d3dlock_global);
1393 return r;
1394 }
1395
1396 static HRESULT NINE_WINAPI
LockDevice9_SetScissorRect(struct NineDevice9 * This,const RECT * pRect)1397 LockDevice9_SetScissorRect( struct NineDevice9 *This,
1398 const RECT *pRect )
1399 {
1400 HRESULT r;
1401 simple_mtx_lock(&d3dlock_global);
1402 r = NineDevice9_SetScissorRect(This, pRect);
1403 simple_mtx_unlock(&d3dlock_global);
1404 return r;
1405 }
1406
1407 static HRESULT NINE_WINAPI
LockDevice9_GetScissorRect(struct NineDevice9 * This,RECT * pRect)1408 LockDevice9_GetScissorRect( struct NineDevice9 *This,
1409 RECT *pRect )
1410 {
1411 HRESULT r;
1412 simple_mtx_lock(&d3dlock_global);
1413 r = NineDevice9_GetScissorRect(This, pRect);
1414 simple_mtx_unlock(&d3dlock_global);
1415 return r;
1416 }
1417
1418 static HRESULT NINE_WINAPI
LockDevice9_SetSoftwareVertexProcessing(struct NineDevice9 * This,BOOL bSoftware)1419 LockDevice9_SetSoftwareVertexProcessing( struct NineDevice9 *This,
1420 BOOL bSoftware )
1421 {
1422 HRESULT r;
1423 simple_mtx_lock(&d3dlock_global);
1424 r = NineDevice9_SetSoftwareVertexProcessing(This, bSoftware);
1425 simple_mtx_unlock(&d3dlock_global);
1426 return r;
1427 }
1428
1429 static BOOL NINE_WINAPI
LockDevice9_GetSoftwareVertexProcessing(struct NineDevice9 * This)1430 LockDevice9_GetSoftwareVertexProcessing( struct NineDevice9 *This )
1431 {
1432 BOOL r;
1433 simple_mtx_lock(&d3dlock_global);
1434 r = NineDevice9_GetSoftwareVertexProcessing(This);
1435 simple_mtx_unlock(&d3dlock_global);
1436 return r;
1437 }
1438
1439 static HRESULT NINE_WINAPI
LockDevice9_SetNPatchMode(struct NineDevice9 * This,float nSegments)1440 LockDevice9_SetNPatchMode( struct NineDevice9 *This,
1441 float nSegments )
1442 {
1443 HRESULT r;
1444 simple_mtx_lock(&d3dlock_global);
1445 r = NineDevice9_SetNPatchMode(This, nSegments);
1446 simple_mtx_unlock(&d3dlock_global);
1447 return r;
1448 }
1449
1450 static float NINE_WINAPI
LockDevice9_GetNPatchMode(struct NineDevice9 * This)1451 LockDevice9_GetNPatchMode( struct NineDevice9 *This )
1452 {
1453 float r;
1454 simple_mtx_lock(&d3dlock_global);
1455 r = NineDevice9_GetNPatchMode(This);
1456 simple_mtx_unlock(&d3dlock_global);
1457 return r;
1458 }
1459
1460 static HRESULT NINE_WINAPI
LockDevice9_DrawPrimitive(struct NineDevice9 * This,D3DPRIMITIVETYPE PrimitiveType,UINT StartVertex,UINT PrimitiveCount)1461 LockDevice9_DrawPrimitive( struct NineDevice9 *This,
1462 D3DPRIMITIVETYPE PrimitiveType,
1463 UINT StartVertex,
1464 UINT PrimitiveCount )
1465 {
1466 HRESULT r;
1467 simple_mtx_lock(&d3dlock_global);
1468 r = NineDevice9_DrawPrimitive(This, PrimitiveType, StartVertex, PrimitiveCount);
1469 simple_mtx_unlock(&d3dlock_global);
1470 return r;
1471 }
1472
1473 static HRESULT NINE_WINAPI
LockDevice9_DrawIndexedPrimitive(struct NineDevice9 * This,D3DPRIMITIVETYPE PrimitiveType,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount)1474 LockDevice9_DrawIndexedPrimitive( struct NineDevice9 *This,
1475 D3DPRIMITIVETYPE PrimitiveType,
1476 INT BaseVertexIndex,
1477 UINT MinVertexIndex,
1478 UINT NumVertices,
1479 UINT startIndex,
1480 UINT primCount )
1481 {
1482 HRESULT r;
1483 simple_mtx_lock(&d3dlock_global);
1484 r = NineDevice9_DrawIndexedPrimitive(This, PrimitiveType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
1485 simple_mtx_unlock(&d3dlock_global);
1486 return r;
1487 }
1488
1489 static HRESULT NINE_WINAPI
LockDevice9_DrawPrimitiveUP(struct NineDevice9 * This,D3DPRIMITIVETYPE PrimitiveType,UINT PrimitiveCount,const void * pVertexStreamZeroData,UINT VertexStreamZeroStride)1490 LockDevice9_DrawPrimitiveUP( struct NineDevice9 *This,
1491 D3DPRIMITIVETYPE PrimitiveType,
1492 UINT PrimitiveCount,
1493 const void *pVertexStreamZeroData,
1494 UINT VertexStreamZeroStride )
1495 {
1496 HRESULT r;
1497 simple_mtx_lock(&d3dlock_global);
1498 r = NineDevice9_DrawPrimitiveUP(This, PrimitiveType, PrimitiveCount, pVertexStreamZeroData, VertexStreamZeroStride);
1499 simple_mtx_unlock(&d3dlock_global);
1500 return r;
1501 }
1502
1503 static HRESULT NINE_WINAPI
LockDevice9_DrawIndexedPrimitiveUP(struct NineDevice9 * This,D3DPRIMITIVETYPE PrimitiveType,UINT MinVertexIndex,UINT NumVertices,UINT PrimitiveCount,const void * pIndexData,D3DFORMAT IndexDataFormat,const void * pVertexStreamZeroData,UINT VertexStreamZeroStride)1504 LockDevice9_DrawIndexedPrimitiveUP( struct NineDevice9 *This,
1505 D3DPRIMITIVETYPE PrimitiveType,
1506 UINT MinVertexIndex,
1507 UINT NumVertices,
1508 UINT PrimitiveCount,
1509 const void *pIndexData,
1510 D3DFORMAT IndexDataFormat,
1511 const void *pVertexStreamZeroData,
1512 UINT VertexStreamZeroStride )
1513 {
1514 HRESULT r;
1515 simple_mtx_lock(&d3dlock_global);
1516 r = NineDevice9_DrawIndexedPrimitiveUP(This, PrimitiveType, MinVertexIndex, NumVertices, PrimitiveCount, pIndexData, IndexDataFormat, pVertexStreamZeroData, VertexStreamZeroStride);
1517 simple_mtx_unlock(&d3dlock_global);
1518 return r;
1519 }
1520
1521 static HRESULT NINE_WINAPI
LockDevice9_ProcessVertices(struct NineDevice9 * This,UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,IDirect3DVertexBuffer9 * pDestBuffer,IDirect3DVertexDeclaration9 * pVertexDecl,DWORD Flags)1522 LockDevice9_ProcessVertices( struct NineDevice9 *This,
1523 UINT SrcStartIndex,
1524 UINT DestIndex,
1525 UINT VertexCount,
1526 IDirect3DVertexBuffer9 *pDestBuffer,
1527 IDirect3DVertexDeclaration9 *pVertexDecl,
1528 DWORD Flags )
1529 {
1530 HRESULT r;
1531 simple_mtx_lock(&d3dlock_global);
1532 r = NineDevice9_ProcessVertices(This, SrcStartIndex, DestIndex, VertexCount, pDestBuffer, pVertexDecl, Flags);
1533 simple_mtx_unlock(&d3dlock_global);
1534 return r;
1535 }
1536
1537 static HRESULT NINE_WINAPI
LockDevice9_CreateVertexDeclaration(struct NineDevice9 * This,const D3DVERTEXELEMENT9 * pVertexElements,IDirect3DVertexDeclaration9 ** ppDecl)1538 LockDevice9_CreateVertexDeclaration( struct NineDevice9 *This,
1539 const D3DVERTEXELEMENT9 *pVertexElements,
1540 IDirect3DVertexDeclaration9 **ppDecl )
1541 {
1542 HRESULT r;
1543 simple_mtx_lock(&d3dlock_global);
1544 r = NineDevice9_CreateVertexDeclaration(This, pVertexElements, ppDecl);
1545 simple_mtx_unlock(&d3dlock_global);
1546 return r;
1547 }
1548
1549 static HRESULT NINE_WINAPI
LockDevice9_SetVertexDeclaration(struct NineDevice9 * This,IDirect3DVertexDeclaration9 * pDecl)1550 LockDevice9_SetVertexDeclaration( struct NineDevice9 *This,
1551 IDirect3DVertexDeclaration9 *pDecl )
1552 {
1553 HRESULT r;
1554 simple_mtx_lock(&d3dlock_global);
1555 r = NineDevice9_SetVertexDeclaration(This, pDecl);
1556 simple_mtx_unlock(&d3dlock_global);
1557 return r;
1558 }
1559
1560 static HRESULT NINE_WINAPI
LockDevice9_GetVertexDeclaration(struct NineDevice9 * This,IDirect3DVertexDeclaration9 ** ppDecl)1561 LockDevice9_GetVertexDeclaration( struct NineDevice9 *This,
1562 IDirect3DVertexDeclaration9 **ppDecl )
1563 {
1564 HRESULT r;
1565 simple_mtx_lock(&d3dlock_global);
1566 r = NineDevice9_GetVertexDeclaration(This, ppDecl);
1567 simple_mtx_unlock(&d3dlock_global);
1568 return r;
1569 }
1570
1571 static HRESULT NINE_WINAPI
LockDevice9_SetFVF(struct NineDevice9 * This,DWORD FVF)1572 LockDevice9_SetFVF( struct NineDevice9 *This,
1573 DWORD FVF )
1574 {
1575 HRESULT r;
1576 simple_mtx_lock(&d3dlock_global);
1577 r = NineDevice9_SetFVF(This, FVF);
1578 simple_mtx_unlock(&d3dlock_global);
1579 return r;
1580 }
1581
1582 static HRESULT NINE_WINAPI
LockDevice9_GetFVF(struct NineDevice9 * This,DWORD * pFVF)1583 LockDevice9_GetFVF( struct NineDevice9 *This,
1584 DWORD *pFVF )
1585 {
1586 HRESULT r;
1587 simple_mtx_lock(&d3dlock_global);
1588 r = NineDevice9_GetFVF(This, pFVF);
1589 simple_mtx_unlock(&d3dlock_global);
1590 return r;
1591 }
1592
1593 static HRESULT NINE_WINAPI
LockDevice9_CreateVertexShader(struct NineDevice9 * This,const DWORD * pFunction,IDirect3DVertexShader9 ** ppShader)1594 LockDevice9_CreateVertexShader( struct NineDevice9 *This,
1595 const DWORD *pFunction,
1596 IDirect3DVertexShader9 **ppShader )
1597 {
1598 HRESULT r;
1599 simple_mtx_lock(&d3dlock_global);
1600 r = NineDevice9_CreateVertexShader(This, pFunction, ppShader);
1601 simple_mtx_unlock(&d3dlock_global);
1602 return r;
1603 }
1604
1605 static HRESULT NINE_WINAPI
LockDevice9_SetVertexShader(struct NineDevice9 * This,IDirect3DVertexShader9 * pShader)1606 LockDevice9_SetVertexShader( struct NineDevice9 *This,
1607 IDirect3DVertexShader9 *pShader )
1608 {
1609 HRESULT r;
1610 simple_mtx_lock(&d3dlock_global);
1611 r = NineDevice9_SetVertexShader(This, pShader);
1612 simple_mtx_unlock(&d3dlock_global);
1613 return r;
1614 }
1615
1616 static HRESULT NINE_WINAPI
LockDevice9_GetVertexShader(struct NineDevice9 * This,IDirect3DVertexShader9 ** ppShader)1617 LockDevice9_GetVertexShader( struct NineDevice9 *This,
1618 IDirect3DVertexShader9 **ppShader )
1619 {
1620 HRESULT r;
1621 simple_mtx_lock(&d3dlock_global);
1622 r = NineDevice9_GetVertexShader(This, ppShader);
1623 simple_mtx_unlock(&d3dlock_global);
1624 return r;
1625 }
1626
1627 static HRESULT NINE_WINAPI
LockDevice9_SetVertexShaderConstantF(struct NineDevice9 * This,UINT StartRegister,const float * pConstantData,UINT Vector4fCount)1628 LockDevice9_SetVertexShaderConstantF( struct NineDevice9 *This,
1629 UINT StartRegister,
1630 const float *pConstantData,
1631 UINT Vector4fCount )
1632 {
1633 HRESULT r;
1634 simple_mtx_lock(&d3dlock_global);
1635 r = NineDevice9_SetVertexShaderConstantF(This, StartRegister, pConstantData, Vector4fCount);
1636 simple_mtx_unlock(&d3dlock_global);
1637 return r;
1638 }
1639
1640 static HRESULT NINE_WINAPI
LockDevice9_GetVertexShaderConstantF(struct NineDevice9 * This,UINT StartRegister,float * pConstantData,UINT Vector4fCount)1641 LockDevice9_GetVertexShaderConstantF( struct NineDevice9 *This,
1642 UINT StartRegister,
1643 float *pConstantData,
1644 UINT Vector4fCount )
1645 {
1646 HRESULT r;
1647 simple_mtx_lock(&d3dlock_global);
1648 r = NineDevice9_GetVertexShaderConstantF(This, StartRegister, pConstantData, Vector4fCount);
1649 simple_mtx_unlock(&d3dlock_global);
1650 return r;
1651 }
1652
1653 static HRESULT NINE_WINAPI
LockDevice9_SetVertexShaderConstantI(struct NineDevice9 * This,UINT StartRegister,const int * pConstantData,UINT Vector4iCount)1654 LockDevice9_SetVertexShaderConstantI( struct NineDevice9 *This,
1655 UINT StartRegister,
1656 const int *pConstantData,
1657 UINT Vector4iCount )
1658 {
1659 HRESULT r;
1660 simple_mtx_lock(&d3dlock_global);
1661 r = NineDevice9_SetVertexShaderConstantI(This, StartRegister, pConstantData, Vector4iCount);
1662 simple_mtx_unlock(&d3dlock_global);
1663 return r;
1664 }
1665
1666 static HRESULT NINE_WINAPI
LockDevice9_GetVertexShaderConstantI(struct NineDevice9 * This,UINT StartRegister,int * pConstantData,UINT Vector4iCount)1667 LockDevice9_GetVertexShaderConstantI( struct NineDevice9 *This,
1668 UINT StartRegister,
1669 int *pConstantData,
1670 UINT Vector4iCount )
1671 {
1672 HRESULT r;
1673 simple_mtx_lock(&d3dlock_global);
1674 r = NineDevice9_GetVertexShaderConstantI(This, StartRegister, pConstantData, Vector4iCount);
1675 simple_mtx_unlock(&d3dlock_global);
1676 return r;
1677 }
1678
1679 static HRESULT NINE_WINAPI
LockDevice9_SetVertexShaderConstantB(struct NineDevice9 * This,UINT StartRegister,const BOOL * pConstantData,UINT BoolCount)1680 LockDevice9_SetVertexShaderConstantB( struct NineDevice9 *This,
1681 UINT StartRegister,
1682 const BOOL *pConstantData,
1683 UINT BoolCount )
1684 {
1685 HRESULT r;
1686 simple_mtx_lock(&d3dlock_global);
1687 r = NineDevice9_SetVertexShaderConstantB(This, StartRegister, pConstantData, BoolCount);
1688 simple_mtx_unlock(&d3dlock_global);
1689 return r;
1690 }
1691
1692 static HRESULT NINE_WINAPI
LockDevice9_GetVertexShaderConstantB(struct NineDevice9 * This,UINT StartRegister,BOOL * pConstantData,UINT BoolCount)1693 LockDevice9_GetVertexShaderConstantB( struct NineDevice9 *This,
1694 UINT StartRegister,
1695 BOOL *pConstantData,
1696 UINT BoolCount )
1697 {
1698 HRESULT r;
1699 simple_mtx_lock(&d3dlock_global);
1700 r = NineDevice9_GetVertexShaderConstantB(This, StartRegister, pConstantData, BoolCount);
1701 simple_mtx_unlock(&d3dlock_global);
1702 return r;
1703 }
1704
1705 static HRESULT NINE_WINAPI
LockDevice9_SetStreamSource(struct NineDevice9 * This,UINT StreamNumber,IDirect3DVertexBuffer9 * pStreamData,UINT OffsetInBytes,UINT Stride)1706 LockDevice9_SetStreamSource( struct NineDevice9 *This,
1707 UINT StreamNumber,
1708 IDirect3DVertexBuffer9 *pStreamData,
1709 UINT OffsetInBytes,
1710 UINT Stride )
1711 {
1712 HRESULT r;
1713 simple_mtx_lock(&d3dlock_global);
1714 r = NineDevice9_SetStreamSource(This, StreamNumber, pStreamData, OffsetInBytes, Stride);
1715 simple_mtx_unlock(&d3dlock_global);
1716 return r;
1717 }
1718
1719 static HRESULT NINE_WINAPI
LockDevice9_GetStreamSource(struct NineDevice9 * This,UINT StreamNumber,IDirect3DVertexBuffer9 ** ppStreamData,UINT * pOffsetInBytes,UINT * pStride)1720 LockDevice9_GetStreamSource( struct NineDevice9 *This,
1721 UINT StreamNumber,
1722 IDirect3DVertexBuffer9 **ppStreamData,
1723 UINT *pOffsetInBytes,
1724 UINT *pStride )
1725 {
1726 HRESULT r;
1727 simple_mtx_lock(&d3dlock_global);
1728 r = NineDevice9_GetStreamSource(This, StreamNumber, ppStreamData, pOffsetInBytes, pStride);
1729 simple_mtx_unlock(&d3dlock_global);
1730 return r;
1731 }
1732
1733 static HRESULT NINE_WINAPI
LockDevice9_SetStreamSourceFreq(struct NineDevice9 * This,UINT StreamNumber,UINT Setting)1734 LockDevice9_SetStreamSourceFreq( struct NineDevice9 *This,
1735 UINT StreamNumber,
1736 UINT Setting )
1737 {
1738 HRESULT r;
1739 simple_mtx_lock(&d3dlock_global);
1740 r = NineDevice9_SetStreamSourceFreq(This, StreamNumber, Setting);
1741 simple_mtx_unlock(&d3dlock_global);
1742 return r;
1743 }
1744
1745 static HRESULT NINE_WINAPI
LockDevice9_GetStreamSourceFreq(struct NineDevice9 * This,UINT StreamNumber,UINT * pSetting)1746 LockDevice9_GetStreamSourceFreq( struct NineDevice9 *This,
1747 UINT StreamNumber,
1748 UINT *pSetting )
1749 {
1750 HRESULT r;
1751 simple_mtx_lock(&d3dlock_global);
1752 r = NineDevice9_GetStreamSourceFreq(This, StreamNumber, pSetting);
1753 simple_mtx_unlock(&d3dlock_global);
1754 return r;
1755 }
1756
1757 static HRESULT NINE_WINAPI
LockDevice9_SetIndices(struct NineDevice9 * This,IDirect3DIndexBuffer9 * pIndexData)1758 LockDevice9_SetIndices( struct NineDevice9 *This,
1759 IDirect3DIndexBuffer9 *pIndexData )
1760 {
1761 HRESULT r;
1762 simple_mtx_lock(&d3dlock_global);
1763 r = NineDevice9_SetIndices(This, pIndexData);
1764 simple_mtx_unlock(&d3dlock_global);
1765 return r;
1766 }
1767
1768 static HRESULT NINE_WINAPI
LockDevice9_GetIndices(struct NineDevice9 * This,IDirect3DIndexBuffer9 ** ppIndexData)1769 LockDevice9_GetIndices( struct NineDevice9 *This,
1770 IDirect3DIndexBuffer9 **ppIndexData )
1771 {
1772 HRESULT r;
1773 simple_mtx_lock(&d3dlock_global);
1774 r = NineDevice9_GetIndices(This, ppIndexData);
1775 simple_mtx_unlock(&d3dlock_global);
1776 return r;
1777 }
1778
1779 static HRESULT NINE_WINAPI
LockDevice9_CreatePixelShader(struct NineDevice9 * This,const DWORD * pFunction,IDirect3DPixelShader9 ** ppShader)1780 LockDevice9_CreatePixelShader( struct NineDevice9 *This,
1781 const DWORD *pFunction,
1782 IDirect3DPixelShader9 **ppShader )
1783 {
1784 HRESULT r;
1785 simple_mtx_lock(&d3dlock_global);
1786 r = NineDevice9_CreatePixelShader(This, pFunction, ppShader);
1787 simple_mtx_unlock(&d3dlock_global);
1788 return r;
1789 }
1790
1791 static HRESULT NINE_WINAPI
LockDevice9_SetPixelShader(struct NineDevice9 * This,IDirect3DPixelShader9 * pShader)1792 LockDevice9_SetPixelShader( struct NineDevice9 *This,
1793 IDirect3DPixelShader9 *pShader )
1794 {
1795 HRESULT r;
1796 simple_mtx_lock(&d3dlock_global);
1797 r = NineDevice9_SetPixelShader(This, pShader);
1798 simple_mtx_unlock(&d3dlock_global);
1799 return r;
1800 }
1801
1802 static HRESULT NINE_WINAPI
LockDevice9_GetPixelShader(struct NineDevice9 * This,IDirect3DPixelShader9 ** ppShader)1803 LockDevice9_GetPixelShader( struct NineDevice9 *This,
1804 IDirect3DPixelShader9 **ppShader )
1805 {
1806 HRESULT r;
1807 simple_mtx_lock(&d3dlock_global);
1808 r = NineDevice9_GetPixelShader(This, ppShader);
1809 simple_mtx_unlock(&d3dlock_global);
1810 return r;
1811 }
1812
1813 static HRESULT NINE_WINAPI
LockDevice9_SetPixelShaderConstantF(struct NineDevice9 * This,UINT StartRegister,const float * pConstantData,UINT Vector4fCount)1814 LockDevice9_SetPixelShaderConstantF( struct NineDevice9 *This,
1815 UINT StartRegister,
1816 const float *pConstantData,
1817 UINT Vector4fCount )
1818 {
1819 HRESULT r;
1820 simple_mtx_lock(&d3dlock_global);
1821 r = NineDevice9_SetPixelShaderConstantF(This, StartRegister, pConstantData, Vector4fCount);
1822 simple_mtx_unlock(&d3dlock_global);
1823 return r;
1824 }
1825
1826 static HRESULT NINE_WINAPI
LockDevice9_GetPixelShaderConstantF(struct NineDevice9 * This,UINT StartRegister,float * pConstantData,UINT Vector4fCount)1827 LockDevice9_GetPixelShaderConstantF( struct NineDevice9 *This,
1828 UINT StartRegister,
1829 float *pConstantData,
1830 UINT Vector4fCount )
1831 {
1832 HRESULT r;
1833 simple_mtx_lock(&d3dlock_global);
1834 r = NineDevice9_GetPixelShaderConstantF(This, StartRegister, pConstantData, Vector4fCount);
1835 simple_mtx_unlock(&d3dlock_global);
1836 return r;
1837 }
1838
1839 static HRESULT NINE_WINAPI
LockDevice9_SetPixelShaderConstantI(struct NineDevice9 * This,UINT StartRegister,const int * pConstantData,UINT Vector4iCount)1840 LockDevice9_SetPixelShaderConstantI( struct NineDevice9 *This,
1841 UINT StartRegister,
1842 const int *pConstantData,
1843 UINT Vector4iCount )
1844 {
1845 HRESULT r;
1846 simple_mtx_lock(&d3dlock_global);
1847 r = NineDevice9_SetPixelShaderConstantI(This, StartRegister, pConstantData, Vector4iCount);
1848 simple_mtx_unlock(&d3dlock_global);
1849 return r;
1850 }
1851
1852 static HRESULT NINE_WINAPI
LockDevice9_GetPixelShaderConstantI(struct NineDevice9 * This,UINT StartRegister,int * pConstantData,UINT Vector4iCount)1853 LockDevice9_GetPixelShaderConstantI( struct NineDevice9 *This,
1854 UINT StartRegister,
1855 int *pConstantData,
1856 UINT Vector4iCount )
1857 {
1858 HRESULT r;
1859 simple_mtx_lock(&d3dlock_global);
1860 r = NineDevice9_GetPixelShaderConstantI(This, StartRegister, pConstantData, Vector4iCount);
1861 simple_mtx_unlock(&d3dlock_global);
1862 return r;
1863 }
1864
1865 static HRESULT NINE_WINAPI
LockDevice9_SetPixelShaderConstantB(struct NineDevice9 * This,UINT StartRegister,const BOOL * pConstantData,UINT BoolCount)1866 LockDevice9_SetPixelShaderConstantB( struct NineDevice9 *This,
1867 UINT StartRegister,
1868 const BOOL *pConstantData,
1869 UINT BoolCount )
1870 {
1871 HRESULT r;
1872 simple_mtx_lock(&d3dlock_global);
1873 r = NineDevice9_SetPixelShaderConstantB(This, StartRegister, pConstantData, BoolCount);
1874 simple_mtx_unlock(&d3dlock_global);
1875 return r;
1876 }
1877
1878 static HRESULT NINE_WINAPI
LockDevice9_GetPixelShaderConstantB(struct NineDevice9 * This,UINT StartRegister,BOOL * pConstantData,UINT BoolCount)1879 LockDevice9_GetPixelShaderConstantB( struct NineDevice9 *This,
1880 UINT StartRegister,
1881 BOOL *pConstantData,
1882 UINT BoolCount )
1883 {
1884 HRESULT r;
1885 simple_mtx_lock(&d3dlock_global);
1886 r = NineDevice9_GetPixelShaderConstantB(This, StartRegister, pConstantData, BoolCount);
1887 simple_mtx_unlock(&d3dlock_global);
1888 return r;
1889 }
1890
1891 static HRESULT NINE_WINAPI
LockDevice9_DrawRectPatch(struct NineDevice9 * This,UINT Handle,const float * pNumSegs,const D3DRECTPATCH_INFO * pRectPatchInfo)1892 LockDevice9_DrawRectPatch( struct NineDevice9 *This,
1893 UINT Handle,
1894 const float *pNumSegs,
1895 const D3DRECTPATCH_INFO *pRectPatchInfo )
1896 {
1897 HRESULT r;
1898 simple_mtx_lock(&d3dlock_global);
1899 r = NineDevice9_DrawRectPatch(This, Handle, pNumSegs, pRectPatchInfo);
1900 simple_mtx_unlock(&d3dlock_global);
1901 return r;
1902 }
1903
1904 static HRESULT NINE_WINAPI
LockDevice9_DrawTriPatch(struct NineDevice9 * This,UINT Handle,const float * pNumSegs,const D3DTRIPATCH_INFO * pTriPatchInfo)1905 LockDevice9_DrawTriPatch( struct NineDevice9 *This,
1906 UINT Handle,
1907 const float *pNumSegs,
1908 const D3DTRIPATCH_INFO *pTriPatchInfo )
1909 {
1910 HRESULT r;
1911 simple_mtx_lock(&d3dlock_global);
1912 r = NineDevice9_DrawTriPatch(This, Handle, pNumSegs, pTriPatchInfo);
1913 simple_mtx_unlock(&d3dlock_global);
1914 return r;
1915 }
1916
1917 static HRESULT NINE_WINAPI
LockDevice9_DeletePatch(struct NineDevice9 * This,UINT Handle)1918 LockDevice9_DeletePatch( struct NineDevice9 *This,
1919 UINT Handle )
1920 {
1921 HRESULT r;
1922 simple_mtx_lock(&d3dlock_global);
1923 r = NineDevice9_DeletePatch(This, Handle);
1924 simple_mtx_unlock(&d3dlock_global);
1925 return r;
1926 }
1927
1928 static HRESULT NINE_WINAPI
LockDevice9_CreateQuery(struct NineDevice9 * This,D3DQUERYTYPE Type,IDirect3DQuery9 ** ppQuery)1929 LockDevice9_CreateQuery( struct NineDevice9 *This,
1930 D3DQUERYTYPE Type,
1931 IDirect3DQuery9 **ppQuery )
1932 {
1933 HRESULT r;
1934 simple_mtx_lock(&d3dlock_global);
1935 r = NineDevice9_CreateQuery(This, Type, ppQuery);
1936 simple_mtx_unlock(&d3dlock_global);
1937 return r;
1938 }
1939
1940 IDirect3DDevice9Vtbl LockDevice9_vtable = {
1941 (void *)NineUnknown_QueryInterface,
1942 (void *)NineUnknown_AddRef,
1943 (void *)NineUnknown_ReleaseWithDtorLock,
1944 (void *)LockDevice9_TestCooperativeLevel,
1945 (void *)LockDevice9_GetAvailableTextureMem,
1946 (void *)LockDevice9_EvictManagedResources,
1947 (void *)LockDevice9_GetDirect3D,
1948 (void *)NineDevice9_GetDeviceCaps, /* immutable */
1949 (void *)LockDevice9_GetDisplayMode,
1950 (void *)NineDevice9_GetCreationParameters, /* immutable */
1951 (void *)LockDevice9_SetCursorProperties,
1952 (void *)LockDevice9_SetCursorPosition,
1953 (void *)LockDevice9_ShowCursor,
1954 (void *)LockDevice9_CreateAdditionalSwapChain,
1955 (void *)LockDevice9_GetSwapChain,
1956 (void *)LockDevice9_GetNumberOfSwapChains,
1957 (void *)LockDevice9_Reset,
1958 (void *)LockDevice9_Present,
1959 (void *)LockDevice9_GetBackBuffer,
1960 (void *)LockDevice9_GetRasterStatus,
1961 (void *)LockDevice9_SetDialogBoxMode,
1962 (void *)LockDevice9_SetGammaRamp,
1963 (void *)LockDevice9_GetGammaRamp,
1964 (void *)LockDevice9_CreateTexture,
1965 (void *)LockDevice9_CreateVolumeTexture,
1966 (void *)LockDevice9_CreateCubeTexture,
1967 (void *)LockDevice9_CreateVertexBuffer,
1968 (void *)LockDevice9_CreateIndexBuffer,
1969 (void *)LockDevice9_CreateRenderTarget,
1970 (void *)LockDevice9_CreateDepthStencilSurface,
1971 (void *)LockDevice9_UpdateSurface,
1972 (void *)LockDevice9_UpdateTexture,
1973 (void *)LockDevice9_GetRenderTargetData,
1974 (void *)LockDevice9_GetFrontBufferData,
1975 (void *)LockDevice9_StretchRect,
1976 (void *)LockDevice9_ColorFill,
1977 (void *)LockDevice9_CreateOffscreenPlainSurface,
1978 (void *)LockDevice9_SetRenderTarget,
1979 (void *)LockDevice9_GetRenderTarget,
1980 (void *)LockDevice9_SetDepthStencilSurface,
1981 (void *)LockDevice9_GetDepthStencilSurface,
1982 (void *)LockDevice9_BeginScene,
1983 (void *)LockDevice9_EndScene,
1984 (void *)LockDevice9_Clear,
1985 (void *)LockDevice9_SetTransform,
1986 (void *)LockDevice9_GetTransform,
1987 (void *)LockDevice9_MultiplyTransform,
1988 (void *)LockDevice9_SetViewport,
1989 (void *)LockDevice9_GetViewport,
1990 (void *)LockDevice9_SetMaterial,
1991 (void *)LockDevice9_GetMaterial,
1992 (void *)LockDevice9_SetLight,
1993 (void *)LockDevice9_GetLight,
1994 (void *)LockDevice9_LightEnable,
1995 (void *)LockDevice9_GetLightEnable,
1996 (void *)LockDevice9_SetClipPlane,
1997 (void *)LockDevice9_GetClipPlane,
1998 (void *)LockDevice9_SetRenderState,
1999 (void *)LockDevice9_GetRenderState,
2000 (void *)LockDevice9_CreateStateBlock,
2001 (void *)LockDevice9_BeginStateBlock,
2002 (void *)LockDevice9_EndStateBlock,
2003 (void *)LockDevice9_SetClipStatus,
2004 (void *)LockDevice9_GetClipStatus,
2005 (void *)LockDevice9_GetTexture,
2006 (void *)LockDevice9_SetTexture,
2007 (void *)LockDevice9_GetTextureStageState,
2008 (void *)LockDevice9_SetTextureStageState,
2009 (void *)LockDevice9_GetSamplerState,
2010 (void *)LockDevice9_SetSamplerState,
2011 (void *)LockDevice9_ValidateDevice,
2012 (void *)LockDevice9_SetPaletteEntries,
2013 (void *)LockDevice9_GetPaletteEntries,
2014 (void *)LockDevice9_SetCurrentTexturePalette,
2015 (void *)LockDevice9_GetCurrentTexturePalette,
2016 (void *)LockDevice9_SetScissorRect,
2017 (void *)LockDevice9_GetScissorRect,
2018 (void *)LockDevice9_SetSoftwareVertexProcessing,
2019 (void *)LockDevice9_GetSoftwareVertexProcessing,
2020 (void *)LockDevice9_SetNPatchMode,
2021 (void *)LockDevice9_GetNPatchMode,
2022 (void *)LockDevice9_DrawPrimitive,
2023 (void *)LockDevice9_DrawIndexedPrimitive,
2024 (void *)LockDevice9_DrawPrimitiveUP,
2025 (void *)LockDevice9_DrawIndexedPrimitiveUP,
2026 (void *)LockDevice9_ProcessVertices,
2027 (void *)LockDevice9_CreateVertexDeclaration,
2028 (void *)LockDevice9_SetVertexDeclaration,
2029 (void *)LockDevice9_GetVertexDeclaration,
2030 (void *)LockDevice9_SetFVF,
2031 (void *)LockDevice9_GetFVF,
2032 (void *)LockDevice9_CreateVertexShader,
2033 (void *)LockDevice9_SetVertexShader,
2034 (void *)LockDevice9_GetVertexShader,
2035 (void *)LockDevice9_SetVertexShaderConstantF,
2036 (void *)LockDevice9_GetVertexShaderConstantF,
2037 (void *)LockDevice9_SetVertexShaderConstantI,
2038 (void *)LockDevice9_GetVertexShaderConstantI,
2039 (void *)LockDevice9_SetVertexShaderConstantB,
2040 (void *)LockDevice9_GetVertexShaderConstantB,
2041 (void *)LockDevice9_SetStreamSource,
2042 (void *)LockDevice9_GetStreamSource,
2043 (void *)LockDevice9_SetStreamSourceFreq,
2044 (void *)LockDevice9_GetStreamSourceFreq,
2045 (void *)LockDevice9_SetIndices,
2046 (void *)LockDevice9_GetIndices,
2047 (void *)LockDevice9_CreatePixelShader,
2048 (void *)LockDevice9_SetPixelShader,
2049 (void *)LockDevice9_GetPixelShader,
2050 (void *)LockDevice9_SetPixelShaderConstantF,
2051 (void *)LockDevice9_GetPixelShaderConstantF,
2052 (void *)LockDevice9_SetPixelShaderConstantI,
2053 (void *)LockDevice9_GetPixelShaderConstantI,
2054 (void *)LockDevice9_SetPixelShaderConstantB,
2055 (void *)LockDevice9_GetPixelShaderConstantB,
2056 (void *)LockDevice9_DrawRectPatch,
2057 (void *)LockDevice9_DrawTriPatch,
2058 (void *)LockDevice9_DeletePatch,
2059 (void *)LockDevice9_CreateQuery
2060 };
2061
2062 static HRESULT NINE_WINAPI
LockDevice9Ex_SetConvolutionMonoKernel(struct NineDevice9Ex * This,UINT width,UINT height,float * rows,float * columns)2063 LockDevice9Ex_SetConvolutionMonoKernel( struct NineDevice9Ex *This,
2064 UINT width,
2065 UINT height,
2066 float *rows,
2067 float *columns )
2068 {
2069 HRESULT r;
2070 simple_mtx_lock(&d3dlock_global);
2071 r = NineDevice9Ex_SetConvolutionMonoKernel(This, width, height, rows, columns);
2072 simple_mtx_unlock(&d3dlock_global);
2073 return r;
2074 }
2075
2076 static HRESULT NINE_WINAPI
LockDevice9Ex_ComposeRects(struct NineDevice9Ex * This,IDirect3DSurface9 * pSrc,IDirect3DSurface9 * pDst,IDirect3DVertexBuffer9 * pSrcRectDescs,UINT NumRects,IDirect3DVertexBuffer9 * pDstRectDescs,D3DCOMPOSERECTSOP Operation,int Xoffset,int Yoffset)2077 LockDevice9Ex_ComposeRects( struct NineDevice9Ex *This,
2078 IDirect3DSurface9 *pSrc,
2079 IDirect3DSurface9 *pDst,
2080 IDirect3DVertexBuffer9 *pSrcRectDescs,
2081 UINT NumRects,
2082 IDirect3DVertexBuffer9 *pDstRectDescs,
2083 D3DCOMPOSERECTSOP Operation,
2084 int Xoffset,
2085 int Yoffset )
2086 {
2087 HRESULT r;
2088 simple_mtx_lock(&d3dlock_global);
2089 r = NineDevice9Ex_ComposeRects(This, pSrc, pDst, pSrcRectDescs, NumRects, pDstRectDescs, Operation, Xoffset, Yoffset);
2090 simple_mtx_unlock(&d3dlock_global);
2091 return r;
2092 }
2093
2094 static HRESULT NINE_WINAPI
LockDevice9Ex_PresentEx(struct NineDevice9Ex * This,const RECT * pSourceRect,const RECT * pDestRect,HWND hDestWindowOverride,const RGNDATA * pDirtyRegion,DWORD dwFlags)2095 LockDevice9Ex_PresentEx( struct NineDevice9Ex *This,
2096 const RECT *pSourceRect,
2097 const RECT *pDestRect,
2098 HWND hDestWindowOverride,
2099 const RGNDATA *pDirtyRegion,
2100 DWORD dwFlags )
2101 {
2102 HRESULT r;
2103 simple_mtx_lock(&d3dlock_global);
2104 r = NineDevice9Ex_PresentEx(This, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion, dwFlags);
2105 simple_mtx_unlock(&d3dlock_global);
2106 return r;
2107 }
2108
2109 static HRESULT NINE_WINAPI
LockDevice9Ex_GetGPUThreadPriority(struct NineDevice9Ex * This,INT * pPriority)2110 LockDevice9Ex_GetGPUThreadPriority( struct NineDevice9Ex *This,
2111 INT *pPriority )
2112 {
2113 HRESULT r;
2114 simple_mtx_lock(&d3dlock_global);
2115 r = NineDevice9Ex_GetGPUThreadPriority(This, pPriority);
2116 simple_mtx_unlock(&d3dlock_global);
2117 return r;
2118 }
2119
2120 static HRESULT NINE_WINAPI
LockDevice9Ex_SetGPUThreadPriority(struct NineDevice9Ex * This,INT Priority)2121 LockDevice9Ex_SetGPUThreadPriority( struct NineDevice9Ex *This,
2122 INT Priority )
2123 {
2124 HRESULT r;
2125 simple_mtx_lock(&d3dlock_global);
2126 r = NineDevice9Ex_SetGPUThreadPriority(This, Priority);
2127 simple_mtx_unlock(&d3dlock_global);
2128 return r;
2129 }
2130
2131 static HRESULT NINE_WINAPI
LockDevice9Ex_WaitForVBlank(struct NineDevice9Ex * This,UINT iSwapChain)2132 LockDevice9Ex_WaitForVBlank( struct NineDevice9Ex *This,
2133 UINT iSwapChain )
2134 {
2135 HRESULT r;
2136 simple_mtx_lock(&d3dlock_global);
2137 r = NineDevice9Ex_WaitForVBlank(This, iSwapChain);
2138 simple_mtx_unlock(&d3dlock_global);
2139 return r;
2140 }
2141
2142 static HRESULT NINE_WINAPI
LockDevice9Ex_CheckResourceResidency(struct NineDevice9Ex * This,IDirect3DResource9 ** pResourceArray,UINT32 NumResources)2143 LockDevice9Ex_CheckResourceResidency( struct NineDevice9Ex *This,
2144 IDirect3DResource9 **pResourceArray,
2145 UINT32 NumResources )
2146 {
2147 HRESULT r;
2148 simple_mtx_lock(&d3dlock_global);
2149 r = NineDevice9Ex_CheckResourceResidency(This, pResourceArray, NumResources);
2150 simple_mtx_unlock(&d3dlock_global);
2151 return r;
2152 }
2153
2154 static HRESULT NINE_WINAPI
LockDevice9Ex_SetMaximumFrameLatency(struct NineDevice9Ex * This,UINT MaxLatency)2155 LockDevice9Ex_SetMaximumFrameLatency( struct NineDevice9Ex *This,
2156 UINT MaxLatency )
2157 {
2158 HRESULT r;
2159 simple_mtx_lock(&d3dlock_global);
2160 r = NineDevice9Ex_SetMaximumFrameLatency(This, MaxLatency);
2161 simple_mtx_unlock(&d3dlock_global);
2162 return r;
2163 }
2164
2165 static HRESULT NINE_WINAPI
LockDevice9Ex_GetMaximumFrameLatency(struct NineDevice9Ex * This,UINT * pMaxLatency)2166 LockDevice9Ex_GetMaximumFrameLatency( struct NineDevice9Ex *This,
2167 UINT *pMaxLatency )
2168 {
2169 HRESULT r;
2170 simple_mtx_lock(&d3dlock_global);
2171 r = NineDevice9Ex_GetMaximumFrameLatency(This, pMaxLatency);
2172 simple_mtx_unlock(&d3dlock_global);
2173 return r;
2174 }
2175
2176 static HRESULT NINE_WINAPI
LockDevice9Ex_CheckDeviceState(struct NineDevice9Ex * This,HWND hDestinationWindow)2177 LockDevice9Ex_CheckDeviceState( struct NineDevice9Ex *This,
2178 HWND hDestinationWindow )
2179 {
2180 HRESULT r;
2181 simple_mtx_lock(&d3dlock_global);
2182 r = NineDevice9Ex_CheckDeviceState(This, hDestinationWindow);
2183 simple_mtx_unlock(&d3dlock_global);
2184 return r;
2185 }
2186
2187 static HRESULT NINE_WINAPI
LockDevice9Ex_CreateRenderTargetEx(struct NineDevice9Ex * This,UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Lockable,IDirect3DSurface9 ** ppSurface,HANDLE * pSharedHandle,DWORD Usage)2188 LockDevice9Ex_CreateRenderTargetEx( struct NineDevice9Ex *This,
2189 UINT Width,
2190 UINT Height,
2191 D3DFORMAT Format,
2192 D3DMULTISAMPLE_TYPE MultiSample,
2193 DWORD MultisampleQuality,
2194 BOOL Lockable,
2195 IDirect3DSurface9 **ppSurface,
2196 HANDLE *pSharedHandle,
2197 DWORD Usage )
2198 {
2199 HRESULT r;
2200 simple_mtx_lock(&d3dlock_global);
2201 r = NineDevice9Ex_CreateRenderTargetEx(This, Width, Height, Format, MultiSample, MultisampleQuality, Lockable, ppSurface, pSharedHandle, Usage);
2202 simple_mtx_unlock(&d3dlock_global);
2203 return r;
2204 }
2205
2206 static HRESULT NINE_WINAPI
LockDevice9Ex_CreateOffscreenPlainSurfaceEx(struct NineDevice9Ex * This,UINT Width,UINT Height,D3DFORMAT Format,D3DPOOL Pool,IDirect3DSurface9 ** ppSurface,HANDLE * pSharedHandle,DWORD Usage)2207 LockDevice9Ex_CreateOffscreenPlainSurfaceEx( struct NineDevice9Ex *This,
2208 UINT Width,
2209 UINT Height,
2210 D3DFORMAT Format,
2211 D3DPOOL Pool,
2212 IDirect3DSurface9 **ppSurface,
2213 HANDLE *pSharedHandle,
2214 DWORD Usage )
2215 {
2216 HRESULT r;
2217 simple_mtx_lock(&d3dlock_global);
2218 r = NineDevice9Ex_CreateOffscreenPlainSurfaceEx(This, Width, Height, Format, Pool, ppSurface, pSharedHandle, Usage);
2219 simple_mtx_unlock(&d3dlock_global);
2220 return r;
2221 }
2222
2223 static HRESULT NINE_WINAPI
LockDevice9Ex_CreateDepthStencilSurfaceEx(struct NineDevice9Ex * This,UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Discard,IDirect3DSurface9 ** ppSurface,HANDLE * pSharedHandle,DWORD Usage)2224 LockDevice9Ex_CreateDepthStencilSurfaceEx( struct NineDevice9Ex *This,
2225 UINT Width,
2226 UINT Height,
2227 D3DFORMAT Format,
2228 D3DMULTISAMPLE_TYPE MultiSample,
2229 DWORD MultisampleQuality,
2230 BOOL Discard,
2231 IDirect3DSurface9 **ppSurface,
2232 HANDLE *pSharedHandle,
2233 DWORD Usage )
2234 {
2235 HRESULT r;
2236 simple_mtx_lock(&d3dlock_global);
2237 r = NineDevice9Ex_CreateDepthStencilSurfaceEx(This, Width, Height, Format, MultiSample, MultisampleQuality, Discard, ppSurface, pSharedHandle, Usage);
2238 simple_mtx_unlock(&d3dlock_global);
2239 return r;
2240 }
2241
2242 static HRESULT NINE_WINAPI
LockDevice9Ex_ResetEx(struct NineDevice9Ex * This,D3DPRESENT_PARAMETERS * pPresentationParameters,D3DDISPLAYMODEEX * pFullscreenDisplayMode)2243 LockDevice9Ex_ResetEx( struct NineDevice9Ex *This,
2244 D3DPRESENT_PARAMETERS *pPresentationParameters,
2245 D3DDISPLAYMODEEX *pFullscreenDisplayMode )
2246 {
2247 HRESULT r;
2248 simple_mtx_lock(&d3dlock_global);
2249 r = NineDevice9Ex_ResetEx(This, pPresentationParameters, pFullscreenDisplayMode);
2250 simple_mtx_unlock(&d3dlock_global);
2251 return r;
2252 }
2253
2254 static HRESULT NINE_WINAPI
LockDevice9Ex_GetDisplayModeEx(struct NineDevice9Ex * This,UINT iSwapChain,D3DDISPLAYMODEEX * pMode,D3DDISPLAYROTATION * pRotation)2255 LockDevice9Ex_GetDisplayModeEx( struct NineDevice9Ex *This,
2256 UINT iSwapChain,
2257 D3DDISPLAYMODEEX *pMode,
2258 D3DDISPLAYROTATION *pRotation )
2259 {
2260 HRESULT r;
2261 simple_mtx_lock(&d3dlock_global);
2262 r = NineDevice9Ex_GetDisplayModeEx(This, iSwapChain, pMode, pRotation);
2263 simple_mtx_unlock(&d3dlock_global);
2264 return r;
2265 }
2266
2267 IDirect3DDevice9ExVtbl LockDevice9Ex_vtable = {
2268 (void *)NineUnknown_QueryInterface,
2269 (void *)NineUnknown_AddRef,
2270 (void *)NineUnknown_ReleaseWithDtorLock,
2271 (void *)LockDevice9_TestCooperativeLevel,
2272 (void *)LockDevice9_GetAvailableTextureMem,
2273 (void *)LockDevice9_EvictManagedResources,
2274 (void *)LockDevice9_GetDirect3D,
2275 (void *)NineDevice9_GetDeviceCaps,
2276 (void *)LockDevice9_GetDisplayMode,
2277 (void *)NineDevice9_GetCreationParameters,
2278 (void *)LockDevice9_SetCursorProperties,
2279 (void *)LockDevice9_SetCursorPosition,
2280 (void *)LockDevice9_ShowCursor,
2281 (void *)LockDevice9_CreateAdditionalSwapChain,
2282 (void *)LockDevice9_GetSwapChain,
2283 (void *)LockDevice9_GetNumberOfSwapChains,
2284 (void *)LockDevice9_Reset,
2285 (void *)LockDevice9_Present,
2286 (void *)LockDevice9_GetBackBuffer,
2287 (void *)LockDevice9_GetRasterStatus,
2288 (void *)LockDevice9_SetDialogBoxMode,
2289 (void *)LockDevice9_SetGammaRamp,
2290 (void *)LockDevice9_GetGammaRamp,
2291 (void *)LockDevice9_CreateTexture,
2292 (void *)LockDevice9_CreateVolumeTexture,
2293 (void *)LockDevice9_CreateCubeTexture,
2294 (void *)LockDevice9_CreateVertexBuffer,
2295 (void *)LockDevice9_CreateIndexBuffer,
2296 (void *)LockDevice9_CreateRenderTarget,
2297 (void *)LockDevice9_CreateDepthStencilSurface,
2298 (void *)LockDevice9_UpdateSurface,
2299 (void *)LockDevice9_UpdateTexture,
2300 (void *)LockDevice9_GetRenderTargetData,
2301 (void *)LockDevice9_GetFrontBufferData,
2302 (void *)LockDevice9_StretchRect,
2303 (void *)LockDevice9_ColorFill,
2304 (void *)LockDevice9_CreateOffscreenPlainSurface,
2305 (void *)LockDevice9_SetRenderTarget,
2306 (void *)LockDevice9_GetRenderTarget,
2307 (void *)LockDevice9_SetDepthStencilSurface,
2308 (void *)LockDevice9_GetDepthStencilSurface,
2309 (void *)LockDevice9_BeginScene,
2310 (void *)LockDevice9_EndScene,
2311 (void *)LockDevice9_Clear,
2312 (void *)LockDevice9_SetTransform,
2313 (void *)LockDevice9_GetTransform,
2314 (void *)LockDevice9_MultiplyTransform,
2315 (void *)LockDevice9_SetViewport,
2316 (void *)LockDevice9_GetViewport,
2317 (void *)LockDevice9_SetMaterial,
2318 (void *)LockDevice9_GetMaterial,
2319 (void *)LockDevice9_SetLight,
2320 (void *)LockDevice9_GetLight,
2321 (void *)LockDevice9_LightEnable,
2322 (void *)LockDevice9_GetLightEnable,
2323 (void *)LockDevice9_SetClipPlane,
2324 (void *)LockDevice9_GetClipPlane,
2325 (void *)LockDevice9_SetRenderState,
2326 (void *)LockDevice9_GetRenderState,
2327 (void *)LockDevice9_CreateStateBlock,
2328 (void *)LockDevice9_BeginStateBlock,
2329 (void *)LockDevice9_EndStateBlock,
2330 (void *)LockDevice9_SetClipStatus,
2331 (void *)LockDevice9_GetClipStatus,
2332 (void *)LockDevice9_GetTexture,
2333 (void *)LockDevice9_SetTexture,
2334 (void *)LockDevice9_GetTextureStageState,
2335 (void *)LockDevice9_SetTextureStageState,
2336 (void *)LockDevice9_GetSamplerState,
2337 (void *)LockDevice9_SetSamplerState,
2338 (void *)LockDevice9_ValidateDevice,
2339 (void *)LockDevice9_SetPaletteEntries,
2340 (void *)LockDevice9_GetPaletteEntries,
2341 (void *)LockDevice9_SetCurrentTexturePalette,
2342 (void *)LockDevice9_GetCurrentTexturePalette,
2343 (void *)LockDevice9_SetScissorRect,
2344 (void *)LockDevice9_GetScissorRect,
2345 (void *)LockDevice9_SetSoftwareVertexProcessing,
2346 (void *)LockDevice9_GetSoftwareVertexProcessing,
2347 (void *)LockDevice9_SetNPatchMode,
2348 (void *)LockDevice9_GetNPatchMode,
2349 (void *)LockDevice9_DrawPrimitive,
2350 (void *)LockDevice9_DrawIndexedPrimitive,
2351 (void *)LockDevice9_DrawPrimitiveUP,
2352 (void *)LockDevice9_DrawIndexedPrimitiveUP,
2353 (void *)LockDevice9_ProcessVertices,
2354 (void *)LockDevice9_CreateVertexDeclaration,
2355 (void *)LockDevice9_SetVertexDeclaration,
2356 (void *)LockDevice9_GetVertexDeclaration,
2357 (void *)LockDevice9_SetFVF,
2358 (void *)LockDevice9_GetFVF,
2359 (void *)LockDevice9_CreateVertexShader,
2360 (void *)LockDevice9_SetVertexShader,
2361 (void *)LockDevice9_GetVertexShader,
2362 (void *)LockDevice9_SetVertexShaderConstantF,
2363 (void *)LockDevice9_GetVertexShaderConstantF,
2364 (void *)LockDevice9_SetVertexShaderConstantI,
2365 (void *)LockDevice9_GetVertexShaderConstantI,
2366 (void *)LockDevice9_SetVertexShaderConstantB,
2367 (void *)LockDevice9_GetVertexShaderConstantB,
2368 (void *)LockDevice9_SetStreamSource,
2369 (void *)LockDevice9_GetStreamSource,
2370 (void *)LockDevice9_SetStreamSourceFreq,
2371 (void *)LockDevice9_GetStreamSourceFreq,
2372 (void *)LockDevice9_SetIndices,
2373 (void *)LockDevice9_GetIndices,
2374 (void *)LockDevice9_CreatePixelShader,
2375 (void *)LockDevice9_SetPixelShader,
2376 (void *)LockDevice9_GetPixelShader,
2377 (void *)LockDevice9_SetPixelShaderConstantF,
2378 (void *)LockDevice9_GetPixelShaderConstantF,
2379 (void *)LockDevice9_SetPixelShaderConstantI,
2380 (void *)LockDevice9_GetPixelShaderConstantI,
2381 (void *)LockDevice9_SetPixelShaderConstantB,
2382 (void *)LockDevice9_GetPixelShaderConstantB,
2383 (void *)LockDevice9_DrawRectPatch,
2384 (void *)LockDevice9_DrawTriPatch,
2385 (void *)LockDevice9_DeletePatch,
2386 (void *)LockDevice9_CreateQuery,
2387 (void *)LockDevice9Ex_SetConvolutionMonoKernel,
2388 (void *)LockDevice9Ex_ComposeRects,
2389 (void *)LockDevice9Ex_PresentEx,
2390 (void *)LockDevice9Ex_GetGPUThreadPriority,
2391 (void *)LockDevice9Ex_SetGPUThreadPriority,
2392 (void *)LockDevice9Ex_WaitForVBlank,
2393 (void *)LockDevice9Ex_CheckResourceResidency,
2394 (void *)LockDevice9Ex_SetMaximumFrameLatency,
2395 (void *)LockDevice9Ex_GetMaximumFrameLatency,
2396 (void *)LockDevice9Ex_CheckDeviceState,
2397 (void *)LockDevice9Ex_CreateRenderTargetEx,
2398 (void *)LockDevice9Ex_CreateOffscreenPlainSurfaceEx,
2399 (void *)LockDevice9Ex_CreateDepthStencilSurfaceEx,
2400 (void *)LockDevice9Ex_ResetEx,
2401 (void *)LockDevice9Ex_GetDisplayModeEx
2402 };
2403
2404 static HRESULT NINE_WINAPI
LockDevice9Video_GetContentProtectionCaps(struct NineDevice9Video * This,const GUID * pCryptoType,const GUID * pDecodeProfile,D3DCONTENTPROTECTIONCAPS * pCaps)2405 LockDevice9Video_GetContentProtectionCaps( struct NineDevice9Video *This,
2406 const GUID *pCryptoType,
2407 const GUID *pDecodeProfile,
2408 D3DCONTENTPROTECTIONCAPS *pCaps )
2409 {
2410 HRESULT r;
2411 simple_mtx_lock(&d3dlock_global);
2412 r = NineDevice9Video_GetContentProtectionCaps(This, pCryptoType, pDecodeProfile, pCaps);
2413 simple_mtx_unlock(&d3dlock_global);
2414 return r;
2415 }
2416
2417 static HRESULT NINE_WINAPI
LockDevice9Video_CreateAuthenticatedChannel(struct NineDevice9Video * This,D3DAUTHENTICATEDCHANNELTYPE ChannelType,IDirect3DAuthenticatedChannel9 ** ppAuthenticatedChannel,HANDLE * pChannelHandle)2418 LockDevice9Video_CreateAuthenticatedChannel( struct NineDevice9Video *This,
2419 D3DAUTHENTICATEDCHANNELTYPE ChannelType,
2420 IDirect3DAuthenticatedChannel9 **ppAuthenticatedChannel,
2421 HANDLE *pChannelHandle )
2422 {
2423 HRESULT r;
2424 simple_mtx_lock(&d3dlock_global);
2425 r = NineDevice9Video_CreateAuthenticatedChannel(This, ChannelType, ppAuthenticatedChannel, pChannelHandle);
2426 simple_mtx_unlock(&d3dlock_global);
2427 return r;
2428 }
2429
2430 static HRESULT NINE_WINAPI
LockDevice9Video_CreateCryptoSession(struct NineDevice9Video * This,const GUID * pCryptoType,const GUID * pDecodeProfile,IDirect3DCryptoSession9 ** ppCryptoSession,HANDLE * pCryptoHandle)2431 LockDevice9Video_CreateCryptoSession( struct NineDevice9Video *This,
2432 const GUID *pCryptoType,
2433 const GUID *pDecodeProfile,
2434 IDirect3DCryptoSession9 **ppCryptoSession,
2435 HANDLE *pCryptoHandle )
2436 {
2437 HRESULT r;
2438 simple_mtx_lock(&d3dlock_global);
2439 r = NineDevice9Video_CreateCryptoSession(This, pCryptoType, pDecodeProfile, ppCryptoSession, pCryptoHandle);
2440 simple_mtx_unlock(&d3dlock_global);
2441 return r;
2442 }
2443
2444 IDirect3DDevice9VideoVtbl LockDevice9Video_vtable = {
2445 (void *)NineUnknown_QueryInterface,
2446 (void *)NineUnknown_AddRef,
2447 (void *)NineUnknown_ReleaseWithDtorLock,
2448 (void *)LockDevice9Video_GetContentProtectionCaps,
2449 (void *)LockDevice9Video_CreateAuthenticatedChannel,
2450 (void *)LockDevice9Video_CreateCryptoSession
2451 };
2452
2453 static HRESULT NINE_WINAPI
LockIndexBuffer9_Lock(struct NineIndexBuffer9 * This,UINT OffsetToLock,UINT SizeToLock,void ** ppbData,DWORD Flags)2454 LockIndexBuffer9_Lock( struct NineIndexBuffer9 *This,
2455 UINT OffsetToLock,
2456 UINT SizeToLock,
2457 void **ppbData,
2458 DWORD Flags )
2459 {
2460 HRESULT r;
2461 simple_mtx_lock(&d3dlock_global);
2462 r = NineIndexBuffer9_Lock(This, OffsetToLock, SizeToLock, ppbData, Flags);
2463 simple_mtx_unlock(&d3dlock_global);
2464 return r;
2465 }
2466
2467 static HRESULT NINE_WINAPI
LockIndexBuffer9_Unlock(struct NineIndexBuffer9 * This)2468 LockIndexBuffer9_Unlock( struct NineIndexBuffer9 *This )
2469 {
2470 HRESULT r;
2471 simple_mtx_lock(&d3dlock_global);
2472 r = NineIndexBuffer9_Unlock(This);
2473 simple_mtx_unlock(&d3dlock_global);
2474 return r;
2475 }
2476
2477 #if 0
2478 static HRESULT NINE_WINAPI
2479 LockIndexBuffer9_GetDesc( struct NineIndexBuffer9 *This,
2480 D3DINDEXBUFFER_DESC *pDesc )
2481 {
2482 HRESULT r;
2483 simple_mtx_lock(&d3dlock_global);
2484 r = NineIndexBuffer9_GetDesc(This, pDesc);
2485 simple_mtx_unlock(&d3dlock_global);
2486 return r;
2487 }
2488 #endif
2489
2490 IDirect3DIndexBuffer9Vtbl LockIndexBuffer9_vtable = {
2491 (void *)NineUnknown_QueryInterface,
2492 (void *)NineUnknown_AddRef,
2493 (void *)NineUnknown_ReleaseWithDtorLock,
2494 (void *)NineUnknown_GetDevice, /* actually part of Resource9 iface */
2495 (void *)LockUnknown_SetPrivateData,
2496 (void *)LockUnknown_GetPrivateData,
2497 (void *)LockUnknown_FreePrivateData,
2498 (void *)LockResource9_SetPriority,
2499 (void *)LockResource9_GetPriority,
2500 (void *)NineResource9_PreLoad, /* nop */
2501 (void *)NineResource9_GetType, /* immutable */
2502 (void *)LockIndexBuffer9_Lock,
2503 (void *)LockIndexBuffer9_Unlock,
2504 (void *)NineIndexBuffer9_GetDesc /* immutable */
2505 };
2506
2507 #if 0
2508 static HRESULT NINE_WINAPI
2509 LockPixelShader9_GetDevice( struct NinePixelShader9 *This,
2510 IDirect3DDevice9 **ppDevice )
2511 {
2512 HRESULT r;
2513 simple_mtx_lock(&d3dlock_global);
2514 r = NineUnknown_GetDevice(NineUnknown(This), ppDevice);
2515 simple_mtx_unlock(&d3dlock_global);
2516 return r;
2517 }
2518 #endif
2519
2520 static HRESULT NINE_WINAPI
LockPixelShader9_GetFunction(struct NinePixelShader9 * This,void * pData,UINT * pSizeOfData)2521 LockPixelShader9_GetFunction( struct NinePixelShader9 *This,
2522 void *pData,
2523 UINT *pSizeOfData )
2524 {
2525 HRESULT r;
2526 simple_mtx_lock(&d3dlock_global);
2527 r = NinePixelShader9_GetFunction(This, pData, pSizeOfData);
2528 simple_mtx_unlock(&d3dlock_global);
2529 return r;
2530 }
2531
2532 IDirect3DPixelShader9Vtbl LockPixelShader9_vtable = {
2533 (void *)NineUnknown_QueryInterface,
2534 (void *)NineUnknown_AddRef,
2535 (void *)NineUnknown_ReleaseWithDtorLock,
2536 (void *)NineUnknown_GetDevice,
2537 (void *)LockPixelShader9_GetFunction
2538 };
2539
2540 #if 0
2541 static HRESULT NINE_WINAPI
2542 LockQuery9_GetDevice( struct NineQuery9 *This,
2543 IDirect3DDevice9 **ppDevice )
2544 {
2545 HRESULT r;
2546 simple_mtx_lock(&d3dlock_global);
2547 r = NineUnknown_GetDevice(NineUnknown(This), ppDevice);
2548 simple_mtx_unlock(&d3dlock_global);
2549 return r;
2550 }
2551 #endif
2552
2553 #if 0
2554 static D3DQUERYTYPE NINE_WINAPI
2555 LockQuery9_GetType( struct NineQuery9 *This )
2556 {
2557 D3DQUERYTYPE r;
2558 simple_mtx_lock(&d3dlock_global);
2559 r = NineQuery9_GetType(This);
2560 simple_mtx_unlock(&d3dlock_global);
2561 return r;
2562 }
2563 #endif
2564
2565 #if 0
2566 static DWORD NINE_WINAPI
2567 LockQuery9_GetDataSize( struct NineQuery9 *This )
2568 {
2569 DWORD r;
2570 simple_mtx_lock(&d3dlock_global);
2571 r = NineQuery9_GetDataSize(This);
2572 simple_mtx_unlock(&d3dlock_global);
2573 return r;
2574 }
2575 #endif
2576
2577 static HRESULT NINE_WINAPI
LockQuery9_Issue(struct NineQuery9 * This,DWORD dwIssueFlags)2578 LockQuery9_Issue( struct NineQuery9 *This,
2579 DWORD dwIssueFlags )
2580 {
2581 HRESULT r;
2582 simple_mtx_lock(&d3dlock_global);
2583 r = NineQuery9_Issue(This, dwIssueFlags);
2584 simple_mtx_unlock(&d3dlock_global);
2585 return r;
2586 }
2587
2588 static HRESULT NINE_WINAPI
LockQuery9_GetData(struct NineQuery9 * This,void * pData,DWORD dwSize,DWORD dwGetDataFlags)2589 LockQuery9_GetData( struct NineQuery9 *This,
2590 void *pData,
2591 DWORD dwSize,
2592 DWORD dwGetDataFlags )
2593 {
2594 HRESULT r;
2595 simple_mtx_lock(&d3dlock_global);
2596 r = NineQuery9_GetData(This, pData, dwSize, dwGetDataFlags);
2597 simple_mtx_unlock(&d3dlock_global);
2598 return r;
2599 }
2600
2601 IDirect3DQuery9Vtbl LockQuery9_vtable = {
2602 (void *)NineUnknown_QueryInterface,
2603 (void *)NineUnknown_AddRef,
2604 (void *)NineUnknown_ReleaseWithDtorLock,
2605 (void *)NineUnknown_GetDevice, /* actually part of Query9 iface */
2606 (void *)NineQuery9_GetType, /* immutable */
2607 (void *)NineQuery9_GetDataSize, /* immutable */
2608 (void *)LockQuery9_Issue,
2609 (void *)LockQuery9_GetData
2610 };
2611
2612 #if 0
2613 static HRESULT NINE_WINAPI
2614 LockStateBlock9_GetDevice( struct NineStateBlock9 *This,
2615 IDirect3DDevice9 **ppDevice )
2616 {
2617 HRESULT r;
2618 simple_mtx_lock(&d3dlock_global);
2619 r = NineUnknown_GetDevice(NineUnknown(This), ppDevice);
2620 simple_mtx_unlock(&d3dlock_global);
2621 return r;
2622 }
2623 #endif
2624
2625 static HRESULT NINE_WINAPI
LockStateBlock9_Capture(struct NineStateBlock9 * This)2626 LockStateBlock9_Capture( struct NineStateBlock9 *This )
2627 {
2628 HRESULT r;
2629 simple_mtx_lock(&d3dlock_global);
2630 r = NineStateBlock9_Capture(This);
2631 simple_mtx_unlock(&d3dlock_global);
2632 return r;
2633 }
2634
2635 static HRESULT NINE_WINAPI
LockStateBlock9_Apply(struct NineStateBlock9 * This)2636 LockStateBlock9_Apply( struct NineStateBlock9 *This )
2637 {
2638 HRESULT r;
2639 simple_mtx_lock(&d3dlock_global);
2640 r = NineStateBlock9_Apply(This);
2641 simple_mtx_unlock(&d3dlock_global);
2642 return r;
2643 }
2644
2645 IDirect3DStateBlock9Vtbl LockStateBlock9_vtable = {
2646 (void *)NineUnknown_QueryInterface,
2647 (void *)NineUnknown_AddRef,
2648 (void *)NineUnknown_ReleaseWithDtorLock,
2649 (void *)NineUnknown_GetDevice, /* actually part of StateBlock9 iface */
2650 (void *)LockStateBlock9_Capture,
2651 (void *)LockStateBlock9_Apply
2652 };
2653
2654 static HRESULT NINE_WINAPI
LockSurface9_GetContainer(struct NineSurface9 * This,REFIID riid,void ** ppContainer)2655 LockSurface9_GetContainer( struct NineSurface9 *This,
2656 REFIID riid,
2657 void **ppContainer )
2658 {
2659 HRESULT r;
2660 simple_mtx_lock(&d3dlock_global);
2661 r = NineSurface9_GetContainer(This, riid, ppContainer);
2662 simple_mtx_unlock(&d3dlock_global);
2663 return r;
2664 }
2665
2666 #if 0
2667 static HRESULT NINE_WINAPI
2668 LockSurface9_GetDesc( struct NineSurface9 *This,
2669 D3DSURFACE_DESC *pDesc )
2670 {
2671 HRESULT r;
2672 simple_mtx_lock(&d3dlock_global);
2673 r = NineSurface9_GetDesc(This, pDesc);
2674 simple_mtx_unlock(&d3dlock_global);
2675 return r;
2676 }
2677 #endif
2678
2679 static HRESULT NINE_WINAPI
LockSurface9_LockRect(struct NineSurface9 * This,D3DLOCKED_RECT * pLockedRect,const RECT * pRect,DWORD Flags)2680 LockSurface9_LockRect( struct NineSurface9 *This,
2681 D3DLOCKED_RECT *pLockedRect,
2682 const RECT *pRect,
2683 DWORD Flags )
2684 {
2685 HRESULT r;
2686 simple_mtx_lock(&d3dlock_global);
2687 r = NineSurface9_LockRect(This, pLockedRect, pRect, Flags);
2688 simple_mtx_unlock(&d3dlock_global);
2689 return r;
2690 }
2691
2692 static HRESULT NINE_WINAPI
LockSurface9_UnlockRect(struct NineSurface9 * This)2693 LockSurface9_UnlockRect( struct NineSurface9 *This )
2694 {
2695 HRESULT r;
2696 simple_mtx_lock(&d3dlock_global);
2697 r = NineSurface9_UnlockRect(This);
2698 simple_mtx_unlock(&d3dlock_global);
2699 return r;
2700 }
2701
2702 static HRESULT NINE_WINAPI
LockSurface9_GetDC(struct NineSurface9 * This,HDC * phdc)2703 LockSurface9_GetDC( struct NineSurface9 *This,
2704 HDC *phdc )
2705 {
2706 HRESULT r;
2707 simple_mtx_lock(&d3dlock_global);
2708 r = NineSurface9_GetDC(This, phdc);
2709 simple_mtx_unlock(&d3dlock_global);
2710 return r;
2711 }
2712
2713 static HRESULT NINE_WINAPI
LockSurface9_ReleaseDC(struct NineSurface9 * This,HDC hdc)2714 LockSurface9_ReleaseDC( struct NineSurface9 *This,
2715 HDC hdc )
2716 {
2717 HRESULT r;
2718 simple_mtx_lock(&d3dlock_global);
2719 r = NineSurface9_ReleaseDC(This, hdc);
2720 simple_mtx_unlock(&d3dlock_global);
2721 return r;
2722 }
2723
2724 IDirect3DSurface9Vtbl LockSurface9_vtable = {
2725 (void *)NineUnknown_QueryInterface,
2726 (void *)NineUnknown_AddRef,
2727 (void *)NineUnknown_ReleaseWithDtorLock,
2728 (void *)NineUnknown_GetDevice, /* actually part of Resource9 iface */
2729 (void *)LockUnknown_SetPrivateData,
2730 (void *)LockUnknown_GetPrivateData,
2731 (void *)LockUnknown_FreePrivateData,
2732 (void *)LockResource9_SetPriority,
2733 (void *)LockResource9_GetPriority,
2734 (void *)NineResource9_PreLoad, /* nop */
2735 (void *)NineResource9_GetType, /* immutable */
2736 (void *)LockSurface9_GetContainer,
2737 (void *)NineSurface9_GetDesc, /* immutable */
2738 (void *)LockSurface9_LockRect,
2739 (void *)LockSurface9_UnlockRect,
2740 (void *)LockSurface9_GetDC,
2741 (void *)LockSurface9_ReleaseDC
2742 };
2743
2744 static HRESULT NINE_WINAPI
LockSwapChain9_Present(struct NineSwapChain9 * This,const RECT * pSourceRect,const RECT * pDestRect,HWND hDestWindowOverride,const RGNDATA * pDirtyRegion,DWORD dwFlags)2745 LockSwapChain9_Present( struct NineSwapChain9 *This,
2746 const RECT *pSourceRect,
2747 const RECT *pDestRect,
2748 HWND hDestWindowOverride,
2749 const RGNDATA *pDirtyRegion,
2750 DWORD dwFlags )
2751 {
2752 HRESULT r;
2753 simple_mtx_lock(&d3dlock_global);
2754 r = NineSwapChain9_Present(This, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion, dwFlags);
2755 simple_mtx_unlock(&d3dlock_global);
2756 return r;
2757 }
2758
2759 static HRESULT NINE_WINAPI
LockSwapChain9_GetFrontBufferData(struct NineSwapChain9 * This,IDirect3DSurface9 * pDestSurface)2760 LockSwapChain9_GetFrontBufferData( struct NineSwapChain9 *This,
2761 IDirect3DSurface9 *pDestSurface )
2762 {
2763 HRESULT r;
2764 simple_mtx_lock(&d3dlock_global);
2765 r = NineSwapChain9_GetFrontBufferData(This, pDestSurface);
2766 simple_mtx_unlock(&d3dlock_global);
2767 return r;
2768 }
2769
2770 static HRESULT NINE_WINAPI
LockSwapChain9_GetBackBuffer(struct NineSwapChain9 * This,UINT iBackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface9 ** ppBackBuffer)2771 LockSwapChain9_GetBackBuffer( struct NineSwapChain9 *This,
2772 UINT iBackBuffer,
2773 D3DBACKBUFFER_TYPE Type,
2774 IDirect3DSurface9 **ppBackBuffer )
2775 {
2776 HRESULT r;
2777 simple_mtx_lock(&d3dlock_global);
2778 r = NineSwapChain9_GetBackBuffer(This, iBackBuffer, Type, ppBackBuffer);
2779 simple_mtx_unlock(&d3dlock_global);
2780 return r;
2781 }
2782
2783 static HRESULT NINE_WINAPI
LockSwapChain9_GetRasterStatus(struct NineSwapChain9 * This,D3DRASTER_STATUS * pRasterStatus)2784 LockSwapChain9_GetRasterStatus( struct NineSwapChain9 *This,
2785 D3DRASTER_STATUS *pRasterStatus )
2786 {
2787 HRESULT r;
2788 simple_mtx_lock(&d3dlock_global);
2789 r = NineSwapChain9_GetRasterStatus(This, pRasterStatus);
2790 simple_mtx_unlock(&d3dlock_global);
2791 return r;
2792 }
2793
2794 static HRESULT NINE_WINAPI
LockSwapChain9_GetDisplayMode(struct NineSwapChain9 * This,D3DDISPLAYMODE * pMode)2795 LockSwapChain9_GetDisplayMode( struct NineSwapChain9 *This,
2796 D3DDISPLAYMODE *pMode )
2797 {
2798 HRESULT r;
2799 simple_mtx_lock(&d3dlock_global);
2800 r = NineSwapChain9_GetDisplayMode(This, pMode);
2801 simple_mtx_unlock(&d3dlock_global);
2802 return r;
2803 }
2804
2805 #if 0
2806 static HRESULT NINE_WINAPI
2807 LockSwapChain9_GetDevice( struct NineSwapChain9 *This,
2808 IDirect3DDevice9 **ppDevice )
2809 {
2810 HRESULT r;
2811 simple_mtx_lock(&d3dlock_global);
2812 r = NineUnknown_GetDevice(NineUnknown(This), ppDevice);
2813 simple_mtx_unlock(&d3dlock_global);
2814 return r;
2815 }
2816 #endif
2817
2818 static HRESULT NINE_WINAPI
LockSwapChain9_GetPresentParameters(struct NineSwapChain9 * This,D3DPRESENT_PARAMETERS * pPresentationParameters)2819 LockSwapChain9_GetPresentParameters( struct NineSwapChain9 *This,
2820 D3DPRESENT_PARAMETERS *pPresentationParameters )
2821 {
2822 HRESULT r;
2823 simple_mtx_lock(&d3dlock_global);
2824 r = NineSwapChain9_GetPresentParameters(This, pPresentationParameters);
2825 simple_mtx_unlock(&d3dlock_global);
2826 return r;
2827 }
2828
2829 IDirect3DSwapChain9Vtbl LockSwapChain9_vtable = {
2830 (void *)NineUnknown_QueryInterface,
2831 (void *)NineUnknown_AddRef,
2832 (void *)NineUnknown_ReleaseWithDtorLock,
2833 (void *)LockSwapChain9_Present,
2834 (void *)LockSwapChain9_GetFrontBufferData,
2835 (void *)LockSwapChain9_GetBackBuffer,
2836 (void *)LockSwapChain9_GetRasterStatus,
2837 (void *)LockSwapChain9_GetDisplayMode,
2838 (void *)NineUnknown_GetDevice, /* actually part of SwapChain9 iface */
2839 (void *)LockSwapChain9_GetPresentParameters
2840 };
2841
2842 static HRESULT NINE_WINAPI
LockSwapChain9Ex_GetLastPresentCount(struct NineSwapChain9Ex * This,UINT * pLastPresentCount)2843 LockSwapChain9Ex_GetLastPresentCount( struct NineSwapChain9Ex *This,
2844 UINT *pLastPresentCount )
2845 {
2846 HRESULT r;
2847 simple_mtx_lock(&d3dlock_global);
2848 r = NineSwapChain9Ex_GetLastPresentCount(This, pLastPresentCount);
2849 simple_mtx_unlock(&d3dlock_global);
2850 return r;
2851 }
2852
2853 static HRESULT NINE_WINAPI
LockSwapChain9Ex_GetPresentStats(struct NineSwapChain9Ex * This,D3DPRESENTSTATS * pPresentationStatistics)2854 LockSwapChain9Ex_GetPresentStats( struct NineSwapChain9Ex *This,
2855 D3DPRESENTSTATS *pPresentationStatistics )
2856 {
2857 HRESULT r;
2858 simple_mtx_lock(&d3dlock_global);
2859 r = NineSwapChain9Ex_GetPresentStats(This, pPresentationStatistics);
2860 simple_mtx_unlock(&d3dlock_global);
2861 return r;
2862 }
2863
2864 static HRESULT NINE_WINAPI
LockSwapChain9Ex_GetDisplayModeEx(struct NineSwapChain9Ex * This,D3DDISPLAYMODEEX * pMode,D3DDISPLAYROTATION * pRotation)2865 LockSwapChain9Ex_GetDisplayModeEx( struct NineSwapChain9Ex *This,
2866 D3DDISPLAYMODEEX *pMode,
2867 D3DDISPLAYROTATION *pRotation )
2868 {
2869 HRESULT r;
2870 simple_mtx_lock(&d3dlock_global);
2871 r = NineSwapChain9Ex_GetDisplayModeEx(This, pMode, pRotation);
2872 simple_mtx_unlock(&d3dlock_global);
2873 return r;
2874 }
2875
2876 IDirect3DSwapChain9ExVtbl LockSwapChain9Ex_vtable = {
2877 (void *)NineUnknown_QueryInterface,
2878 (void *)NineUnknown_AddRef,
2879 (void *)NineUnknown_ReleaseWithDtorLock,
2880 (void *)LockSwapChain9_Present,
2881 (void *)LockSwapChain9_GetFrontBufferData,
2882 (void *)LockSwapChain9_GetBackBuffer,
2883 (void *)LockSwapChain9_GetRasterStatus,
2884 (void *)LockSwapChain9_GetDisplayMode,
2885 (void *)NineUnknown_GetDevice, /* actually part of NineSwapChain9 iface */
2886 (void *)LockSwapChain9_GetPresentParameters,
2887 (void *)LockSwapChain9Ex_GetLastPresentCount,
2888 (void *)LockSwapChain9Ex_GetPresentStats,
2889 (void *)LockSwapChain9Ex_GetDisplayModeEx
2890 };
2891
2892 #if 0
2893 static HRESULT NINE_WINAPI
2894 LockTexture9_GetLevelDesc( struct NineTexture9 *This,
2895 UINT Level,
2896 D3DSURFACE_DESC *pDesc )
2897 {
2898 HRESULT r;
2899 simple_mtx_lock(&d3dlock_global);
2900 r = NineTexture9_GetLevelDesc(This, Level, pDesc);
2901 simple_mtx_unlock(&d3dlock_global);
2902 return r;
2903 }
2904 #endif
2905
2906 #if 0
2907 static HRESULT NINE_WINAPI
2908 LockTexture9_GetSurfaceLevel( struct NineTexture9 *This,
2909 UINT Level,
2910 IDirect3DSurface9 **ppSurfaceLevel )
2911 {
2912 HRESULT r;
2913 simple_mtx_lock(&d3dlock_global);
2914 r = NineTexture9_GetSurfaceLevel(This, Level, ppSurfaceLevel);
2915 simple_mtx_unlock(&d3dlock_global);
2916 return r;
2917 }
2918 #endif
2919
2920 static HRESULT NINE_WINAPI
LockTexture9_LockRect(struct NineTexture9 * This,UINT Level,D3DLOCKED_RECT * pLockedRect,const RECT * pRect,DWORD Flags)2921 LockTexture9_LockRect( struct NineTexture9 *This,
2922 UINT Level,
2923 D3DLOCKED_RECT *pLockedRect,
2924 const RECT *pRect,
2925 DWORD Flags )
2926 {
2927 HRESULT r;
2928 simple_mtx_lock(&d3dlock_global);
2929 r = NineTexture9_LockRect(This, Level, pLockedRect, pRect, Flags);
2930 simple_mtx_unlock(&d3dlock_global);
2931 return r;
2932 }
2933
2934 static HRESULT NINE_WINAPI
LockTexture9_UnlockRect(struct NineTexture9 * This,UINT Level)2935 LockTexture9_UnlockRect( struct NineTexture9 *This,
2936 UINT Level )
2937 {
2938 HRESULT r;
2939 simple_mtx_lock(&d3dlock_global);
2940 r = NineTexture9_UnlockRect(This, Level);
2941 simple_mtx_unlock(&d3dlock_global);
2942 return r;
2943 }
2944
2945 static HRESULT NINE_WINAPI
LockTexture9_AddDirtyRect(struct NineTexture9 * This,const RECT * pDirtyRect)2946 LockTexture9_AddDirtyRect( struct NineTexture9 *This,
2947 const RECT *pDirtyRect )
2948 {
2949 HRESULT r;
2950 simple_mtx_lock(&d3dlock_global);
2951 r = NineTexture9_AddDirtyRect(This, pDirtyRect);
2952 simple_mtx_unlock(&d3dlock_global);
2953 return r;
2954 }
2955
2956 IDirect3DTexture9Vtbl LockTexture9_vtable = {
2957 (void *)NineUnknown_QueryInterface,
2958 (void *)NineUnknown_AddRef,
2959 (void *)NineUnknown_ReleaseWithDtorLock,
2960 (void *)NineUnknown_GetDevice, /* actually part of Resource9 iface */
2961 (void *)LockUnknown_SetPrivateData,
2962 (void *)LockUnknown_GetPrivateData,
2963 (void *)LockUnknown_FreePrivateData,
2964 (void *)LockResource9_SetPriority,
2965 (void *)LockResource9_GetPriority,
2966 (void *)LockBaseTexture9_PreLoad,
2967 (void *)NineResource9_GetType, /* immutable */
2968 (void *)LockBaseTexture9_SetLOD,
2969 (void *)LockBaseTexture9_GetLOD,
2970 (void *)LockBaseTexture9_GetLevelCount,
2971 (void *)LockBaseTexture9_SetAutoGenFilterType,
2972 (void *)LockBaseTexture9_GetAutoGenFilterType,
2973 (void *)LockBaseTexture9_GenerateMipSubLevels,
2974 (void *)NineTexture9_GetLevelDesc, /* immutable */
2975 (void *)NineTexture9_GetSurfaceLevel, /* AddRef */
2976 (void *)LockTexture9_LockRect,
2977 (void *)LockTexture9_UnlockRect,
2978 (void *)LockTexture9_AddDirtyRect
2979 };
2980
2981 static HRESULT NINE_WINAPI
LockVertexBuffer9_Lock(struct NineVertexBuffer9 * This,UINT OffsetToLock,UINT SizeToLock,void ** ppbData,DWORD Flags)2982 LockVertexBuffer9_Lock( struct NineVertexBuffer9 *This,
2983 UINT OffsetToLock,
2984 UINT SizeToLock,
2985 void **ppbData,
2986 DWORD Flags )
2987 {
2988 HRESULT r;
2989 simple_mtx_lock(&d3dlock_global);
2990 r = NineVertexBuffer9_Lock(This, OffsetToLock, SizeToLock, ppbData, Flags);
2991 simple_mtx_unlock(&d3dlock_global);
2992 return r;
2993 }
2994
2995 static HRESULT NINE_WINAPI
LockVertexBuffer9_Unlock(struct NineVertexBuffer9 * This)2996 LockVertexBuffer9_Unlock( struct NineVertexBuffer9 *This )
2997 {
2998 HRESULT r;
2999 simple_mtx_lock(&d3dlock_global);
3000 r = NineVertexBuffer9_Unlock(This);
3001 simple_mtx_unlock(&d3dlock_global);
3002 return r;
3003 }
3004
3005 #if 0
3006 static HRESULT NINE_WINAPI
3007 LockVertexBuffer9_GetDesc( struct NineVertexBuffer9 *This,
3008 D3DVERTEXBUFFER_DESC *pDesc )
3009 {
3010 HRESULT r;
3011 simple_mtx_lock(&d3dlock_global);
3012 r = NineVertexBuffer9_GetDesc(This, pDesc);
3013 simple_mtx_unlock(&d3dlock_global);
3014 return r;
3015 }
3016 #endif
3017
3018 IDirect3DVertexBuffer9Vtbl LockVertexBuffer9_vtable = {
3019 (void *)NineUnknown_QueryInterface,
3020 (void *)NineUnknown_AddRef,
3021 (void *)NineUnknown_ReleaseWithDtorLock,
3022 (void *)NineUnknown_GetDevice, /* actually part of Resource9 iface */
3023 (void *)LockUnknown_SetPrivateData,
3024 (void *)LockUnknown_GetPrivateData,
3025 (void *)LockUnknown_FreePrivateData,
3026 (void *)LockResource9_SetPriority,
3027 (void *)LockResource9_GetPriority,
3028 (void *)NineResource9_PreLoad, /* nop */
3029 (void *)NineResource9_GetType, /* immutable */
3030 (void *)LockVertexBuffer9_Lock,
3031 (void *)LockVertexBuffer9_Unlock,
3032 (void *)NineVertexBuffer9_GetDesc /* immutable */
3033 };
3034
3035 #if 0
3036 static HRESULT NINE_WINAPI
3037 LockVertexDeclaration9_GetDevice( struct NineVertexDeclaration9 *This,
3038 IDirect3DDevice9 **ppDevice )
3039 {
3040 HRESULT r;
3041 simple_mtx_lock(&d3dlock_global);
3042 r = NineUnknown_GetDevice(NineUnknown(This), ppDevice);
3043 simple_mtx_unlock(&d3dlock_global);
3044 return r;
3045 }
3046 #endif
3047
3048 static HRESULT NINE_WINAPI
LockVertexDeclaration9_GetDeclaration(struct NineVertexDeclaration9 * This,D3DVERTEXELEMENT9 * pElement,UINT * pNumElements)3049 LockVertexDeclaration9_GetDeclaration( struct NineVertexDeclaration9 *This,
3050 D3DVERTEXELEMENT9 *pElement,
3051 UINT *pNumElements )
3052 {
3053 HRESULT r;
3054 simple_mtx_lock(&d3dlock_global);
3055 r = NineVertexDeclaration9_GetDeclaration(This, pElement, pNumElements);
3056 simple_mtx_unlock(&d3dlock_global);
3057 return r;
3058 }
3059
3060 IDirect3DVertexDeclaration9Vtbl LockVertexDeclaration9_vtable = {
3061 (void *)NineUnknown_QueryInterface,
3062 (void *)NineUnknown_AddRef,
3063 (void *)NineUnknown_ReleaseWithDtorLock,
3064 (void *)NineUnknown_GetDevice, /* actually part of VertexDecl9 iface */
3065 (void *)LockVertexDeclaration9_GetDeclaration
3066 };
3067
3068 #if 0
3069 static HRESULT NINE_WINAPI
3070 LockVertexShader9_GetDevice( struct NineVertexShader9 *This,
3071 IDirect3DDevice9 **ppDevice )
3072 {
3073 HRESULT r;
3074 simple_mtx_lock(&d3dlock_global);
3075 r = NineUnknown_GetDevice(NineUnknown(This), ppDevice);
3076 simple_mtx_unlock(&d3dlock_global);
3077 return r;
3078 }
3079 #endif
3080
3081 static HRESULT NINE_WINAPI
LockVertexShader9_GetFunction(struct NineVertexShader9 * This,void * pData,UINT * pSizeOfData)3082 LockVertexShader9_GetFunction( struct NineVertexShader9 *This,
3083 void *pData,
3084 UINT *pSizeOfData )
3085 {
3086 HRESULT r;
3087 simple_mtx_lock(&d3dlock_global);
3088 r = NineVertexShader9_GetFunction(This, pData, pSizeOfData);
3089 simple_mtx_unlock(&d3dlock_global);
3090 return r;
3091 }
3092
3093 IDirect3DVertexShader9Vtbl LockVertexShader9_vtable = {
3094 (void *)NineUnknown_QueryInterface,
3095 (void *)NineUnknown_AddRef,
3096 (void *)NineUnknown_ReleaseWithDtorLock,
3097 (void *)NineUnknown_GetDevice,
3098 (void *)LockVertexShader9_GetFunction
3099 };
3100
3101 #if 0
3102 static HRESULT NINE_WINAPI
3103 LockVolume9_GetDevice( struct NineVolume9 *This,
3104 IDirect3DDevice9 **ppDevice )
3105 {
3106 HRESULT r;
3107 simple_mtx_lock(&d3dlock_global);
3108 r = NineUnknown_GetDevice(NineUnknown(This), ppDevice);
3109 simple_mtx_unlock(&d3dlock_global);
3110 return r;
3111 }
3112 #endif
3113
3114 static HRESULT NINE_WINAPI
LockVolume9_GetContainer(struct NineVolume9 * This,REFIID riid,void ** ppContainer)3115 LockVolume9_GetContainer( struct NineVolume9 *This,
3116 REFIID riid,
3117 void **ppContainer )
3118 {
3119 HRESULT r;
3120 simple_mtx_lock(&d3dlock_global);
3121 r = NineVolume9_GetContainer(This, riid, ppContainer);
3122 simple_mtx_unlock(&d3dlock_global);
3123 return r;
3124 }
3125
3126 #if 0
3127 static HRESULT NINE_WINAPI
3128 LockVolume9_GetDesc( struct NineVolume9 *This,
3129 D3DVOLUME_DESC *pDesc )
3130 {
3131 HRESULT r;
3132 simple_mtx_lock(&d3dlock_global);
3133 r = NineVolume9_GetDesc(This, pDesc);
3134 simple_mtx_unlock(&d3dlock_global);
3135 return r;
3136 }
3137 #endif
3138
3139 static HRESULT NINE_WINAPI
LockVolume9_LockBox(struct NineVolume9 * This,D3DLOCKED_BOX * pLockedVolume,const D3DBOX * pBox,DWORD Flags)3140 LockVolume9_LockBox( struct NineVolume9 *This,
3141 D3DLOCKED_BOX *pLockedVolume,
3142 const D3DBOX *pBox,
3143 DWORD Flags )
3144 {
3145 HRESULT r;
3146 simple_mtx_lock(&d3dlock_global);
3147 r = NineVolume9_LockBox(This, pLockedVolume, pBox, Flags);
3148 simple_mtx_unlock(&d3dlock_global);
3149 return r;
3150 }
3151
3152 static HRESULT NINE_WINAPI
LockVolume9_UnlockBox(struct NineVolume9 * This)3153 LockVolume9_UnlockBox( struct NineVolume9 *This )
3154 {
3155 HRESULT r;
3156 simple_mtx_lock(&d3dlock_global);
3157 r = NineVolume9_UnlockBox(This);
3158 simple_mtx_unlock(&d3dlock_global);
3159 return r;
3160 }
3161
3162 IDirect3DVolume9Vtbl LockVolume9_vtable = {
3163 (void *)NineUnknown_QueryInterface,
3164 (void *)NineUnknown_AddRef,
3165 (void *)NineUnknown_ReleaseWithDtorLock,
3166 (void *)NineUnknown_GetDevice, /* actually part of Volume9 iface */
3167 (void *)LockUnknown_SetPrivateData,
3168 (void *)LockUnknown_GetPrivateData,
3169 (void *)LockUnknown_FreePrivateData,
3170 (void *)LockVolume9_GetContainer,
3171 (void *)NineVolume9_GetDesc, /* immutable */
3172 (void *)LockVolume9_LockBox,
3173 (void *)LockVolume9_UnlockBox
3174 };
3175
3176 #if 0
3177 static HRESULT NINE_WINAPI
3178 LockVolumeTexture9_GetLevelDesc( struct NineVolumeTexture9 *This,
3179 UINT Level,
3180 D3DVOLUME_DESC *pDesc )
3181 {
3182 HRESULT r;
3183 simple_mtx_lock(&d3dlock_global);
3184 r = NineVolumeTexture9_GetLevelDesc(This, Level, pDesc);
3185 simple_mtx_unlock(&d3dlock_global);
3186 return r;
3187 }
3188 #endif
3189
3190 #if 0
3191 static HRESULT NINE_WINAPI
3192 LockVolumeTexture9_GetVolumeLevel( struct NineVolumeTexture9 *This,
3193 UINT Level,
3194 IDirect3DVolume9 **ppVolumeLevel )
3195 {
3196 HRESULT r;
3197 simple_mtx_lock(&d3dlock_global);
3198 r = NineVolumeTexture9_GetVolumeLevel(This, Level, ppVolumeLevel);
3199 simple_mtx_unlock(&d3dlock_global);
3200 return r;
3201 }
3202 #endif
3203
3204 static HRESULT NINE_WINAPI
LockVolumeTexture9_LockBox(struct NineVolumeTexture9 * This,UINT Level,D3DLOCKED_BOX * pLockedVolume,const D3DBOX * pBox,DWORD Flags)3205 LockVolumeTexture9_LockBox( struct NineVolumeTexture9 *This,
3206 UINT Level,
3207 D3DLOCKED_BOX *pLockedVolume,
3208 const D3DBOX *pBox,
3209 DWORD Flags )
3210 {
3211 HRESULT r;
3212 simple_mtx_lock(&d3dlock_global);
3213 r = NineVolumeTexture9_LockBox(This, Level, pLockedVolume, pBox, Flags);
3214 simple_mtx_unlock(&d3dlock_global);
3215 return r;
3216 }
3217
3218 static HRESULT NINE_WINAPI
LockVolumeTexture9_UnlockBox(struct NineVolumeTexture9 * This,UINT Level)3219 LockVolumeTexture9_UnlockBox( struct NineVolumeTexture9 *This,
3220 UINT Level )
3221 {
3222 HRESULT r;
3223 simple_mtx_lock(&d3dlock_global);
3224 r = NineVolumeTexture9_UnlockBox(This, Level);
3225 simple_mtx_unlock(&d3dlock_global);
3226 return r;
3227 }
3228
3229 static HRESULT NINE_WINAPI
LockVolumeTexture9_AddDirtyBox(struct NineVolumeTexture9 * This,const D3DBOX * pDirtyBox)3230 LockVolumeTexture9_AddDirtyBox( struct NineVolumeTexture9 *This,
3231 const D3DBOX *pDirtyBox )
3232 {
3233 HRESULT r;
3234 simple_mtx_lock(&d3dlock_global);
3235 r = NineVolumeTexture9_AddDirtyBox(This, pDirtyBox);
3236 simple_mtx_unlock(&d3dlock_global);
3237 return r;
3238 }
3239
3240 IDirect3DVolumeTexture9Vtbl LockVolumeTexture9_vtable = {
3241 (void *)NineUnknown_QueryInterface,
3242 (void *)NineUnknown_AddRef,
3243 (void *)NineUnknown_ReleaseWithDtorLock,
3244 (void *)NineUnknown_GetDevice, /* actually part of Resource9 iface */
3245 (void *)LockUnknown_SetPrivateData,
3246 (void *)LockUnknown_GetPrivateData,
3247 (void *)LockUnknown_FreePrivateData,
3248 (void *)LockResource9_SetPriority,
3249 (void *)LockResource9_GetPriority,
3250 (void *)LockBaseTexture9_PreLoad,
3251 (void *)NineResource9_GetType, /* immutable */
3252 (void *)LockBaseTexture9_SetLOD,
3253 (void *)LockBaseTexture9_GetLOD,
3254 (void *)LockBaseTexture9_GetLevelCount,
3255 (void *)LockBaseTexture9_SetAutoGenFilterType,
3256 (void *)LockBaseTexture9_GetAutoGenFilterType,
3257 (void *)LockBaseTexture9_GenerateMipSubLevels,
3258 (void *)NineVolumeTexture9_GetLevelDesc, /* immutable */
3259 (void *)NineVolumeTexture9_GetVolumeLevel, /* AddRef */
3260 (void *)LockVolumeTexture9_LockBox,
3261 (void *)LockVolumeTexture9_UnlockBox,
3262 (void *)LockVolumeTexture9_AddDirtyBox
3263 };
3264
3265 ID3DAdapter9Vtbl LockAdapter9_vtable = { /* not used */
3266 (void *)NULL,
3267 (void *)NULL,
3268 (void *)NULL,
3269 (void *)NULL,
3270 (void *)NULL,
3271 (void *)NULL,
3272 (void *)NULL,
3273 (void *)NULL,
3274 (void *)NULL,
3275 (void *)NULL,
3276 (void *)NULL,
3277 (void *)NULL
3278 };
3279