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