Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

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