Changeset 23571 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9
- Timestamp:
- Oct 6, 2009 6:07:06 AM (15 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/cubetexture.c
r21731 r23571 59 59 TRACE("(%p) : AddRef from %d\n", This, ref - 1); 60 60 61 if (ref == 1) 62 { 63 IDirect3DDevice9Ex_AddRef(This->parentDevice); 64 wined3d_mutex_lock(); 65 IWineD3DCubeTexture_AddRef(This->wineD3DCubeTexture); 66 wined3d_mutex_unlock(); 67 } 68 61 69 return ref; 62 70 } … … 71 79 TRACE("Releasing child %p\n", This->wineD3DCubeTexture); 72 80 73 EnterCriticalSection(&d3d9_cs);74 IWineD3DCubeTexture_Destroy(This->wineD3DCubeTexture, D3D9CB_DestroySurface);75 81 IDirect3DDevice9Ex_Release(This->parentDevice); 76 LeaveCriticalSection(&d3d9_cs);77 78 HeapFree(GetProcessHeap(), 0, This);82 wined3d_mutex_lock(); 83 IWineD3DCubeTexture_Release(This->wineD3DCubeTexture); 84 wined3d_mutex_unlock(); 79 85 } 80 86 return ref; … … 88 94 TRACE("(%p) Relay\n" , This); 89 95 90 EnterCriticalSection(&d3d9_cs);96 wined3d_mutex_lock(); 91 97 hr = IWineD3DCubeTexture_GetDevice(This->wineD3DCubeTexture, &wined3d_device); 92 98 if (SUCCEEDED(hr)) … … 95 101 IWineD3DDevice_Release(wined3d_device); 96 102 } 97 LeaveCriticalSection(&d3d9_cs); 103 wined3d_mutex_unlock(); 104 98 105 return hr; 99 106 } … … 104 111 TRACE("(%p) Relay\n", This); 105 112 106 EnterCriticalSection(&d3d9_cs);113 wined3d_mutex_lock(); 107 114 hr = IWineD3DCubeTexture_SetPrivateData(This->wineD3DCubeTexture,refguid,pData,SizeOfData,Flags); 108 LeaveCriticalSection(&d3d9_cs); 115 wined3d_mutex_unlock(); 116 109 117 return hr; 110 118 } … … 115 123 TRACE("(%p) Relay\n", This); 116 124 117 EnterCriticalSection(&d3d9_cs);125 wined3d_mutex_lock(); 118 126 hr = IWineD3DCubeTexture_GetPrivateData(This->wineD3DCubeTexture,refguid,pData,pSizeOfData); 119 LeaveCriticalSection(&d3d9_cs); 127 wined3d_mutex_unlock(); 128 120 129 return hr; 121 130 } … … 126 135 TRACE("(%p) Relay\n", This); 127 136 128 EnterCriticalSection(&d3d9_cs);137 wined3d_mutex_lock(); 129 138 hr = IWineD3DCubeTexture_FreePrivateData(This->wineD3DCubeTexture,refguid); 130 LeaveCriticalSection(&d3d9_cs); 139 wined3d_mutex_unlock(); 140 131 141 return hr; 132 142 } … … 137 147 TRACE("(%p) Relay\n", This); 138 148 139 EnterCriticalSection(&d3d9_cs);149 wined3d_mutex_lock(); 140 150 ret = IWineD3DCubeTexture_SetPriority(This->wineD3DCubeTexture, PriorityNew); 141 LeaveCriticalSection(&d3d9_cs); 151 wined3d_mutex_unlock(); 152 142 153 return ret; 143 154 } … … 148 159 TRACE("(%p) Relay\n", This); 149 160 150 EnterCriticalSection(&d3d9_cs);161 wined3d_mutex_lock(); 151 162 ret = IWineD3DCubeTexture_GetPriority(This->wineD3DCubeTexture); 152 LeaveCriticalSection(&d3d9_cs); 163 wined3d_mutex_unlock(); 164 153 165 return ret; 154 166 } … … 158 170 TRACE("(%p) Relay\n", This); 159 171 160 EnterCriticalSection(&d3d9_cs);172 wined3d_mutex_lock(); 161 173 IWineD3DCubeTexture_PreLoad(This->wineD3DCubeTexture); 162 LeaveCriticalSection(&d3d9_cs);174 wined3d_mutex_unlock(); 163 175 } 164 176 … … 168 180 TRACE("(%p) Relay\n", This); 169 181 170 EnterCriticalSection(&d3d9_cs);182 wined3d_mutex_lock(); 171 183 ret = IWineD3DCubeTexture_GetType(This->wineD3DCubeTexture); 172 LeaveCriticalSection(&d3d9_cs); 184 wined3d_mutex_unlock(); 185 173 186 return ret; 174 187 } … … 180 193 TRACE("(%p) Relay\n", This); 181 194 182 EnterCriticalSection(&d3d9_cs);195 wined3d_mutex_lock(); 183 196 ret = IWineD3DCubeTexture_SetLOD(This->wineD3DCubeTexture, LODNew); 184 LeaveCriticalSection(&d3d9_cs); 197 wined3d_mutex_unlock(); 198 185 199 return ret; 186 200 } … … 191 205 TRACE("(%p) Relay\n", This); 192 206 193 EnterCriticalSection(&d3d9_cs);207 wined3d_mutex_lock(); 194 208 ret = IWineD3DCubeTexture_GetLOD(This->wineD3DCubeTexture); 195 LeaveCriticalSection(&d3d9_cs); 209 wined3d_mutex_unlock(); 210 196 211 return ret; 197 212 } … … 202 217 TRACE("(%p) Relay\n", This); 203 218 204 EnterCriticalSection(&d3d9_cs);219 wined3d_mutex_lock(); 205 220 ret = IWineD3DCubeTexture_GetLevelCount(This->wineD3DCubeTexture); 206 LeaveCriticalSection(&d3d9_cs); 221 wined3d_mutex_unlock(); 222 207 223 return ret; 208 224 } … … 213 229 TRACE("(%p) Relay\n", This); 214 230 215 EnterCriticalSection(&d3d9_cs);231 wined3d_mutex_lock(); 216 232 hr = IWineD3DCubeTexture_SetAutoGenFilterType(This->wineD3DCubeTexture, (WINED3DTEXTUREFILTERTYPE) FilterType); 217 LeaveCriticalSection(&d3d9_cs); 233 wined3d_mutex_unlock(); 234 218 235 return hr; 219 236 } … … 224 241 TRACE("(%p) Relay\n", This); 225 242 226 EnterCriticalSection(&d3d9_cs);243 wined3d_mutex_lock(); 227 244 ret = (D3DTEXTUREFILTERTYPE) IWineD3DCubeTexture_GetAutoGenFilterType(This->wineD3DCubeTexture); 228 LeaveCriticalSection(&d3d9_cs); 245 wined3d_mutex_unlock(); 246 229 247 return ret; 230 248 } … … 234 252 TRACE("(%p) Relay\n", This); 235 253 236 EnterCriticalSection(&d3d9_cs);254 wined3d_mutex_lock(); 237 255 IWineD3DCubeTexture_GenerateMipSubLevels(This->wineD3DCubeTexture); 238 LeaveCriticalSection(&d3d9_cs);256 wined3d_mutex_unlock(); 239 257 } 240 258 … … 247 265 TRACE("(%p) Relay\n", This); 248 266 249 EnterCriticalSection(&d3d9_cs);267 wined3d_mutex_lock(); 250 268 hr = IWineD3DCubeTexture_GetLevelDesc(This->wineD3DCubeTexture, Level, &wined3ddesc); 251 LeaveCriticalSection(&d3d9_cs);269 wined3d_mutex_unlock(); 252 270 253 271 if (SUCCEEDED(hr)) … … 273 291 TRACE("(%p) Relay\n", This); 274 292 275 EnterCriticalSection(&d3d9_cs);293 wined3d_mutex_lock(); 276 294 hrc = IWineD3DCubeTexture_GetCubeMapSurface(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES) FaceType, Level, &mySurface); 277 295 if (hrc == D3D_OK && NULL != ppCubeMapSurface) { … … 279 297 IWineD3DCubeTexture_Release(mySurface); 280 298 } 281 LeaveCriticalSection(&d3d9_cs); 299 wined3d_mutex_unlock(); 300 282 301 return hrc; 283 302 } … … 288 307 TRACE("(%p) Relay\n", This); 289 308 290 EnterCriticalSection(&d3d9_cs);309 wined3d_mutex_lock(); 291 310 hr = IWineD3DCubeTexture_LockRect(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES) FaceType, Level, (WINED3DLOCKED_RECT *) pLockedRect, pRect, Flags); 292 LeaveCriticalSection(&d3d9_cs); 311 wined3d_mutex_unlock(); 312 293 313 return hr; 294 314 } … … 299 319 TRACE("(%p) Relay\n", This); 300 320 301 EnterCriticalSection(&d3d9_cs);321 wined3d_mutex_lock(); 302 322 hr = IWineD3DCubeTexture_UnlockRect(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES) FaceType, Level); 303 LeaveCriticalSection(&d3d9_cs); 323 wined3d_mutex_unlock(); 324 304 325 return hr; 305 326 } … … 310 331 TRACE("(%p) Relay\n", This); 311 332 312 EnterCriticalSection(&d3d9_cs);333 wined3d_mutex_lock(); 313 334 hr = IWineD3DCubeTexture_AddDirtyRect(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES) FaceType, pDirtyRect); 314 LeaveCriticalSection(&d3d9_cs); 335 wined3d_mutex_unlock(); 336 315 337 return hr; 316 338 } … … 346 368 }; 347 369 348 349 350 351 /* IDirect3DDevice9 IDirect3DCubeTexture9 Methods follow: */ 352 HRESULT WINAPI IDirect3DDevice9Impl_CreateCubeTexture(LPDIRECT3DDEVICE9EX iface, 353 UINT EdgeLength, UINT Levels, DWORD Usage, 354 D3DFORMAT Format, D3DPOOL Pool, 355 IDirect3DCubeTexture9** ppCubeTexture, HANDLE* pSharedHandle) { 356 357 IDirect3DCubeTexture9Impl *object; 358 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 359 HRESULT hr = D3D_OK; 360 361 TRACE("(%p) : ELen(%d) Lvl(%d) Usage(%d) fmt(%u), Pool(%d) Shared(%p)\n", This, EdgeLength, Levels, Usage, Format, Pool, pSharedHandle); 362 363 /* Allocate the storage for the device */ 364 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); 365 366 if (NULL == object) { 367 ERR("(%p) allocation of CubeTexture failed\n", This); 368 return D3DERR_OUTOFVIDEOMEMORY; 369 } 370 object->lpVtbl = &Direct3DCubeTexture9_Vtbl; 371 object->ref = 1; 372 EnterCriticalSection(&d3d9_cs); 373 hr = IWineD3DDevice_CreateCubeTexture(This->WineD3DDevice, EdgeLength, Levels, Usage, 374 wined3dformat_from_d3dformat(Format), Pool, &object->wineD3DCubeTexture, (IUnknown *)object); 375 LeaveCriticalSection(&d3d9_cs); 376 377 if (hr != D3D_OK){ 378 379 /* free up object */ 380 WARN("(%p) call to IWineD3DDevice_CreateCubeTexture failed\n", This); 381 HeapFree(GetProcessHeap(), 0, object); 382 } else { 383 IDirect3DDevice9Ex_AddRef(iface); 384 object->parentDevice = iface; 385 *ppCubeTexture = (LPDIRECT3DCUBETEXTURE9) object; 386 TRACE("(%p) : Created cube texture %p\n", This, object); 387 } 388 389 TRACE("(%p) returning %p\n",This, *ppCubeTexture); 390 return hr; 391 } 370 static void STDMETHODCALLTYPE cubetexture_wined3d_object_destroyed(void *parent) 371 { 372 HeapFree(GetProcessHeap(), 0, parent); 373 } 374 375 static const struct wined3d_parent_ops d3d9_cubetexture_wined3d_parent_ops = 376 { 377 cubetexture_wined3d_object_destroyed, 378 }; 379 380 HRESULT cubetexture_init(IDirect3DCubeTexture9Impl *texture, IDirect3DDevice9Impl *device, 381 UINT edge_length, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool) 382 { 383 HRESULT hr; 384 385 texture->lpVtbl = &Direct3DCubeTexture9_Vtbl; 386 texture->ref = 1; 387 388 wined3d_mutex_lock(); 389 hr = IWineD3DDevice_CreateCubeTexture(device->WineD3DDevice, edge_length, levels, usage, 390 wined3dformat_from_d3dformat(format), pool, &texture->wineD3DCubeTexture, 391 (IUnknown *)texture, &d3d9_cubetexture_wined3d_parent_ops); 392 wined3d_mutex_unlock(); 393 if (FAILED(hr)) 394 { 395 WARN("Failed to create wined3d cube texture, hr %#x.\n", hr); 396 return hr; 397 } 398 399 texture->parentDevice = (IDirect3DDevice9Ex *)device; 400 IDirect3DDevice9Ex_AddRef(texture->parentDevice); 401 402 return D3D_OK; 403 } -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/d3d9_main.c
r16477 r23571 35 35 #include "d3d9_private.h" 36 36 37 static CRITICAL_SECTION_DEBUG d3d9_cs_debug =38 {39 0, 0, &d3d9_cs,40 { &d3d9_cs_debug.ProcessLocksList,41 &d3d9_cs_debug.ProcessLocksList },42 0, 0, { (DWORD_PTR)(__FILE__ ": d3d9_cs") }43 };44 CRITICAL_SECTION d3d9_cs = { &d3d9_cs_debug, -1, 0, 0, 0, 0 };45 46 37 WINE_DEFAULT_DEBUG_CHANNEL(d3d9); 47 38 … … 57 48 object->lpVtbl = &Direct3D9_Vtbl; 58 49 object->ref = 1; 59 EnterCriticalSection(&d3d9_cs); 50 51 wined3d_mutex_lock(); 60 52 object->WineD3D = WineDirect3DCreate(9, (IUnknown *)object); 61 LeaveCriticalSection(&d3d9_cs);53 wined3d_mutex_unlock(); 62 54 63 55 TRACE("SDKVersion = %x, Created Direct3D object @ %p, WineObj @ %p\n", SDKVersion, object, object->WineD3D); -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/d3d9_private.h
r19678 r23571 4 4 * Copyright 2002-2003 Jason Edmeades 5 5 * Copyright 2002-2003 Raphael Junqueira 6 * Copyright 2005 Oliver Stieber 6 * Copyright 2005 Oliver Stieber 7 7 * 8 8 * This library is free software; you can redistribute it and/or … … 51 51 Internal use 52 52 =========================================================================== */ 53 extern HRESULT vdecl_convert_fvf( 54 DWORD FVF, 55 D3DVERTEXELEMENT9** ppVertexElements); 56 extern CRITICAL_SECTION d3d9_cs; 57 D3DFORMAT d3dformat_from_wined3dformat(WINED3DFORMAT format); 58 WINED3DFORMAT wined3dformat_from_d3dformat(D3DFORMAT format); 53 extern HRESULT vdecl_convert_fvf(DWORD FVF, D3DVERTEXELEMENT9 **ppVertexElements) DECLSPEC_HIDDEN; 54 D3DFORMAT d3dformat_from_wined3dformat(WINED3DFORMAT format) DECLSPEC_HIDDEN; 55 WINED3DFORMAT wined3dformat_from_d3dformat(D3DFORMAT format) DECLSPEC_HIDDEN; 59 56 60 57 /* =========================================================================== … … 151 148 * Predeclare the interface implementation structures 152 149 */ 153 extern const IDirect3D9ExVtbl Direct3D9_Vtbl ;150 extern const IDirect3D9ExVtbl Direct3D9_Vtbl DECLSPEC_HIDDEN; 154 151 155 152 /***************************************************************************** … … 169 166 } IDirect3D9Impl; 170 167 171 void filter_caps(D3DCAPS9* pCaps) ;168 void filter_caps(D3DCAPS9* pCaps) DECLSPEC_HIDDEN; 172 169 173 170 /* ---------------- */ … … 178 175 * Predeclare the interface implementation structures 179 176 */ 180 extern const IDirect3DDevice9ExVtbl Direct3DDevice9_Vtbl ;181 extern const IWineD3DDeviceParentVtbl d3d9_wined3d_device_parent_vtbl ;177 extern const IDirect3DDevice9ExVtbl Direct3DDevice9_Vtbl DECLSPEC_HIDDEN; 178 extern const IWineD3DDeviceParentVtbl d3d9_wined3d_device_parent_vtbl DECLSPEC_HIDDEN; 182 179 183 180 /***************************************************************************** … … 205 202 206 203 /* IDirect3DDevice9: */ 207 extern HRESULT WINAPI IDirect3DDevice9Impl_CreateAdditionalSwapChain(LPDIRECT3DDEVICE9EX iface, D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DSwapChain9** pSwapChain); 208 extern HRESULT WINAPI IDirect3DDevice9Impl_GetSwapChain(LPDIRECT3DDEVICE9EX iface, UINT iSwapChain, IDirect3DSwapChain9** pSwapChain); 209 extern UINT WINAPI IDirect3DDevice9Impl_GetNumberOfSwapChains(LPDIRECT3DDEVICE9EX iface); 210 extern HRESULT WINAPI IDirect3DDevice9Impl_CreateTexture(LPDIRECT3DDEVICE9EX iface, UINT Width, UINT Height, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DTexture9** ppTexture, HANDLE* pSharedHandle); 211 extern HRESULT WINAPI IDirect3DDevice9Impl_CreateVolumeTexture(LPDIRECT3DDEVICE9EX iface, UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DVolumeTexture9** ppVolumeTexture, HANDLE* pSharedHandle); 212 extern HRESULT WINAPI IDirect3DDevice9Impl_CreateCubeTexture(LPDIRECT3DDEVICE9EX iface, UINT EdgeLength, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DCubeTexture9** ppCubeTexture, HANDLE* pSharedHandle); 213 extern HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexBuffer(LPDIRECT3DDEVICE9EX iface, UINT Length, DWORD Usage, DWORD FVF, D3DPOOL Pool, IDirect3DVertexBuffer9** ppVertexBuffer, HANDLE* pSharedHandle); 214 extern HRESULT WINAPI IDirect3DDevice9Impl_CreateIndexBuffer(LPDIRECT3DDEVICE9EX iface, UINT Length, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DIndexBuffer9** ppIndexBuffer, HANDLE* pSharedHandle); 215 extern HRESULT WINAPI IDirect3DDevice9Impl_CreateStateBlock(LPDIRECT3DDEVICE9EX iface, D3DSTATEBLOCKTYPE Type, IDirect3DStateBlock9** ppSB); 216 extern HRESULT WINAPI IDirect3DDevice9Impl_BeginStateBlock(LPDIRECT3DDEVICE9EX iface); 217 extern HRESULT WINAPI IDirect3DDevice9Impl_EndStateBlock(LPDIRECT3DDEVICE9EX iface, IDirect3DStateBlock9** ppSB); 218 extern HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexDeclaration(LPDIRECT3DDEVICE9EX iface, CONST D3DVERTEXELEMENT9* pVertexElements, IDirect3DVertexDeclaration9** ppDecl); 219 extern HRESULT WINAPI IDirect3DDevice9Impl_SetVertexDeclaration(LPDIRECT3DDEVICE9EX iface, IDirect3DVertexDeclaration9* pDecl); 220 extern HRESULT WINAPI IDirect3DDevice9Impl_GetVertexDeclaration(LPDIRECT3DDEVICE9EX iface, IDirect3DVertexDeclaration9** ppDecl); 221 extern HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexShader(LPDIRECT3DDEVICE9EX iface, CONST DWORD* pFunction, IDirect3DVertexShader9** ppShader); 222 extern HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShader(LPDIRECT3DDEVICE9EX iface, IDirect3DVertexShader9* pShader); 223 extern HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShader(LPDIRECT3DDEVICE9EX iface, IDirect3DVertexShader9** ppShader); 224 extern HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantF(LPDIRECT3DDEVICE9EX iface, UINT StartRegister, CONST float* pConstantData, UINT Vector4fCount); 225 extern HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantF(LPDIRECT3DDEVICE9EX iface, UINT StartRegister, float* pConstantData, UINT Vector4fCount); 226 extern HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantI(LPDIRECT3DDEVICE9EX iface, UINT StartRegister, CONST int* pConstantData, UINT Vector4iCount); 227 extern HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantI(LPDIRECT3DDEVICE9EX iface, UINT StartRegister, int* pConstantData, UINT Vector4iCount); 228 extern HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantB(LPDIRECT3DDEVICE9EX iface, UINT StartRegister, CONST BOOL* pConstantData, UINT BoolCount); 229 extern HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantB(LPDIRECT3DDEVICE9EX iface, UINT StartRegister, BOOL* pConstantData, UINT BoolCount); 230 extern HRESULT WINAPI IDirect3DDevice9Impl_CreatePixelShader(LPDIRECT3DDEVICE9EX iface, CONST DWORD* pFunction, IDirect3DPixelShader9** ppShader); 231 extern HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShader(LPDIRECT3DDEVICE9EX iface, IDirect3DPixelShader9* pShader); 232 extern HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(LPDIRECT3DDEVICE9EX iface, IDirect3DPixelShader9** ppShader); 233 extern HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantF(LPDIRECT3DDEVICE9EX iface, UINT StartRegister, CONST float* pConstantData, UINT Vector4fCount); 234 extern HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantF(LPDIRECT3DDEVICE9EX iface, UINT StartRegister, float* pConstantData, UINT Vector4fCount); 235 extern HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantI(LPDIRECT3DDEVICE9EX iface, UINT StartRegister, CONST int* pConstantData, UINT Vector4iCount); 236 extern HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantI(LPDIRECT3DDEVICE9EX iface, UINT StartRegister, int* pConstantData, UINT Vector4iCount); 237 extern HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantB(LPDIRECT3DDEVICE9EX iface, UINT StartRegister, CONST BOOL* pConstantData, UINT BoolCount); 238 extern HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantB(LPDIRECT3DDEVICE9EX iface, UINT StartRegister, BOOL* pConstantData, UINT BoolCount); 239 extern HRESULT WINAPI IDirect3DDevice9Impl_CreateQuery(LPDIRECT3DDEVICE9EX iface, D3DQUERYTYPE Type, IDirect3DQuery9** ppQuery); 204 extern HRESULT WINAPI IDirect3DDevice9Impl_CreateAdditionalSwapChain(IDirect3DDevice9Ex *iface, 205 D3DPRESENT_PARAMETERS *pPresentationParameters, IDirect3DSwapChain9 **pSwapChain) DECLSPEC_HIDDEN; 206 extern HRESULT WINAPI IDirect3DDevice9Impl_GetSwapChain(IDirect3DDevice9Ex *iface, 207 UINT iSwapChain, IDirect3DSwapChain9 **pSwapChain) DECLSPEC_HIDDEN; 208 extern UINT WINAPI IDirect3DDevice9Impl_GetNumberOfSwapChains(IDirect3DDevice9Ex *iface) DECLSPEC_HIDDEN; 209 extern HRESULT WINAPI IDirect3DDevice9Impl_CreateStateBlock(IDirect3DDevice9Ex *iface, 210 D3DSTATEBLOCKTYPE Type, IDirect3DStateBlock9 **ppSB) DECLSPEC_HIDDEN; 211 extern HRESULT WINAPI IDirect3DDevice9Impl_BeginStateBlock(IDirect3DDevice9Ex *iface) DECLSPEC_HIDDEN; 212 extern HRESULT WINAPI IDirect3DDevice9Impl_EndStateBlock(IDirect3DDevice9Ex *iface, 213 IDirect3DStateBlock9 **ppSB) DECLSPEC_HIDDEN; 214 extern HRESULT WINAPI IDirect3DDevice9Impl_SetVertexDeclaration(IDirect3DDevice9Ex *iface, 215 IDirect3DVertexDeclaration9 *pDecl) DECLSPEC_HIDDEN; 216 extern HRESULT WINAPI IDirect3DDevice9Impl_GetVertexDeclaration(IDirect3DDevice9Ex *iface, 217 IDirect3DVertexDeclaration9 **ppDecl) DECLSPEC_HIDDEN; 218 extern HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShader(IDirect3DDevice9Ex *iface, 219 IDirect3DVertexShader9 *pShader) DECLSPEC_HIDDEN; 220 extern HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShader(IDirect3DDevice9Ex *iface, 221 IDirect3DVertexShader9 **ppShader) DECLSPEC_HIDDEN; 222 extern HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantF(IDirect3DDevice9Ex *iface, 223 UINT StartRegister, const float *pConstantData, UINT Vector4fCount) DECLSPEC_HIDDEN; 224 extern HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantF(IDirect3DDevice9Ex *iface, 225 UINT StartRegister, float *pConstantData, UINT Vector4fCount) DECLSPEC_HIDDEN; 226 extern HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantI(IDirect3DDevice9Ex *iface, 227 UINT StartRegister, const int *pConstantData, UINT Vector4iCount) DECLSPEC_HIDDEN; 228 extern HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantI(IDirect3DDevice9Ex *iface, 229 UINT StartRegister, int *pConstantData, UINT Vector4iCount) DECLSPEC_HIDDEN; 230 extern HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantB(IDirect3DDevice9Ex *iface, 231 UINT StartRegister, const BOOL *pConstantData, UINT BoolCount) DECLSPEC_HIDDEN; 232 extern HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantB(IDirect3DDevice9Ex *iface, 233 UINT StartRegister, BOOL *pConstantData, UINT BoolCount) DECLSPEC_HIDDEN; 234 extern HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShader(IDirect3DDevice9Ex *iface, 235 IDirect3DPixelShader9 *pShader) DECLSPEC_HIDDEN; 236 extern HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(IDirect3DDevice9Ex *iface, 237 IDirect3DPixelShader9 **ppShader) DECLSPEC_HIDDEN; 238 extern HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantF(IDirect3DDevice9Ex *iface, 239 UINT StartRegister, const float *pConstantData, UINT Vector4fCount) DECLSPEC_HIDDEN; 240 extern HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantF(IDirect3DDevice9Ex *iface, 241 UINT StartRegister, float *pConstantData, UINT Vector4fCount) DECLSPEC_HIDDEN; 242 extern HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantI(IDirect3DDevice9Ex *iface, 243 UINT StartRegister, const int *pConstantData, UINT Vector4iCount) DECLSPEC_HIDDEN; 244 extern HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantI(IDirect3DDevice9Ex *iface, 245 UINT StartRegister, int *pConstantData, UINT Vector4iCount) DECLSPEC_HIDDEN; 246 extern HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantB(IDirect3DDevice9Ex *iface, 247 UINT StartRegister, const BOOL *pConstantData, UINT BoolCount) DECLSPEC_HIDDEN; 248 extern HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantB(IDirect3DDevice9Ex *iface, 249 UINT StartRegister, BOOL *pConstantData, UINT BoolCount) DECLSPEC_HIDDEN; 250 extern HRESULT WINAPI IDirect3DDevice9Impl_CreateQuery(IDirect3DDevice9Ex *iface, 251 D3DQUERYTYPE Type, IDirect3DQuery9 **ppQuery) DECLSPEC_HIDDEN; 240 252 241 253 … … 247 259 * IDirect3DVolume9 implementation structure 248 260 */ 249 extern const IDirect3DVolume9Vtbl Direct3DVolume9_Vtbl;250 261 typedef struct IDirect3DVolume9Impl 251 262 { … … 264 275 } IDirect3DVolume9Impl; 265 276 277 HRESULT volume_init(IDirect3DVolume9Impl *volume, IDirect3DDevice9Impl *device, UINT width, UINT height, 278 UINT depth, DWORD usage, WINED3DFORMAT format, WINED3DPOOL pool) DECLSPEC_HIDDEN; 279 266 280 /* ------------------- */ 267 281 /* IDirect3DSwapChain9 */ … … 292 306 293 307 /***************************************************************************** 294 * Predeclare the interface implementation structures295 */296 extern const IDirect3DSurface9Vtbl Direct3DSurface9_Vtbl;297 298 /*****************************************************************************299 308 * IDirect3DSurface9 implementation structure 300 309 */ … … 317 326 IUnknown *forwardReference; 318 327 319 /* Flags an implicit surface */ 320 BOOL isImplicit; 328 BOOL getdc_supported; 321 329 } IDirect3DSurface9Impl; 330 331 HRESULT surface_init(IDirect3DSurface9Impl *surface, IDirect3DDevice9Impl *device, 332 UINT width, UINT height, D3DFORMAT format, BOOL lockable, BOOL discard, UINT level, 333 DWORD usage, D3DPOOL pool, D3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality) DECLSPEC_HIDDEN; 322 334 323 335 /* ---------------------- */ … … 343 355 } IDirect3DVertexBuffer9Impl; 344 356 357 HRESULT vertexbuffer_init(IDirect3DVertexBuffer9Impl *buffer, IDirect3DDevice9Impl *device, 358 UINT size, UINT usage, DWORD fvf, D3DPOOL pool) DECLSPEC_HIDDEN; 359 345 360 /* --------------------- */ 346 361 /* IDirect3DIndexBuffer9 */ … … 364 379 } IDirect3DIndexBuffer9Impl; 365 380 381 HRESULT indexbuffer_init(IDirect3DIndexBuffer9Impl *buffer, IDirect3DDevice9Impl *device, 382 UINT size, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN; 383 366 384 /* --------------------- */ 367 385 /* IDirect3DBaseTexture9 */ … … 379 397 /* IDirect3DResource9 fields */ 380 398 IWineD3DBaseTexture *wineD3DBaseTexture; 381 382 399 } IDirect3DBaseTexture9Impl; 383 400 … … 402 419 } IDirect3DCubeTexture9Impl; 403 420 421 HRESULT cubetexture_init(IDirect3DCubeTexture9Impl *texture, IDirect3DDevice9Impl *device, 422 UINT edge_length, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN; 404 423 405 424 /* ----------------- */ … … 423 442 } IDirect3DTexture9Impl; 424 443 444 HRESULT texture_init(IDirect3DTexture9Impl *texture, IDirect3DDevice9Impl *device, 445 UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN; 446 425 447 /* ----------------------- */ 426 448 /* IDirect3DVolumeTexture9 */ … … 442 464 LPDIRECT3DDEVICE9EX parentDevice; 443 465 } IDirect3DVolumeTexture9Impl; 466 467 HRESULT volumetexture_init(IDirect3DVolumeTexture9Impl *texture, IDirect3DDevice9Impl *device, 468 UINT width, UINT height, UINT depth, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN; 444 469 445 470 /* ----------------------- */ … … 486 511 } IDirect3DVertexDeclaration9Impl; 487 512 488 void IDirect3DVertexDeclaration9Impl_Destroy(LPDIRECT3DVERTEXDECLARATION9 iface); 513 void IDirect3DVertexDeclaration9Impl_Destroy(LPDIRECT3DVERTEXDECLARATION9 iface) DECLSPEC_HIDDEN; 514 HRESULT vertexdeclaration_init(IDirect3DVertexDeclaration9Impl *declaration, 515 IDirect3DDevice9Impl *device, const D3DVERTEXELEMENT9 *elements) DECLSPEC_HIDDEN; 489 516 490 517 /* ---------------------- */ … … 507 534 } IDirect3DVertexShader9Impl; 508 535 536 HRESULT vertexshader_init(IDirect3DVertexShader9Impl *shader, 537 IDirect3DDevice9Impl *device, const DWORD *byte_code) DECLSPEC_HIDDEN; 538 509 539 #define D3D9_MAX_VERTEX_SHADER_CONSTANTF 256 540 #define D3D9_MAX_SIMULTANEOUS_RENDERTARGETS 4 510 541 511 542 /* --------------------- */ … … 528 559 } IDirect3DPixelShader9Impl; 529 560 561 HRESULT pixelshader_init(IDirect3DPixelShader9Impl *shader, 562 IDirect3DDevice9Impl *device, const DWORD *byte_code) DECLSPEC_HIDDEN; 563 530 564 /* --------------- */ 531 565 /* IDirect3DQuery9 */ … … 549 583 550 584 /* Callbacks */ 551 extern ULONG WINAPI D3D9CB_DestroySwapChain (IWineD3DSwapChain *pSwapChain); 552 extern ULONG WINAPI D3D9CB_DestroyDepthStencilSurface (IWineD3DSurface *pSurface); 553 extern ULONG WINAPI D3D9CB_DestroyRenderTarget (IWineD3DSurface *pSurface); 554 extern ULONG WINAPI D3D9CB_DestroySurface(IWineD3DSurface *pSurface); 555 extern ULONG WINAPI D3D9CB_DestroyVolume(IWineD3DVolume *pVolume); 585 extern ULONG WINAPI D3D9CB_DestroySwapChain (IWineD3DSwapChain *pSwapChain) DECLSPEC_HIDDEN; 556 586 557 587 #endif /* __WINE_D3D9_PRIVATE_H */ -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/device.c
r22496 r23571 45 45 { 46 46 case WINED3DFMT_UNKNOWN: return D3DFMT_UNKNOWN; 47 case WINED3DFMT_ R8G8B8: return D3DFMT_R8G8B8;48 case WINED3DFMT_ A8R8G8B8: return D3DFMT_A8R8G8B8;49 case WINED3DFMT_ X8R8G8B8: return D3DFMT_X8R8G8B8;50 case WINED3DFMT_ R5G6B5: return D3DFMT_R5G6B5;51 case WINED3DFMT_ X1R5G5B5: return D3DFMT_X1R5G5B5;52 case WINED3DFMT_ A1R5G5B5: return D3DFMT_A1R5G5B5;53 case WINED3DFMT_ A4R4G4B4: return D3DFMT_A4R4G4B4;54 case WINED3DFMT_ R3G3B2: return D3DFMT_R3G3B2;47 case WINED3DFMT_B8G8R8_UNORM: return D3DFMT_R8G8B8; 48 case WINED3DFMT_B8G8R8A8_UNORM: return D3DFMT_A8R8G8B8; 49 case WINED3DFMT_B8G8R8X8_UNORM: return D3DFMT_X8R8G8B8; 50 case WINED3DFMT_B5G6R5_UNORM: return D3DFMT_R5G6B5; 51 case WINED3DFMT_B5G5R5X1_UNORM: return D3DFMT_X1R5G5B5; 52 case WINED3DFMT_B5G5R5A1_UNORM: return D3DFMT_A1R5G5B5; 53 case WINED3DFMT_B4G4R4A4_UNORM: return D3DFMT_A4R4G4B4; 54 case WINED3DFMT_B2G3R3_UNORM: return D3DFMT_R3G3B2; 55 55 case WINED3DFMT_A8_UNORM: return D3DFMT_A8; 56 case WINED3DFMT_ A8R3G3B2: return D3DFMT_A8R3G3B2;57 case WINED3DFMT_ X4R4G4B4: return D3DFMT_X4R4G4B4;56 case WINED3DFMT_B2G3R3A8_UNORM: return D3DFMT_A8R3G3B2; 57 case WINED3DFMT_B4G4R4X4_UNORM: return D3DFMT_X4R4G4B4; 58 58 case WINED3DFMT_R10G10B10A2_UNORM: return D3DFMT_A2B10G10R10; 59 59 case WINED3DFMT_R8G8B8A8_UNORM: return D3DFMT_A8B8G8R8; 60 case WINED3DFMT_ X8B8G8R8: return D3DFMT_X8B8G8R8;60 case WINED3DFMT_R8G8B8X8_UNORM: return D3DFMT_X8B8G8R8; 61 61 case WINED3DFMT_R16G16_UNORM: return D3DFMT_G16R16; 62 case WINED3DFMT_ A2R10G10B10: return D3DFMT_A2R10G10B10;62 case WINED3DFMT_B10G10R10A2_UNORM: return D3DFMT_A2R10G10B10; 63 63 case WINED3DFMT_R16G16B16A16_UNORM: return D3DFMT_A16B16G16R16; 64 case WINED3DFMT_ A8P8: return D3DFMT_A8P8;65 case WINED3DFMT_P8 : return D3DFMT_P8;66 case WINED3DFMT_L8 : return D3DFMT_L8;67 case WINED3DFMT_ A8L8: return D3DFMT_A8L8;68 case WINED3DFMT_ A4L4: return D3DFMT_A4L4;64 case WINED3DFMT_P8_UINT_A8_UNORM: return D3DFMT_A8P8; 65 case WINED3DFMT_P8_UINT: return D3DFMT_P8; 66 case WINED3DFMT_L8_UNORM: return D3DFMT_L8; 67 case WINED3DFMT_L8A8_UNORM: return D3DFMT_A8L8; 68 case WINED3DFMT_L4A4_UNORM: return D3DFMT_A4L4; 69 69 case WINED3DFMT_R8G8_SNORM: return D3DFMT_V8U8; 70 case WINED3DFMT_ L6V5U5: return D3DFMT_L6V5U5;71 case WINED3DFMT_ X8L8V8U8: return D3DFMT_X8L8V8U8;70 case WINED3DFMT_R5G5_SNORM_L6_UNORM: return D3DFMT_L6V5U5; 71 case WINED3DFMT_R8G8_SNORM_L8X8_UNORM: return D3DFMT_X8L8V8U8; 72 72 case WINED3DFMT_R8G8B8A8_SNORM: return D3DFMT_Q8W8V8U8; 73 73 case WINED3DFMT_R16G16_SNORM: return D3DFMT_V16U16; 74 case WINED3DFMT_ A2W10V10U10: return D3DFMT_A2W10V10U10;74 case WINED3DFMT_R10G10B10_SNORM_A2_UNORM: return D3DFMT_A2W10V10U10; 75 75 case WINED3DFMT_D16_LOCKABLE: return D3DFMT_D16_LOCKABLE; 76 case WINED3DFMT_D32 : return D3DFMT_D32;77 case WINED3DFMT_ D15S1: return D3DFMT_D15S1;78 case WINED3DFMT_ D24S8: return D3DFMT_D24S8;79 case WINED3DFMT_ D24X8: return D3DFMT_D24X8;80 case WINED3DFMT_ D24X4S4: return D3DFMT_D24X4S4;76 case WINED3DFMT_D32_UNORM: return D3DFMT_D32; 77 case WINED3DFMT_S1_UINT_D15_UNORM: return D3DFMT_D15S1; 78 case WINED3DFMT_S8_UINT_D24_UNORM: return D3DFMT_D24S8; 79 case WINED3DFMT_X8D24_UNORM: return D3DFMT_D24X8; 80 case WINED3DFMT_S4X4_UINT_D24_UNORM: return D3DFMT_D24X4S4; 81 81 case WINED3DFMT_D16_UNORM: return D3DFMT_D16; 82 case WINED3DFMT_L16 : return D3DFMT_L16;83 case WINED3DFMT_D32 F_LOCKABLE: return D3DFMT_D32F_LOCKABLE;84 case WINED3DFMT_ D24FS8: return D3DFMT_D24FS8;82 case WINED3DFMT_L16_UNORM: return D3DFMT_L16; 83 case WINED3DFMT_D32_FLOAT: return D3DFMT_D32F_LOCKABLE; 84 case WINED3DFMT_S8_UINT_D24_FLOAT: return D3DFMT_D24FS8; 85 85 case WINED3DFMT_VERTEXDATA: return D3DFMT_VERTEXDATA; 86 86 case WINED3DFMT_R16_UINT: return D3DFMT_INDEX16; … … 93 93 case WINED3DFMT_R32G32_FLOAT: return D3DFMT_G32R32F; 94 94 case WINED3DFMT_R32G32B32A32_FLOAT: return D3DFMT_A32B32G32R32F; 95 case WINED3DFMT_ CxV8U8: return D3DFMT_CxV8U8;95 case WINED3DFMT_R8G8_SNORM_Cx: return D3DFMT_CxV8U8; 96 96 default: 97 97 FIXME("Unhandled WINED3DFORMAT %#x\n", format); … … 110 110 { 111 111 case D3DFMT_UNKNOWN: return WINED3DFMT_UNKNOWN; 112 case D3DFMT_R8G8B8: return WINED3DFMT_ R8G8B8;113 case D3DFMT_A8R8G8B8: return WINED3DFMT_ A8R8G8B8;114 case D3DFMT_X8R8G8B8: return WINED3DFMT_ X8R8G8B8;115 case D3DFMT_R5G6B5: return WINED3DFMT_ R5G6B5;116 case D3DFMT_X1R5G5B5: return WINED3DFMT_ X1R5G5B5;117 case D3DFMT_A1R5G5B5: return WINED3DFMT_ A1R5G5B5;118 case D3DFMT_A4R4G4B4: return WINED3DFMT_ A4R4G4B4;119 case D3DFMT_R3G3B2: return WINED3DFMT_ R3G3B2;112 case D3DFMT_R8G8B8: return WINED3DFMT_B8G8R8_UNORM; 113 case D3DFMT_A8R8G8B8: return WINED3DFMT_B8G8R8A8_UNORM; 114 case D3DFMT_X8R8G8B8: return WINED3DFMT_B8G8R8X8_UNORM; 115 case D3DFMT_R5G6B5: return WINED3DFMT_B5G6R5_UNORM; 116 case D3DFMT_X1R5G5B5: return WINED3DFMT_B5G5R5X1_UNORM; 117 case D3DFMT_A1R5G5B5: return WINED3DFMT_B5G5R5A1_UNORM; 118 case D3DFMT_A4R4G4B4: return WINED3DFMT_B4G4R4A4_UNORM; 119 case D3DFMT_R3G3B2: return WINED3DFMT_B2G3R3_UNORM; 120 120 case D3DFMT_A8: return WINED3DFMT_A8_UNORM; 121 case D3DFMT_A8R3G3B2: return WINED3DFMT_ A8R3G3B2;122 case D3DFMT_X4R4G4B4: return WINED3DFMT_ X4R4G4B4;121 case D3DFMT_A8R3G3B2: return WINED3DFMT_B2G3R3A8_UNORM; 122 case D3DFMT_X4R4G4B4: return WINED3DFMT_B4G4R4X4_UNORM; 123 123 case D3DFMT_A2B10G10R10: return WINED3DFMT_R10G10B10A2_UNORM; 124 124 case D3DFMT_A8B8G8R8: return WINED3DFMT_R8G8B8A8_UNORM; 125 case D3DFMT_X8B8G8R8: return WINED3DFMT_ X8B8G8R8;125 case D3DFMT_X8B8G8R8: return WINED3DFMT_R8G8B8X8_UNORM; 126 126 case D3DFMT_G16R16: return WINED3DFMT_R16G16_UNORM; 127 case D3DFMT_A2R10G10B10: return WINED3DFMT_ A2R10G10B10;127 case D3DFMT_A2R10G10B10: return WINED3DFMT_B10G10R10A2_UNORM; 128 128 case D3DFMT_A16B16G16R16: return WINED3DFMT_R16G16B16A16_UNORM; 129 case D3DFMT_A8P8: return WINED3DFMT_ A8P8;130 case D3DFMT_P8: return WINED3DFMT_P8 ;131 case D3DFMT_L8: return WINED3DFMT_L8 ;132 case D3DFMT_A8L8: return WINED3DFMT_ A8L8;133 case D3DFMT_A4L4: return WINED3DFMT_ A4L4;129 case D3DFMT_A8P8: return WINED3DFMT_P8_UINT_A8_UNORM; 130 case D3DFMT_P8: return WINED3DFMT_P8_UINT; 131 case D3DFMT_L8: return WINED3DFMT_L8_UNORM; 132 case D3DFMT_A8L8: return WINED3DFMT_L8A8_UNORM; 133 case D3DFMT_A4L4: return WINED3DFMT_L4A4_UNORM; 134 134 case D3DFMT_V8U8: return WINED3DFMT_R8G8_SNORM; 135 case D3DFMT_L6V5U5: return WINED3DFMT_ L6V5U5;136 case D3DFMT_X8L8V8U8: return WINED3DFMT_ X8L8V8U8;135 case D3DFMT_L6V5U5: return WINED3DFMT_R5G5_SNORM_L6_UNORM; 136 case D3DFMT_X8L8V8U8: return WINED3DFMT_R8G8_SNORM_L8X8_UNORM; 137 137 case D3DFMT_Q8W8V8U8: return WINED3DFMT_R8G8B8A8_SNORM; 138 138 case D3DFMT_V16U16: return WINED3DFMT_R16G16_SNORM; 139 case D3DFMT_A2W10V10U10: return WINED3DFMT_ A2W10V10U10;139 case D3DFMT_A2W10V10U10: return WINED3DFMT_R10G10B10_SNORM_A2_UNORM; 140 140 case D3DFMT_D16_LOCKABLE: return WINED3DFMT_D16_LOCKABLE; 141 case D3DFMT_D32: return WINED3DFMT_D32 ;142 case D3DFMT_D15S1: return WINED3DFMT_ D15S1;143 case D3DFMT_D24S8: return WINED3DFMT_ D24S8;144 case D3DFMT_D24X8: return WINED3DFMT_ D24X8;145 case D3DFMT_D24X4S4: return WINED3DFMT_ D24X4S4;141 case D3DFMT_D32: return WINED3DFMT_D32_UNORM; 142 case D3DFMT_D15S1: return WINED3DFMT_S1_UINT_D15_UNORM; 143 case D3DFMT_D24S8: return WINED3DFMT_S8_UINT_D24_UNORM; 144 case D3DFMT_D24X8: return WINED3DFMT_X8D24_UNORM; 145 case D3DFMT_D24X4S4: return WINED3DFMT_S4X4_UINT_D24_UNORM; 146 146 case D3DFMT_D16: return WINED3DFMT_D16_UNORM; 147 case D3DFMT_L16: return WINED3DFMT_L16 ;148 case D3DFMT_D32F_LOCKABLE: return WINED3DFMT_D32 F_LOCKABLE;149 case D3DFMT_D24FS8: return WINED3DFMT_ D24FS8;147 case D3DFMT_L16: return WINED3DFMT_L16_UNORM; 148 case D3DFMT_D32F_LOCKABLE: return WINED3DFMT_D32_FLOAT; 149 case D3DFMT_D24FS8: return WINED3DFMT_S8_UINT_D24_FLOAT; 150 150 case D3DFMT_VERTEXDATA: return WINED3DFMT_VERTEXDATA; 151 151 case D3DFMT_INDEX16: return WINED3DFMT_R16_UINT; … … 158 158 case D3DFMT_G32R32F: return WINED3DFMT_R32G32_FLOAT; 159 159 case D3DFMT_A32B32G32R32F: return WINED3DFMT_R32G32B32A32_FLOAT; 160 case D3DFMT_CxV8U8: return WINED3DFMT_ CxV8U8;160 case D3DFMT_CxV8U8: return WINED3DFMT_R8G8_SNORM_Cx; 161 161 default: 162 162 FIXME("Unhandled D3DFORMAT %#x\n", format); … … 258 258 This->inDestruction = TRUE; 259 259 260 EnterCriticalSection(&d3d9_cs);260 wined3d_mutex_lock(); 261 261 for(i = 0; i < This->numConvertedDecls; i++) { 262 262 /* Unless Wine is buggy or the app has a bug the refcount will be 0, because decls hold a reference to the … … 267 267 HeapFree(GetProcessHeap(), 0, This->convertedDecls); 268 268 269 IWineD3DDevice_Uninit3D(This->WineD3DDevice, D3D9CB_Destroy DepthStencilSurface, D3D9CB_DestroySwapChain);269 IWineD3DDevice_Uninit3D(This->WineD3DDevice, D3D9CB_DestroySwapChain); 270 270 IWineD3DDevice_Release(This->WineD3DDevice); 271 LeaveCriticalSection(&d3d9_cs); 271 wined3d_mutex_unlock(); 272 272 273 HeapFree(GetProcessHeap(), 0, This); 273 274 } … … 281 282 TRACE("(%p)\n", This); 282 283 283 EnterCriticalSection(&d3d9_cs);284 wined3d_mutex_lock(); 284 285 hr = IWineD3DDevice_TestCooperativeLevel(This->WineD3DDevice); 285 LeaveCriticalSection(&d3d9_cs); 286 wined3d_mutex_unlock(); 287 286 288 if(hr == WINED3D_OK && This->notreset) { 287 289 TRACE("D3D9 Device is marked not reset\n"); … … 297 299 TRACE("(%p) Relay\n", This); 298 300 299 EnterCriticalSection(&d3d9_cs);301 wined3d_mutex_lock(); 300 302 hr = IWineD3DDevice_GetAvailableTextureMem(This->WineD3DDevice); 301 LeaveCriticalSection(&d3d9_cs); 303 wined3d_mutex_unlock(); 304 302 305 return hr; 303 306 } … … 308 311 TRACE("(%p) : Relay\n", This); 309 312 310 EnterCriticalSection(&d3d9_cs);313 wined3d_mutex_lock(); 311 314 hr = IWineD3DDevice_EvictManagedResources(This->WineD3DDevice); 312 LeaveCriticalSection(&d3d9_cs); 315 wined3d_mutex_unlock(); 316 313 317 return hr; 314 318 } … … 325 329 } 326 330 327 EnterCriticalSection(&d3d9_cs);331 wined3d_mutex_lock(); 328 332 hr = IWineD3DDevice_GetDirect3D(This->WineD3DDevice, &pWineD3D); 329 333 if (hr == D3D_OK && pWineD3D != NULL) … … 336 340 } 337 341 TRACE("(%p) returning %p\n", This, *ppD3D9); 338 LeaveCriticalSection(&d3d9_cs); 342 wined3d_mutex_unlock(); 343 339 344 return hr; 340 345 } … … 355 360 356 361 memset(pCaps, 0, sizeof(*pCaps)); 357 EnterCriticalSection(&d3d9_cs); 362 363 wined3d_mutex_lock(); 358 364 hrc = IWineD3DDevice_GetDeviceCaps(This->WineD3DDevice, pWineCaps); 359 LeaveCriticalSection(&d3d9_cs); 365 wined3d_mutex_unlock(); 366 360 367 WINECAPSTOD3D9CAPS(pCaps, pWineCaps) 361 368 HeapFree(GetProcessHeap(), 0, pWineCaps); … … 375 382 TRACE("(%p) Relay\n", This); 376 383 377 EnterCriticalSection(&d3d9_cs);384 wined3d_mutex_lock(); 378 385 hr = IWineD3DDevice_GetDisplayMode(This->WineD3DDevice, iSwapChain, (WINED3DDISPLAYMODE *) pMode); 379 LeaveCriticalSection(&d3d9_cs);386 wined3d_mutex_unlock(); 380 387 381 388 if (SUCCEEDED(hr)) pMode->Format = d3dformat_from_wined3dformat(pMode->Format); … … 389 396 TRACE("(%p) Relay\n", This); 390 397 391 EnterCriticalSection(&d3d9_cs);398 wined3d_mutex_lock(); 392 399 hr = IWineD3DDevice_GetCreationParameters(This->WineD3DDevice, (WINED3DDEVICE_CREATION_PARAMETERS *) pParameters); 393 LeaveCriticalSection(&d3d9_cs); 400 wined3d_mutex_unlock(); 401 394 402 return hr; 395 403 } … … 406 414 } 407 415 408 EnterCriticalSection(&d3d9_cs);416 wined3d_mutex_lock(); 409 417 hr = IWineD3DDevice_SetCursorProperties(This->WineD3DDevice, XHotSpot, YHotSpot, pSurface->wineD3DSurface); 410 LeaveCriticalSection(&d3d9_cs); 418 wined3d_mutex_unlock(); 419 411 420 return hr; 412 421 } … … 416 425 TRACE("(%p) Relay\n", This); 417 426 418 EnterCriticalSection(&d3d9_cs);427 wined3d_mutex_lock(); 419 428 IWineD3DDevice_SetCursorPosition(This->WineD3DDevice, XScreenSpace, YScreenSpace, Flags); 420 LeaveCriticalSection(&d3d9_cs);429 wined3d_mutex_unlock(); 421 430 } 422 431 … … 426 435 TRACE("(%p) Relay\n", This); 427 436 428 EnterCriticalSection(&d3d9_cs);437 wined3d_mutex_lock(); 429 438 ret = IWineD3DDevice_ShowCursor(This->WineD3DDevice, bShow); 430 LeaveCriticalSection(&d3d9_cs); 439 wined3d_mutex_unlock(); 440 431 441 return ret; 432 442 } … … 507 517 * below fails, the device is considered "lost", and _Reset and _Release are the only allowed calls 508 518 */ 509 EnterCriticalSection(&d3d9_cs);510 IWineD3DDevice_SetInd ices(This->WineD3DDevice, NULL, WINED3DFMT_UNKNOWN);519 wined3d_mutex_lock(); 520 IWineD3DDevice_SetIndexBuffer(This->WineD3DDevice, NULL, WINED3DFMT_UNKNOWN); 511 521 for(i = 0; i < 16; i++) { 512 522 IWineD3DDevice_SetStreamSource(This->WineD3DDevice, i, NULL, 0, 0); … … 520 530 WARN("The application is holding D3DPOOL_DEFAULT resources, rejecting reset\n"); 521 531 This->notreset = TRUE; 522 LeaveCriticalSection(&d3d9_cs); 532 wined3d_mutex_unlock(); 533 523 534 return WINED3DERR_INVALIDCALL; 524 535 } … … 562 573 } 563 574 564 LeaveCriticalSection(&d3d9_cs);575 wined3d_mutex_unlock(); 565 576 566 577 return hr; … … 573 584 TRACE("(%p) Relay\n", This); 574 585 575 EnterCriticalSection(&d3d9_cs);586 wined3d_mutex_lock(); 576 587 hr = IWineD3DDevice_Present(This->WineD3DDevice, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion); 577 LeaveCriticalSection(&d3d9_cs); 588 wined3d_mutex_unlock(); 589 578 590 return hr; 579 591 } … … 586 598 TRACE("(%p) Relay\n", This); 587 599 588 EnterCriticalSection(&d3d9_cs);600 wined3d_mutex_lock(); 589 601 rc = IWineD3DDevice_GetBackBuffer(This->WineD3DDevice, iSwapChain, BackBuffer, (WINED3DBACKBUFFER_TYPE) Type, &retSurface); 590 602 if (rc == D3D_OK && NULL != retSurface && NULL != ppBackBuffer) { … … 592 604 IWineD3DSurface_Release(retSurface); 593 605 } 594 LeaveCriticalSection(&d3d9_cs); 606 wined3d_mutex_unlock(); 607 595 608 return rc; 596 609 } … … 600 613 TRACE("(%p) Relay\n", This); 601 614 602 EnterCriticalSection(&d3d9_cs);615 wined3d_mutex_lock(); 603 616 hr = IWineD3DDevice_GetRasterStatus(This->WineD3DDevice, iSwapChain, (WINED3DRASTER_STATUS *) pRasterStatus); 604 LeaveCriticalSection(&d3d9_cs); 617 wined3d_mutex_unlock(); 618 605 619 return hr; 606 620 } … … 611 625 TRACE("(%p) Relay\n", This); 612 626 613 EnterCriticalSection(&d3d9_cs);627 wined3d_mutex_lock(); 614 628 hr = IWineD3DDevice_SetDialogBoxMode(This->WineD3DDevice, bEnableDialogs); 615 LeaveCriticalSection(&d3d9_cs); 616 return hr; 617 } 618 619 static void WINAPI IDirect3DDevice9Impl_SetGammaRamp(LPDIRECT3DDEVICE9EX iface, UINT iSwapChain, DWORD Flags, CONST D3DGAMMARAMP* pRamp) { 620 629 wined3d_mutex_unlock(); 630 631 return hr; 632 } 633 634 static void WINAPI IDirect3DDevice9Impl_SetGammaRamp(IDirect3DDevice9Ex *iface, UINT iSwapChain, 635 DWORD Flags, const D3DGAMMARAMP *pRamp) 636 { 621 637 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 622 638 TRACE("(%p) Relay\n", This); 623 639 624 EnterCriticalSection(&d3d9_cs);625 640 /* Note: D3DGAMMARAMP is compatible with WINED3DGAMMARAMP */ 641 wined3d_mutex_lock(); 626 642 IWineD3DDevice_SetGammaRamp(This->WineD3DDevice, iSwapChain, Flags, (CONST WINED3DGAMMARAMP *)pRamp); 627 LeaveCriticalSection(&d3d9_cs);643 wined3d_mutex_unlock(); 628 644 } 629 645 … … 632 648 TRACE("(%p) Relay\n", This); 633 649 634 EnterCriticalSection(&d3d9_cs);635 650 /* Note: D3DGAMMARAMP is compatible with WINED3DGAMMARAMP */ 651 wined3d_mutex_lock(); 636 652 IWineD3DDevice_GetGammaRamp(This->WineD3DDevice, iSwapChain, (WINED3DGAMMARAMP *) pRamp); 637 LeaveCriticalSection(&d3d9_cs); 638 } 639 653 wined3d_mutex_unlock(); 654 } 655 656 static HRESULT WINAPI IDirect3DDevice9Impl_CreateTexture(IDirect3DDevice9Ex *iface, 657 UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format, 658 D3DPOOL pool, IDirect3DTexture9 **texture, HANDLE *shared_handle) 659 { 660 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 661 IDirect3DTexture9Impl *object; 662 HRESULT hr; 663 664 TRACE("iface %p, width %u, height %u, levels %u, usage %#x, format %#x, pool %#x, texture %p, shared_handle %p.\n", 665 iface, width, height, levels, usage, format, pool, texture, shared_handle); 666 667 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); 668 if (!object) 669 { 670 ERR("Failed to allocate texture memory.\n"); 671 return D3DERR_OUTOFVIDEOMEMORY; 672 } 673 674 hr = texture_init(object, This, width, height, levels, usage, format, pool); 675 if (FAILED(hr)) 676 { 677 WARN("Failed to initialize texture, hr %#x.\n", hr); 678 HeapFree(GetProcessHeap(), 0, object); 679 return hr; 680 } 681 682 TRACE("Created texture %p.\n", object); 683 *texture = (IDirect3DTexture9 *)object; 684 685 return D3D_OK; 686 } 687 688 static HRESULT WINAPI IDirect3DDevice9Impl_CreateVolumeTexture(IDirect3DDevice9Ex *iface, 689 UINT width, UINT height, UINT depth, UINT levels, DWORD usage, D3DFORMAT format, 690 D3DPOOL pool, IDirect3DVolumeTexture9 **texture, HANDLE *shared_handle) 691 { 692 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 693 IDirect3DVolumeTexture9Impl *object; 694 HRESULT hr; 695 696 TRACE("iface %p, width %u, height %u, depth %u, levels %u\n", 697 iface, width, height, depth, levels); 698 TRACE("usage %#x, format %#x, pool %#x, texture %p, shared_handle %p.\n", 699 usage, format, pool, texture, shared_handle); 700 701 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); 702 if (!object) 703 { 704 ERR("Failed to allocate volume texture memory.\n"); 705 return D3DERR_OUTOFVIDEOMEMORY; 706 } 707 708 hr = volumetexture_init(object, This, width, height, depth, levels, usage, format, pool); 709 if (FAILED(hr)) 710 { 711 WARN("Failed to initialize volume texture, hr %#x.\n", hr); 712 HeapFree(GetProcessHeap(), 0, object); 713 return hr; 714 } 715 716 TRACE("Created volume texture %p.\n", object); 717 *texture = (IDirect3DVolumeTexture9 *)object; 718 719 return D3D_OK; 720 } 721 722 static HRESULT WINAPI IDirect3DDevice9Impl_CreateCubeTexture(IDirect3DDevice9Ex *iface, 723 UINT edge_length, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool, 724 IDirect3DCubeTexture9 **texture, HANDLE *shared_handle) 725 { 726 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 727 IDirect3DCubeTexture9Impl *object; 728 HRESULT hr; 729 730 TRACE("iface %p, edge_length %u, levels %u, usage %#x, format %#x, pool %#x, texture %p, shared_handle %p.\n", 731 iface, edge_length, levels, usage, format, pool, texture, shared_handle); 732 733 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); 734 if (!object) 735 { 736 ERR("Failed to allocate cube texture memory.\n"); 737 return D3DERR_OUTOFVIDEOMEMORY; 738 } 739 740 hr = cubetexture_init(object, This, edge_length, levels, usage, format, pool); 741 if (FAILED(hr)) 742 { 743 WARN("Failed to initialize cube texture, hr %#x.\n", hr); 744 HeapFree(GetProcessHeap(), 0, object); 745 return hr; 746 } 747 748 TRACE("Created cube texture %p.\n", object); 749 *texture = (IDirect3DCubeTexture9 *)object; 750 751 return D3D_OK; 752 } 753 754 static HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexBuffer(IDirect3DDevice9Ex *iface, UINT size, DWORD usage, 755 DWORD fvf, D3DPOOL pool, IDirect3DVertexBuffer9 **buffer, HANDLE *shared_handle) 756 { 757 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 758 IDirect3DVertexBuffer9Impl *object; 759 HRESULT hr; 760 761 TRACE("iface %p, size %u, usage %#x, fvf %#x, pool %#x, buffer %p, shared_handle %p.\n", 762 iface, size, usage, fvf, pool, buffer, shared_handle); 763 764 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); 765 if (!object) 766 { 767 ERR("Failed to allocate buffer memory.\n"); 768 return D3DERR_OUTOFVIDEOMEMORY; 769 } 770 771 hr = vertexbuffer_init(object, This, size, usage, fvf, pool); 772 if (FAILED(hr)) 773 { 774 WARN("Failed to initialize vertex buffer, hr %#x.\n", hr); 775 HeapFree(GetProcessHeap(), 0, object); 776 return hr; 777 } 778 779 TRACE("Created vertex buffer %p.\n", object); 780 *buffer = (IDirect3DVertexBuffer9 *)object; 781 782 return D3D_OK; 783 } 784 785 static HRESULT WINAPI IDirect3DDevice9Impl_CreateIndexBuffer(IDirect3DDevice9Ex *iface, UINT size, DWORD usage, 786 D3DFORMAT format, D3DPOOL pool, IDirect3DIndexBuffer9 **buffer, HANDLE *shared_handle) 787 { 788 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 789 IDirect3DIndexBuffer9Impl *object; 790 HRESULT hr; 791 792 TRACE("iface %p, size %u, usage %#x, format %#x, pool %#x, buffer %p, shared_handle %p.\n", 793 iface, size, usage, format, pool, buffer, shared_handle); 794 795 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); 796 if (!object) 797 { 798 ERR("Failed to allocate buffer memory.\n"); 799 return D3DERR_OUTOFVIDEOMEMORY; 800 } 801 802 hr = indexbuffer_init(object, This, size, usage, format, pool); 803 if (FAILED(hr)) 804 { 805 WARN("Failed to initialize index buffer, hr %#x.\n", hr); 806 HeapFree(GetProcessHeap(), 0, object); 807 return hr; 808 } 809 810 TRACE("Created index buffer %p.\n", object); 811 *buffer = (IDirect3DIndexBuffer9 *)object; 812 813 return D3D_OK; 814 } 640 815 641 816 static HRESULT IDirect3DDevice9Impl_CreateSurface(LPDIRECT3DDEVICE9EX iface, UINT Width, UINT Height, … … 643 818 UINT Usage, D3DPOOL Pool, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality) 644 819 { 645 HRESULT hrc;820 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 646 821 IDirect3DSurface9Impl *object; 647 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 648 TRACE("(%p) Relay\n", This); 649 650 if(MultisampleQuality > 0){ 651 FIXME("MultisampleQuality set to %d, bstituting 0\n", MultisampleQuality); 652 /* 653 MultisampleQuality 654 [in] Quality level. The valid range is between zero and one less than the level returned by pQualityLevels used by IDirect3D9::CheckDeviceMultiSampleType. Passing a larger value returns the error D3DERR_INVALIDCALL. The MultisampleQuality values of paired render targets, depth stencil surfaces, and the MultiSample type must all match. 655 */ 656 657 MultisampleQuality=0; 658 } 659 /*FIXME: Check MAX bounds of MultisampleQuality*/ 660 661 /* Allocate the storage for the device */ 822 HRESULT hr; 823 824 TRACE("(%p) : w(%d) h(%d) fmt(%d) surf@%p\n", This, Width, Height, Format, *ppSurface); 825 662 826 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DSurface9Impl)); 663 if (NULL == object) { 664 FIXME("Allocation of memory failed\n"); 827 if (!object) 828 { 829 FIXME("Failed to allocate surface memory.\n"); 665 830 return D3DERR_OUTOFVIDEOMEMORY; 666 831 } 667 832 668 object->lpVtbl = &Direct3DSurface9_Vtbl; 669 object->ref = 1; 670 671 TRACE("(%p) : w(%d) h(%d) fmt(%d) surf@%p\n", This, Width, Height, Format, *ppSurface); 672 673 EnterCriticalSection(&d3d9_cs); 674 hrc = IWineD3DDevice_CreateSurface(This->WineD3DDevice, Width, Height, wined3dformat_from_d3dformat(Format), 675 Lockable, Discard, Level, &object->wineD3DSurface, Usage & WINED3DUSAGE_MASK, (WINED3DPOOL)Pool, 676 MultiSample, MultisampleQuality, SURFACE_OPENGL, (IUnknown *)object); 677 LeaveCriticalSection(&d3d9_cs); 678 679 if (hrc != D3D_OK || NULL == object->wineD3DSurface) { 680 681 /* free up object */ 682 FIXME("(%p) call to IWineD3DDevice_CreateSurface failed\n", This); 833 hr = surface_init(object, This, Width, Height, Format, Lockable, Discard, 834 Level, Usage, Pool, MultiSample, MultisampleQuality); 835 if (FAILED(hr)) 836 { 837 WARN("Failed to initialize surface, hr %#x.\n", hr); 683 838 HeapFree(GetProcessHeap(), 0, object); 684 } else { 685 IDirect3DDevice9Ex_AddRef(iface); 686 object->parentDevice = iface; 687 TRACE("(%p) : Created surface %p\n", This, object); 688 *ppSurface = (LPDIRECT3DSURFACE9) object; 689 } 690 return hrc; 691 } 692 693 694 695 static HRESULT WINAPI IDirect3DDevice9Impl_CreateRenderTarget(LPDIRECT3DDEVICE9EX iface, UINT Width, UINT Height, 696 D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, 697 DWORD MultisampleQuality, BOOL Lockable, 698 IDirect3DSurface9 **ppSurface, HANDLE* pSharedHandle) { 839 return hr; 840 } 841 842 TRACE("Created surface %p.\n", object); 843 *ppSurface = (IDirect3DSurface9 *)object; 844 845 return D3D_OK; 846 } 847 848 static HRESULT WINAPI IDirect3DDevice9Impl_CreateRenderTarget(IDirect3DDevice9Ex *iface, UINT Width, UINT Height, 849 D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Lockable, 850 IDirect3DSurface9 **ppSurface, HANDLE *pSharedHandle) 851 { 699 852 HRESULT hr; 700 853 TRACE("Relay\n"); … … 725 878 TRACE("(%p) Relay\n" , This); 726 879 727 EnterCriticalSection(&d3d9_cs);880 wined3d_mutex_lock(); 728 881 hr = IWineD3DDevice_UpdateSurface(This->WineD3DDevice, ((IDirect3DSurface9Impl *)pSourceSurface)->wineD3DSurface, pSourceRect, ((IDirect3DSurface9Impl *)pDestinationSurface)->wineD3DSurface, pDestPoint); 729 LeaveCriticalSection(&d3d9_cs); 882 wined3d_mutex_unlock(); 883 730 884 return hr; 731 885 } … … 736 890 TRACE("(%p) Relay\n" , This); 737 891 738 EnterCriticalSection(&d3d9_cs);892 wined3d_mutex_lock(); 739 893 hr = IWineD3DDevice_UpdateTexture(This->WineD3DDevice, ((IDirect3DBaseTexture9Impl *)pSourceTexture)->wineD3DBaseTexture, ((IDirect3DBaseTexture9Impl *)pDestinationTexture)->wineD3DBaseTexture); 740 LeaveCriticalSection(&d3d9_cs); 894 wined3d_mutex_unlock(); 895 741 896 return hr; 742 897 } … … 749 904 TRACE("(%p)->(%p,%p)\n" , This, renderTarget, destSurface); 750 905 751 EnterCriticalSection(&d3d9_cs);906 wined3d_mutex_lock(); 752 907 hr = IWineD3DSurface_BltFast(destSurface->wineD3DSurface, 0, 0, renderTarget->wineD3DSurface, NULL, WINEDDBLTFAST_NOCOLORKEY); 753 LeaveCriticalSection(&d3d9_cs); 908 wined3d_mutex_unlock(); 909 754 910 return hr; 755 911 } … … 761 917 TRACE("(%p) Relay\n" , This); 762 918 763 EnterCriticalSection(&d3d9_cs);919 wined3d_mutex_lock(); 764 920 hr = IWineD3DDevice_GetFrontBufferData(This->WineD3DDevice, iSwapChain, destSurface->wineD3DSurface); 765 LeaveCriticalSection(&d3d9_cs); 921 wined3d_mutex_unlock(); 922 766 923 return hr; 767 924 } … … 774 931 775 932 TRACE("(%p)->(%p,%p,%p,%p,%d)\n" , This, src, pSourceRect, dst, pDestRect, Filter); 776 EnterCriticalSection(&d3d9_cs); 933 934 wined3d_mutex_lock(); 777 935 hr = IWineD3DSurface_Blt(dst->wineD3DSurface, pDestRect, src->wineD3DSurface, pSourceRect, 0, NULL, Filter); 778 LeaveCriticalSection(&d3d9_cs); 936 wined3d_mutex_unlock(); 937 779 938 return hr; 780 939 } … … 790 949 TRACE("(%p) Relay\n" , This); 791 950 792 EnterCriticalSection(&d3d9_cs); 951 wined3d_mutex_lock(); 952 793 953 IWineD3DSurface_GetDesc(surface->wineD3DSurface, &desc); 794 954 usage = desc.usage; … … 800 960 */ 801 961 if(!(usage & WINED3DUSAGE_RENDERTARGET) && (pool != WINED3DPOOL_DEFAULT || restype != WINED3DRTYPE_SURFACE)) { 802 LeaveCriticalSection(&d3d9_cs);962 wined3d_mutex_unlock(); 803 963 WARN("Surface is not a render target, or not a stand-alone D3DPOOL_DEFAULT surface\n"); 804 964 return D3DERR_INVALIDCALL; … … 808 968 /* Note: D3DRECT is compatible with WINED3DRECT */ 809 969 hr = IWineD3DDevice_ColorFill(This->WineD3DDevice, surface->wineD3DSurface, (CONST WINED3DRECT*)pRect, color); 810 LeaveCriticalSection(&d3d9_cs); 970 971 wined3d_mutex_unlock(); 972 811 973 return hr; 812 974 } … … 818 980 FIXME("Attempting to create a managed offscreen plain surface\n"); 819 981 return D3DERR_INVALIDCALL; 820 } 982 } 821 983 /* 822 984 'Off-screen plain surfaces are always lockable, regardless of their pool types.' … … 824 986 D3DPOOL_DEFAULT is the appropriate pool for use with the IDirect3DDevice9::StretchRect and IDirect3DDevice9::ColorFill. 825 987 Why, their always lockable? 826 should I change the usage to dynamic? 988 should I change the usage to dynamic? 827 989 */ 828 990 hr = IDirect3DDevice9Impl_CreateSurface(iface, Width, Height, Format, TRUE /* Lockable */, FALSE /* Discard */, … … 840 1002 TRACE("(%p) Relay\n" , This); 841 1003 842 EnterCriticalSection(&d3d9_cs); 1004 if (RenderTargetIndex >= D3D9_MAX_SIMULTANEOUS_RENDERTARGETS) 1005 { 1006 WARN("Invalid index %u specified.\n", RenderTargetIndex); 1007 return D3DERR_INVALIDCALL; 1008 } 1009 1010 wined3d_mutex_lock(); 843 1011 hr = IWineD3DDevice_SetRenderTarget(This->WineD3DDevice, RenderTargetIndex, pSurface ? pSurface->wineD3DSurface : NULL); 844 LeaveCriticalSection(&d3d9_cs); 1012 wined3d_mutex_unlock(); 1013 845 1014 return hr; 846 1015 } … … 857 1026 } 858 1027 859 EnterCriticalSection(&d3d9_cs); 1028 if (RenderTargetIndex >= D3D9_MAX_SIMULTANEOUS_RENDERTARGETS) 1029 { 1030 WARN("Invalid index %u specified.\n", RenderTargetIndex); 1031 return D3DERR_INVALIDCALL; 1032 } 1033 1034 wined3d_mutex_lock(); 1035 860 1036 hr=IWineD3DDevice_GetRenderTarget(This->WineD3DDevice,RenderTargetIndex,&pRenderTarget); 861 1037 … … 874 1050 } 875 1051 876 LeaveCriticalSection(&d3d9_cs);1052 wined3d_mutex_unlock(); 877 1053 878 1054 return hr; … … 886 1062 TRACE("(%p) Relay\n" , This); 887 1063 888 889 EnterCriticalSection(&d3d9_cs); 1064 pSurface = (IDirect3DSurface9Impl*)pZStencilSurface; 1065 1066 wined3d_mutex_lock(); 890 1067 hr = IDirect3DDevice9_GetDepthStencilSurface(iface, &pOldSurface); 891 1068 if (D3D_OK==hr) { … … 899 1076 IDirect3DSurface9_AddRef(pZStencilSurface); 900 1077 } 901 LeaveCriticalSection(&d3d9_cs); 1078 wined3d_mutex_unlock(); 1079 902 1080 return hr; 903 1081 } … … 913 1091 } 914 1092 915 EnterCriticalSection(&d3d9_cs);1093 wined3d_mutex_lock(); 916 1094 hr = IWineD3DDevice_GetDepthStencilSurface(This->WineD3DDevice,&pZStencilSurface); 917 1095 if (hr == WINED3D_OK) { … … 923 1101 *ppZStencilSurface = NULL; 924 1102 } 925 LeaveCriticalSection(&d3d9_cs); 1103 wined3d_mutex_unlock(); 1104 926 1105 return hr; 927 1106 } … … 932 1111 TRACE("(%p) Relay\n" , This); 933 1112 934 EnterCriticalSection(&d3d9_cs);1113 wined3d_mutex_lock(); 935 1114 hr = IWineD3DDevice_BeginScene(This->WineD3DDevice); 936 LeaveCriticalSection(&d3d9_cs); 1115 wined3d_mutex_unlock(); 1116 937 1117 return hr; 938 1118 } … … 943 1123 TRACE("(%p) Relay\n" , This); 944 1124 945 EnterCriticalSection(&d3d9_cs);1125 wined3d_mutex_lock(); 946 1126 hr = IWineD3DDevice_EndScene(This->WineD3DDevice); 947 LeaveCriticalSection(&d3d9_cs); 1127 wined3d_mutex_unlock(); 1128 948 1129 return hr; 949 1130 } … … 955 1136 956 1137 /* Note: D3DRECT is compatible with WINED3DRECT */ 957 EnterCriticalSection(&d3d9_cs);1138 wined3d_mutex_lock(); 958 1139 hr = IWineD3DDevice_Clear(This->WineD3DDevice, Count, (CONST WINED3DRECT*) pRects, Flags, Color, Z, Stencil); 959 LeaveCriticalSection(&d3d9_cs); 1140 wined3d_mutex_unlock(); 1141 960 1142 return hr; 961 1143 } … … 967 1149 968 1150 /* Note: D3DMATRIX is compatible with WINED3DMATRIX */ 969 EnterCriticalSection(&d3d9_cs);1151 wined3d_mutex_lock(); 970 1152 hr = IWineD3DDevice_SetTransform(This->WineD3DDevice, State, (CONST WINED3DMATRIX*) lpMatrix); 971 LeaveCriticalSection(&d3d9_cs); 1153 wined3d_mutex_unlock(); 1154 972 1155 return hr; 973 1156 } … … 979 1162 TRACE("(%p) Relay\n" , This); 980 1163 981 EnterCriticalSection(&d3d9_cs);982 1164 /* Note: D3DMATRIX is compatible with WINED3DMATRIX */ 1165 wined3d_mutex_lock(); 983 1166 hr = IWineD3DDevice_GetTransform(This->WineD3DDevice, State, (WINED3DMATRIX*) pMatrix); 984 LeaveCriticalSection(&d3d9_cs);1167 wined3d_mutex_unlock(); 985 1168 986 1169 return hr; … … 993 1176 994 1177 /* Note: D3DMATRIX is compatible with WINED3DMATRIX */ 995 EnterCriticalSection(&d3d9_cs);1178 wined3d_mutex_lock(); 996 1179 hr = IWineD3DDevice_MultiplyTransform(This->WineD3DDevice, State, (CONST WINED3DMATRIX*) pMatrix); 997 LeaveCriticalSection(&d3d9_cs); 1180 wined3d_mutex_unlock(); 1181 998 1182 return hr; 999 1183 } … … 1005 1189 1006 1190 /* Note: D3DVIEWPORT9 is compatible with WINED3DVIEWPORT */ 1007 EnterCriticalSection(&d3d9_cs);1191 wined3d_mutex_lock(); 1008 1192 hr = IWineD3DDevice_SetViewport(This->WineD3DDevice, (const WINED3DVIEWPORT *)pViewport); 1009 LeaveCriticalSection(&d3d9_cs); 1193 wined3d_mutex_unlock(); 1194 1010 1195 return hr; 1011 1196 } … … 1017 1202 1018 1203 /* Note: D3DVIEWPORT9 is compatible with WINED3DVIEWPORT */ 1019 EnterCriticalSection(&d3d9_cs);1204 wined3d_mutex_lock(); 1020 1205 hr = IWineD3DDevice_GetViewport(This->WineD3DDevice, (WINED3DVIEWPORT *)pViewport); 1021 LeaveCriticalSection(&d3d9_cs); 1206 wined3d_mutex_unlock(); 1207 1022 1208 return hr; 1023 1209 } … … 1029 1215 1030 1216 /* Note: D3DMATERIAL9 is compatible with WINED3DMATERIAL */ 1031 EnterCriticalSection(&d3d9_cs);1217 wined3d_mutex_lock(); 1032 1218 hr = IWineD3DDevice_SetMaterial(This->WineD3DDevice, (const WINED3DMATERIAL *)pMaterial); 1033 LeaveCriticalSection(&d3d9_cs); 1219 wined3d_mutex_unlock(); 1220 1034 1221 return hr; 1035 1222 } … … 1041 1228 1042 1229 /* Note: D3DMATERIAL9 is compatible with WINED3DMATERIAL */ 1043 EnterCriticalSection(&d3d9_cs);1230 wined3d_mutex_lock(); 1044 1231 hr = IWineD3DDevice_GetMaterial(This->WineD3DDevice, (WINED3DMATERIAL *)pMaterial); 1045 LeaveCriticalSection(&d3d9_cs); 1232 wined3d_mutex_unlock(); 1233 1046 1234 return hr; 1047 1235 } … … 1053 1241 1054 1242 /* Note: D3DLIGHT9 is compatible with WINED3DLIGHT */ 1055 EnterCriticalSection(&d3d9_cs);1243 wined3d_mutex_lock(); 1056 1244 hr = IWineD3DDevice_SetLight(This->WineD3DDevice, Index, (const WINED3DLIGHT *)pLight); 1057 LeaveCriticalSection(&d3d9_cs); 1245 wined3d_mutex_unlock(); 1246 1058 1247 return hr; 1059 1248 } … … 1065 1254 1066 1255 /* Note: D3DLIGHT9 is compatible with WINED3DLIGHT */ 1067 EnterCriticalSection(&d3d9_cs);1256 wined3d_mutex_lock(); 1068 1257 hr = IWineD3DDevice_GetLight(This->WineD3DDevice, Index, (WINED3DLIGHT *)pLight); 1069 LeaveCriticalSection(&d3d9_cs); 1258 wined3d_mutex_unlock(); 1259 1070 1260 return hr; 1071 1261 } … … 1076 1266 TRACE("(%p) Relay\n" , This); 1077 1267 1078 EnterCriticalSection(&d3d9_cs);1268 wined3d_mutex_lock(); 1079 1269 hr = IWineD3DDevice_SetLightEnable(This->WineD3DDevice, Index, Enable); 1080 LeaveCriticalSection(&d3d9_cs); 1270 wined3d_mutex_unlock(); 1271 1081 1272 return hr; 1082 1273 } … … 1087 1278 TRACE("(%p) Relay\n" , This); 1088 1279 1089 EnterCriticalSection(&d3d9_cs);1280 wined3d_mutex_lock(); 1090 1281 hr = IWineD3DDevice_GetLightEnable(This->WineD3DDevice, Index, pEnable); 1091 LeaveCriticalSection(&d3d9_cs); 1282 wined3d_mutex_unlock(); 1283 1092 1284 return hr; 1093 1285 } … … 1098 1290 TRACE("(%p) Relay\n" , This); 1099 1291 1100 EnterCriticalSection(&d3d9_cs);1292 wined3d_mutex_lock(); 1101 1293 hr = IWineD3DDevice_SetClipPlane(This->WineD3DDevice, Index, pPlane); 1102 LeaveCriticalSection(&d3d9_cs); 1294 wined3d_mutex_unlock(); 1295 1103 1296 return hr; 1104 1297 } … … 1109 1302 TRACE("(%p) Relay\n" , This); 1110 1303 1111 EnterCriticalSection(&d3d9_cs);1304 wined3d_mutex_lock(); 1112 1305 hr = IWineD3DDevice_GetClipPlane(This->WineD3DDevice, Index, pPlane); 1113 LeaveCriticalSection(&d3d9_cs); 1306 wined3d_mutex_unlock(); 1307 1114 1308 return hr; 1115 1309 } … … 1120 1314 TRACE("(%p) Relay\n" , This); 1121 1315 1122 EnterCriticalSection(&d3d9_cs);1316 wined3d_mutex_lock(); 1123 1317 hr = IWineD3DDevice_SetRenderState(This->WineD3DDevice, State, Value); 1124 LeaveCriticalSection(&d3d9_cs); 1318 wined3d_mutex_unlock(); 1319 1125 1320 return hr; 1126 1321 } … … 1131 1326 TRACE("(%p) Relay\n" , This); 1132 1327 1133 EnterCriticalSection(&d3d9_cs);1328 wined3d_mutex_lock(); 1134 1329 hr = IWineD3DDevice_GetRenderState(This->WineD3DDevice, State, pValue); 1135 LeaveCriticalSection(&d3d9_cs); 1330 wined3d_mutex_unlock(); 1331 1136 1332 return hr; 1137 1333 } … … 1142 1338 TRACE("(%p) Relay\n" , This); 1143 1339 1144 EnterCriticalSection(&d3d9_cs);1340 wined3d_mutex_lock(); 1145 1341 hr = IWineD3DDevice_SetClipStatus(This->WineD3DDevice, (const WINED3DCLIPSTATUS *)pClipStatus); 1146 LeaveCriticalSection(&d3d9_cs); 1342 wined3d_mutex_unlock(); 1343 1147 1344 return hr; 1148 1345 } … … 1153 1350 TRACE("(%p) Relay\n" , This); 1154 1351 1155 EnterCriticalSection(&d3d9_cs);1352 wined3d_mutex_lock(); 1156 1353 hr = IWineD3DDevice_GetClipStatus(This->WineD3DDevice, (WINED3DCLIPSTATUS *)pClipStatus); 1157 LeaveCriticalSection(&d3d9_cs); 1354 wined3d_mutex_unlock(); 1355 1158 1356 return hr; 1159 1357 } … … 1170 1368 } 1171 1369 1172 EnterCriticalSection(&d3d9_cs);1370 wined3d_mutex_lock(); 1173 1371 rc = IWineD3DDevice_GetTexture(This->WineD3DDevice, Stage, &retTexture); 1174 1372 if (SUCCEEDED(rc) && NULL != retTexture) { … … 1181 1379 *ppTexture = NULL; 1182 1380 } 1183 LeaveCriticalSection(&d3d9_cs);1381 wined3d_mutex_unlock(); 1184 1382 1185 1383 return rc; … … 1191 1389 TRACE("(%p) Relay %d %p\n" , This, Stage, pTexture); 1192 1390 1193 EnterCriticalSection(&d3d9_cs);1391 wined3d_mutex_lock(); 1194 1392 hr = IWineD3DDevice_SetTexture(This->WineD3DDevice, Stage, 1195 1393 pTexture==NULL ? NULL:((IDirect3DBaseTexture9Impl *)pTexture)->wineD3DBaseTexture); 1196 LeaveCriticalSection(&d3d9_cs); 1394 wined3d_mutex_unlock(); 1395 1197 1396 return hr; 1198 1397 } … … 1240 1439 TRACE("(%p) Relay\n" , This); 1241 1440 1242 EnterCriticalSection(&d3d9_cs);1441 wined3d_mutex_lock(); 1243 1442 hr = IWineD3DDevice_GetTextureStageState(This->WineD3DDevice, Stage, tss_lookup[Type], pValue); 1244 LeaveCriticalSection(&d3d9_cs); 1443 wined3d_mutex_unlock(); 1444 1245 1445 return hr; 1246 1446 } … … 1251 1451 TRACE("(%p) Relay\n" , This); 1252 1452 1253 EnterCriticalSection(&d3d9_cs);1453 wined3d_mutex_lock(); 1254 1454 hr = IWineD3DDevice_SetTextureStageState(This->WineD3DDevice, Stage, tss_lookup[Type], Value); 1255 LeaveCriticalSection(&d3d9_cs); 1256 return hr; 1257 } 1258 1259 static HRESULT WINAPI IDirect3DDevice9Impl_GetSamplerState(LPDIRECT3DDEVICE9EX iface, DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD* pValue) { 1260 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 1261 HRESULT hr; 1262 TRACE("(%p) Relay\n" , This); 1263 1264 EnterCriticalSection(&d3d9_cs); 1455 wined3d_mutex_unlock(); 1456 1457 return hr; 1458 } 1459 1460 static HRESULT WINAPI IDirect3DDevice9Impl_GetSamplerState(IDirect3DDevice9Ex *iface, DWORD Sampler, 1461 D3DSAMPLERSTATETYPE Type, DWORD *pValue) 1462 { 1463 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 1464 HRESULT hr; 1465 TRACE("(%p) Relay\n" , This); 1466 1467 wined3d_mutex_lock(); 1265 1468 hr = IWineD3DDevice_GetSamplerState(This->WineD3DDevice, Sampler, Type, pValue); 1266 LeaveCriticalSection(&d3d9_cs); 1469 wined3d_mutex_unlock(); 1470 1267 1471 return hr; 1268 1472 } … … 1273 1477 TRACE("(%p) Relay\n" , This); 1274 1478 1275 EnterCriticalSection(&d3d9_cs);1479 wined3d_mutex_lock(); 1276 1480 hr = IWineD3DDevice_SetSamplerState(This->WineD3DDevice, Sampler, Type, Value); 1277 LeaveCriticalSection(&d3d9_cs); 1481 wined3d_mutex_unlock(); 1482 1278 1483 return hr; 1279 1484 } … … 1284 1489 TRACE("(%p) Relay\n" , This); 1285 1490 1286 EnterCriticalSection(&d3d9_cs);1491 wined3d_mutex_lock(); 1287 1492 hr = IWineD3DDevice_ValidateDevice(This->WineD3DDevice, pNumPasses); 1288 LeaveCriticalSection(&d3d9_cs); 1289 return hr; 1290 } 1291 1292 static HRESULT WINAPI IDirect3DDevice9Impl_SetPaletteEntries(LPDIRECT3DDEVICE9EX iface, UINT PaletteNumber, CONST PALETTEENTRY* pEntries) { 1293 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 1294 HRESULT hr; 1295 TRACE("(%p) Relay\n" , This); 1296 1297 EnterCriticalSection(&d3d9_cs); 1493 wined3d_mutex_unlock(); 1494 1495 return hr; 1496 } 1497 1498 static HRESULT WINAPI IDirect3DDevice9Impl_SetPaletteEntries(IDirect3DDevice9Ex *iface, UINT PaletteNumber, 1499 const PALETTEENTRY *pEntries) 1500 { 1501 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 1502 HRESULT hr; 1503 TRACE("(%p) Relay\n" , This); 1504 1505 wined3d_mutex_lock(); 1298 1506 hr = IWineD3DDevice_SetPaletteEntries(This->WineD3DDevice, PaletteNumber, pEntries); 1299 LeaveCriticalSection(&d3d9_cs); 1507 wined3d_mutex_unlock(); 1508 1300 1509 return hr; 1301 1510 } … … 1306 1515 TRACE("(%p) Relay\n" , This); 1307 1516 1308 EnterCriticalSection(&d3d9_cs);1517 wined3d_mutex_lock(); 1309 1518 hr = IWineD3DDevice_GetPaletteEntries(This->WineD3DDevice, PaletteNumber, pEntries); 1310 LeaveCriticalSection(&d3d9_cs); 1519 wined3d_mutex_unlock(); 1520 1311 1521 return hr; 1312 1522 } … … 1317 1527 TRACE("(%p) Relay\n" , This); 1318 1528 1319 EnterCriticalSection(&d3d9_cs);1529 wined3d_mutex_lock(); 1320 1530 hr = IWineD3DDevice_SetCurrentTexturePalette(This->WineD3DDevice, PaletteNumber); 1321 LeaveCriticalSection(&d3d9_cs); 1531 wined3d_mutex_unlock(); 1532 1322 1533 return hr; 1323 1534 } … … 1328 1539 TRACE("(%p) Relay\n" , This); 1329 1540 1330 EnterCriticalSection(&d3d9_cs);1541 wined3d_mutex_lock(); 1331 1542 hr = IWineD3DDevice_GetCurrentTexturePalette(This->WineD3DDevice, PaletteNumber); 1332 LeaveCriticalSection(&d3d9_cs); 1543 wined3d_mutex_unlock(); 1544 1333 1545 return hr; 1334 1546 } … … 1339 1551 TRACE("(%p) Relay\n" , This); 1340 1552 1341 EnterCriticalSection(&d3d9_cs);1553 wined3d_mutex_lock(); 1342 1554 hr = IWineD3DDevice_SetScissorRect(This->WineD3DDevice, pRect); 1343 LeaveCriticalSection(&d3d9_cs); 1555 wined3d_mutex_unlock(); 1556 1344 1557 return hr; 1345 1558 } … … 1350 1563 TRACE("(%p) Relay\n" , This); 1351 1564 1352 EnterCriticalSection(&d3d9_cs);1565 wined3d_mutex_lock(); 1353 1566 hr = IWineD3DDevice_GetScissorRect(This->WineD3DDevice, pRect); 1354 LeaveCriticalSection(&d3d9_cs); 1567 wined3d_mutex_unlock(); 1568 1355 1569 return hr; 1356 1570 } … … 1361 1575 TRACE("(%p) Relay\n" , This); 1362 1576 1363 EnterCriticalSection(&d3d9_cs);1577 wined3d_mutex_lock(); 1364 1578 hr = IWineD3DDevice_SetSoftwareVertexProcessing(This->WineD3DDevice, bSoftware); 1365 LeaveCriticalSection(&d3d9_cs); 1579 wined3d_mutex_unlock(); 1580 1366 1581 return hr; 1367 1582 } … … 1372 1587 TRACE("(%p) Relay\n" , This); 1373 1588 1374 EnterCriticalSection(&d3d9_cs);1589 wined3d_mutex_lock(); 1375 1590 ret = IWineD3DDevice_GetSoftwareVertexProcessing(This->WineD3DDevice); 1376 LeaveCriticalSection(&d3d9_cs); 1591 wined3d_mutex_unlock(); 1592 1377 1593 return ret; 1378 1594 } … … 1383 1599 TRACE("(%p) Relay\n" , This); 1384 1600 1385 EnterCriticalSection(&d3d9_cs);1601 wined3d_mutex_lock(); 1386 1602 hr = IWineD3DDevice_SetNPatchMode(This->WineD3DDevice, nSegments); 1387 LeaveCriticalSection(&d3d9_cs); 1603 wined3d_mutex_unlock(); 1604 1388 1605 return hr; 1389 1606 } … … 1394 1611 TRACE("(%p) Relay\n" , This); 1395 1612 1396 EnterCriticalSection(&d3d9_cs);1613 wined3d_mutex_lock(); 1397 1614 ret = IWineD3DDevice_GetNPatchMode(This->WineD3DDevice); 1398 LeaveCriticalSection(&d3d9_cs); 1615 wined3d_mutex_unlock(); 1616 1399 1617 return ret; 1400 1618 } 1401 1619 1402 static HRESULT WINAPI IDirect3DDevice9Impl_DrawPrimitive(LPDIRECT3DDEVICE9EX iface, D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount) { 1403 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 1404 HRESULT hr; 1405 TRACE("(%p) Relay\n" , This); 1406 1407 EnterCriticalSection(&d3d9_cs); 1620 static HRESULT WINAPI IDirect3DDevice9Impl_DrawPrimitive(IDirect3DDevice9Ex *iface, D3DPRIMITIVETYPE PrimitiveType, 1621 UINT StartVertex, UINT PrimitiveCount) 1622 { 1623 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 1624 HRESULT hr; 1625 TRACE("(%p) Relay\n" , This); 1626 1627 wined3d_mutex_lock(); 1408 1628 IWineD3DDevice_SetPrimitiveType(This->WineD3DDevice, PrimitiveType); 1409 1629 hr = IWineD3DDevice_DrawPrimitive(This->WineD3DDevice, StartVertex, 1410 1630 vertex_count_from_primitive_count(PrimitiveType, PrimitiveCount)); 1411 LeaveCriticalSection(&d3d9_cs); 1631 wined3d_mutex_unlock(); 1632 1412 1633 return hr; 1413 1634 } … … 1420 1641 1421 1642 /* D3D8 passes the baseVertexIndex in SetIndices, and due to the stateblock functions wined3d has to work that way */ 1422 EnterCriticalSection(&d3d9_cs);1643 wined3d_mutex_lock(); 1423 1644 IWineD3DDevice_SetBaseVertexIndex(This->WineD3DDevice, BaseVertexIndex); 1424 1645 IWineD3DDevice_SetPrimitiveType(This->WineD3DDevice, PrimitiveType); 1425 hr = IWineD3DDevice_DrawIndexedPrimitive(This->WineD3DDevice, MinVertexIndex, NumVertices, 1426 startIndex, vertex_count_from_primitive_count(PrimitiveType, primCount)); 1427 LeaveCriticalSection(&d3d9_cs); 1428 return hr; 1429 } 1430 1431 static HRESULT WINAPI IDirect3DDevice9Impl_DrawPrimitiveUP(LPDIRECT3DDEVICE9EX iface, D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride) { 1432 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 1433 HRESULT hr; 1434 TRACE("(%p) Relay\n" , This); 1435 1436 EnterCriticalSection(&d3d9_cs); 1646 hr = IWineD3DDevice_DrawIndexedPrimitive(This->WineD3DDevice, startIndex, 1647 vertex_count_from_primitive_count(PrimitiveType, primCount)); 1648 wined3d_mutex_unlock(); 1649 1650 return hr; 1651 } 1652 1653 static HRESULT WINAPI IDirect3DDevice9Impl_DrawPrimitiveUP(IDirect3DDevice9Ex *iface, D3DPRIMITIVETYPE PrimitiveType, 1654 UINT PrimitiveCount, const void *pVertexStreamZeroData, UINT VertexStreamZeroStride) 1655 { 1656 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 1657 HRESULT hr; 1658 TRACE("(%p) Relay\n" , This); 1659 1660 wined3d_mutex_lock(); 1437 1661 IWineD3DDevice_SetPrimitiveType(This->WineD3DDevice, PrimitiveType); 1438 1662 hr = IWineD3DDevice_DrawPrimitiveUP(This->WineD3DDevice, 1439 1663 vertex_count_from_primitive_count(PrimitiveType, PrimitiveCount), 1440 1664 pVertexStreamZeroData, VertexStreamZeroStride); 1441 LeaveCriticalSection(&d3d9_cs); 1665 wined3d_mutex_unlock(); 1666 1442 1667 return hr; 1443 1668 } … … 1450 1675 TRACE("(%p) Relay\n" , This); 1451 1676 1452 EnterCriticalSection(&d3d9_cs);1677 wined3d_mutex_lock(); 1453 1678 IWineD3DDevice_SetPrimitiveType(This->WineD3DDevice, PrimitiveType); 1454 hr = IWineD3DDevice_DrawIndexedPrimitiveUP(This->WineD3DDevice, MinVertexIndex, NumVertexIndices,1679 hr = IWineD3DDevice_DrawIndexedPrimitiveUP(This->WineD3DDevice, 1455 1680 vertex_count_from_primitive_count(PrimitiveType, PrimitiveCount), pIndexData, 1456 1681 wined3dformat_from_d3dformat(IndexDataFormat), pVertexStreamZeroData, VertexStreamZeroStride); 1457 LeaveCriticalSection(&d3d9_cs); 1682 wined3d_mutex_unlock(); 1683 1458 1684 return hr; 1459 1685 } … … 1466 1692 TRACE("(%p) Relay\n" , This); 1467 1693 1468 EnterCriticalSection(&d3d9_cs);1694 wined3d_mutex_lock(); 1469 1695 hr = IWineD3DDevice_ProcessVertices(This->WineD3DDevice,SrcStartIndex, DestIndex, VertexCount, dest->wineD3DVertexBuffer, Decl ? Decl->wineD3DVertexDeclaration : NULL, Flags, dest->fvf); 1470 LeaveCriticalSection(&d3d9_cs); 1471 return hr; 1696 wined3d_mutex_unlock(); 1697 1698 return hr; 1699 } 1700 1701 static HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexDeclaration(IDirect3DDevice9Ex *iface, 1702 const D3DVERTEXELEMENT9 *elements, IDirect3DVertexDeclaration9 **declaration) 1703 { 1704 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 1705 IDirect3DVertexDeclaration9Impl *object; 1706 HRESULT hr; 1707 1708 TRACE("iface %p, elements %p, declaration %p.\n", iface, elements, declaration); 1709 1710 if (!declaration) 1711 { 1712 WARN("Caller passed a NULL declaration, returning D3DERR_INVALIDCALL.\n"); 1713 return D3DERR_INVALIDCALL; 1714 } 1715 1716 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); 1717 if (!object) 1718 { 1719 ERR("Failed to allocate vertex declaration memory.\n"); 1720 return E_OUTOFMEMORY; 1721 } 1722 1723 hr = vertexdeclaration_init(object, This, elements); 1724 if (FAILED(hr)) 1725 { 1726 WARN("Failed to initialize vertex declaration, hr %#x.\n", hr); 1727 HeapFree(GetProcessHeap(), 0, object); 1728 return hr; 1729 } 1730 1731 TRACE("Created vertex declaration %p.\n", object); 1732 *declaration = (IDirect3DVertexDeclaration9 *)object; 1733 1734 return D3D_OK; 1472 1735 } 1473 1736 … … 1542 1805 } 1543 1806 1544 EnterCriticalSection(&d3d9_cs);1807 wined3d_mutex_lock(); 1545 1808 decl = getConvertedDecl(This, FVF); 1546 LeaveCriticalSection(&d3d9_cs);1809 wined3d_mutex_unlock(); 1547 1810 1548 1811 if (!decl) … … 1588 1851 } 1589 1852 1853 static HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexShader(IDirect3DDevice9Ex *iface, 1854 const DWORD *byte_code, IDirect3DVertexShader9 **shader) 1855 { 1856 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 1857 IDirect3DVertexShader9Impl *object; 1858 HRESULT hr; 1859 1860 TRACE("iface %p, byte_code %p, shader %p.\n", iface, byte_code, shader); 1861 1862 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); 1863 if (!object) 1864 { 1865 ERR("Failed to allocate vertex shader memory.\n"); 1866 return E_OUTOFMEMORY; 1867 } 1868 1869 hr = vertexshader_init(object, This, byte_code); 1870 if (FAILED(hr)) 1871 { 1872 WARN("Failed to initialize vertex shader, hr %#x.\n", hr); 1873 HeapFree(GetProcessHeap(), 0, object); 1874 return hr; 1875 } 1876 1877 TRACE("Created vertex shader %p.\n", object); 1878 *shader = (IDirect3DVertexShader9 *)object; 1879 1880 return D3D_OK; 1881 } 1882 1590 1883 static HRESULT WINAPI IDirect3DDevice9Impl_SetStreamSource(LPDIRECT3DDEVICE9EX iface, UINT StreamNumber, IDirect3DVertexBuffer9* pStreamData, UINT OffsetInBytes, UINT Stride) { 1591 1884 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; … … 1593 1886 TRACE("(%p) Relay\n" , This); 1594 1887 1595 EnterCriticalSection(&d3d9_cs);1888 wined3d_mutex_lock(); 1596 1889 hr = IWineD3DDevice_SetStreamSource(This->WineD3DDevice, StreamNumber, 1597 pStreamData==NULL ? NULL:((IDirect3DVertexBuffer9Impl *)pStreamData)->wineD3DVertexBuffer, 1598 OffsetInBytes, Stride); 1599 LeaveCriticalSection(&d3d9_cs); 1890 pStreamData ? ((IDirect3DVertexBuffer9Impl *)pStreamData)->wineD3DVertexBuffer : NULL, 1891 OffsetInBytes, Stride); 1892 wined3d_mutex_unlock(); 1893 1600 1894 return hr; 1601 1895 } … … 1612 1906 } 1613 1907 1614 EnterCriticalSection(&d3d9_cs);1908 wined3d_mutex_lock(); 1615 1909 rc = IWineD3DDevice_GetStreamSource(This->WineD3DDevice, StreamNumber, &retStream, OffsetInBytes, pStride); 1616 1910 if (rc == D3D_OK && NULL != retStream) { … … 1623 1917 *pStream = NULL; 1624 1918 } 1625 LeaveCriticalSection(&d3d9_cs);1919 wined3d_mutex_unlock(); 1626 1920 1627 1921 return rc; 1628 1922 } 1629 1923 1630 static HRESULT WINAPI IDirect3DDevice9Impl_SetStreamSourceFreq(LPDIRECT3DDEVICE9EX iface, UINT StreamNumber, UINT Divider) { 1631 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 1632 HRESULT hr; 1633 TRACE("(%p) Relay\n" , This); 1634 1635 EnterCriticalSection(&d3d9_cs); 1924 static HRESULT WINAPI IDirect3DDevice9Impl_SetStreamSourceFreq(IDirect3DDevice9Ex *iface, UINT StreamNumber, 1925 UINT Divider) 1926 { 1927 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 1928 HRESULT hr; 1929 TRACE("(%p) Relay\n" , This); 1930 1931 wined3d_mutex_lock(); 1636 1932 hr = IWineD3DDevice_SetStreamSourceFreq(This->WineD3DDevice, StreamNumber, Divider); 1637 LeaveCriticalSection(&d3d9_cs); 1933 wined3d_mutex_unlock(); 1934 1638 1935 return hr; 1639 1936 } … … 1644 1941 TRACE("(%p) Relay\n" , This); 1645 1942 1646 EnterCriticalSection(&d3d9_cs);1943 wined3d_mutex_lock(); 1647 1944 hr = IWineD3DDevice_GetStreamSourceFreq(This->WineD3DDevice, StreamNumber, Divider); 1648 LeaveCriticalSection(&d3d9_cs); 1945 wined3d_mutex_unlock(); 1946 1649 1947 return hr; 1650 1948 } … … 1656 1954 TRACE("(%p) Relay\n", This); 1657 1955 1658 EnterCriticalSection(&d3d9_cs);1659 hr = IWineD3DDevice_SetInd ices(This->WineD3DDevice,1956 wined3d_mutex_lock(); 1957 hr = IWineD3DDevice_SetIndexBuffer(This->WineD3DDevice, 1660 1958 ib ? ib->wineD3DIndexBuffer : NULL, 1661 1959 ib ? ib->format : WINED3DFMT_UNKNOWN); 1662 LeaveCriticalSection(&d3d9_cs); 1960 wined3d_mutex_unlock(); 1961 1663 1962 return hr; 1664 1963 } … … 1675 1974 } 1676 1975 1677 EnterCriticalSection(&d3d9_cs);1678 rc = IWineD3DDevice_GetInd ices(This->WineD3DDevice, &retIndexData);1976 wined3d_mutex_lock(); 1977 rc = IWineD3DDevice_GetIndexBuffer(This->WineD3DDevice, &retIndexData); 1679 1978 if (SUCCEEDED(rc) && retIndexData) { 1680 1979 IWineD3DBuffer_GetParent(retIndexData, (IUnknown **)ppIndexData); … … 1684 1983 *ppIndexData = NULL; 1685 1984 } 1686 LeaveCriticalSection(&d3d9_cs); 1985 wined3d_mutex_unlock(); 1986 1687 1987 return rc; 1688 1988 } 1689 1989 1990 static HRESULT WINAPI IDirect3DDevice9Impl_CreatePixelShader(IDirect3DDevice9Ex *iface, 1991 const DWORD *byte_code, IDirect3DPixelShader9 **shader) 1992 { 1993 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 1994 IDirect3DPixelShader9Impl *object; 1995 HRESULT hr; 1996 1997 TRACE("iface %p, byte_code %p, shader %p.\n", iface, byte_code, shader); 1998 1999 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); 2000 if (!object) 2001 { 2002 FIXME("Failed to allocate pixel shader memory.\n"); 2003 return E_OUTOFMEMORY; 2004 } 2005 2006 hr = pixelshader_init(object, This, byte_code); 2007 if (FAILED(hr)) 2008 { 2009 WARN("Failed to initialize pixel shader, hr %#x.\n", hr); 2010 HeapFree(GetProcessHeap(), 0, object); 2011 return hr; 2012 } 2013 2014 TRACE("Created pixel shader %p.\n", object); 2015 *shader = (IDirect3DPixelShader9 *)object; 2016 2017 return D3D_OK; 2018 } 2019 1690 2020 static HRESULT WINAPI IDirect3DDevice9Impl_DrawRectPatch(LPDIRECT3DDEVICE9EX iface, UINT Handle, CONST float* pNumSegs, CONST D3DRECTPATCH_INFO* pRectPatchInfo) { 1691 2021 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; … … 1693 2023 TRACE("(%p) Relay\n", This); 1694 2024 1695 EnterCriticalSection(&d3d9_cs);2025 wined3d_mutex_lock(); 1696 2026 hr = IWineD3DDevice_DrawRectPatch(This->WineD3DDevice, Handle, pNumSegs, (CONST WINED3DRECTPATCH_INFO *)pRectPatchInfo); 1697 LeaveCriticalSection(&d3d9_cs); 2027 wined3d_mutex_unlock(); 2028 1698 2029 return hr; 1699 2030 } … … 1704 2035 TRACE("(%p) Relay\n", This); 1705 2036 1706 EnterCriticalSection(&d3d9_cs);2037 wined3d_mutex_lock(); 1707 2038 hr = IWineD3DDevice_DrawTriPatch(This->WineD3DDevice, Handle, pNumSegs, (CONST WINED3DTRIPATCH_INFO *)pTriPatchInfo); 1708 LeaveCriticalSection(&d3d9_cs); 2039 wined3d_mutex_unlock(); 2040 1709 2041 return hr; 1710 2042 } … … 1715 2047 TRACE("(%p) Relay\n", This); 1716 2048 1717 EnterCriticalSection(&d3d9_cs);2049 wined3d_mutex_lock(); 1718 2050 hr = IWineD3DDevice_DeletePatch(This->WineD3DDevice, Handle); 1719 LeaveCriticalSection(&d3d9_cs); 2051 wined3d_mutex_unlock(); 2052 1720 2053 return hr; 1721 2054 } … … 1953 2286 }; 1954 2287 1955 ULONG WINAPI D3D9CB_DestroySurface(IWineD3DSurface *pSurface) {1956 IDirect3DSurface9Impl* surfaceParent;1957 TRACE("(%p) call back\n", pSurface);1958 1959 IWineD3DSurface_GetParent(pSurface, (IUnknown **) &surfaceParent);1960 /* GetParent's AddRef was forwarded to an object in destruction.1961 * Releasing it here again would cause an endless recursion. */1962 surfaceParent->forwardReference = NULL;1963 return IDirect3DSurface9_Release((IDirect3DSurface9*) surfaceParent);1964 }1965 1966 2288 /* IWineD3DDeviceParent IUnknown methods */ 1967 2289 … … 2023 2345 2024 2346 *surface = d3d_surface->wineD3DSurface; 2347 IWineD3DSurface_AddRef(*surface); 2348 2025 2349 d3d_surface->container = superior; 2026 2350 IDirect3DDevice9Ex_Release(d3d_surface->parentDevice); 2027 2351 d3d_surface->parentDevice = NULL; 2352 2353 IDirect3DSurface9_Release((IDirect3DSurface9 *)d3d_surface); 2028 2354 d3d_surface->forwardReference = superior; 2029 2355 … … 2053 2379 2054 2380 *surface = d3d_surface->wineD3DSurface; 2381 IWineD3DSurface_AddRef(*surface); 2382 2055 2383 d3d_surface->container = superior; 2056 d3d_surface->isImplicit = TRUE;2057 2384 /* Implicit surfaces are created with an refcount of 0 */ 2058 2385 IDirect3DSurface9_Release((IDirect3DSurface9 *)d3d_surface); … … 2083 2410 2084 2411 *surface = d3d_surface->wineD3DSurface; 2412 IWineD3DSurface_AddRef(*surface); 2085 2413 d3d_surface->container = (IUnknown *)This; 2086 d3d_surface->isImplicit = TRUE;2087 2414 /* Implicit surfaces are created with an refcount of 0 */ 2088 2415 IDirect3DSurface9_Release((IDirect3DSurface9 *)d3d_surface); … … 2111 2438 } 2112 2439 2113 object->lpVtbl = &Direct3DVolume9_Vtbl; 2114 object->ref = 1; 2115 hr = IWineD3DDevice_CreateVolume(This->WineD3DDevice, width, height, depth, usage & WINED3DUSAGE_MASK, 2116 format, pool, &object->wineD3DVolume, (IUnknown *)object); 2440 hr = volume_init(object, This, width, height, depth, usage, format, pool); 2117 2441 if (FAILED(hr)) 2118 2442 { 2119 ERR("(%p) CreateVolume failed, returning %#x\n", iface, hr);2443 WARN("Failed to initialize volume, hr %#x.\n", hr); 2120 2444 HeapFree(GetProcessHeap(), 0, object); 2121 *volume = NULL;2122 2445 return hr; 2123 2446 } 2124 2447 2125 2448 *volume = object->wineD3DVolume; 2449 IWineD3DVolume_AddRef(*volume); 2450 IDirect3DVolume9_Release((IDirect3DVolume9 *)object); 2451 2126 2452 object->container = superior; 2127 2453 object->forwardReference = superior; 2128 2454 2129 TRACE("(%p) Created volume %p\n", iface, *volume);2455 TRACE("(%p) Created volume %p\n", iface, object); 2130 2456 2131 2457 return hr; -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/directx.c
r22496 r23571 79 79 80 80 if (ref == 0) { 81 EnterCriticalSection(&d3d9_cs);81 wined3d_mutex_lock(); 82 82 IWineD3D_Release(This->WineD3D); 83 LeaveCriticalSection(&d3d9_cs); 83 wined3d_mutex_unlock(); 84 84 85 HeapFree(GetProcessHeap(), 0, This); 85 86 } … … 94 95 TRACE("(%p)->(%p)\n", This, pInitializeFunction); 95 96 96 EnterCriticalSection(&d3d9_cs);97 wined3d_mutex_lock(); 97 98 hr = IWineD3D_RegisterSoftwareDevice(This->WineD3D, pInitializeFunction); 98 LeaveCriticalSection(&d3d9_cs); 99 wined3d_mutex_unlock(); 100 99 101 return hr; 100 102 } … … 105 107 TRACE("%p\n", This); 106 108 107 EnterCriticalSection(&d3d9_cs);109 wined3d_mutex_lock(); 108 110 hr = IWineD3D_GetAdapterCount(This->WineD3D); 109 LeaveCriticalSection(&d3d9_cs); 111 wined3d_mutex_unlock(); 112 110 113 return hr; 111 114 } … … 123 126 adapter_id.device_name_size = sizeof(pIdentifier->DeviceName); 124 127 125 EnterCriticalSection(&d3d9_cs);128 wined3d_mutex_lock(); 126 129 hr = IWineD3D_GetAdapterIdentifier(This->WineD3D, Adapter, Flags, &adapter_id); 127 LeaveCriticalSection(&d3d9_cs);130 wined3d_mutex_unlock(); 128 131 129 132 pIdentifier->DriverVersion = adapter_id.driver_version; … … 148 151 } 149 152 150 EnterCriticalSection(&d3d9_cs);153 wined3d_mutex_lock(); 151 154 hr = IWineD3D_GetAdapterModeCount(This->WineD3D, Adapter, wined3dformat_from_d3dformat(Format)); 152 LeaveCriticalSection(&d3d9_cs); 155 wined3d_mutex_unlock(); 156 153 157 return hr; 154 158 } … … 163 167 return D3DERR_INVALIDCALL; 164 168 165 EnterCriticalSection(&d3d9_cs);169 wined3d_mutex_lock(); 166 170 hr = IWineD3D_EnumAdapterModes(This->WineD3D, Adapter, wined3dformat_from_d3dformat(Format), 167 171 Mode, (WINED3DDISPLAYMODE *) pMode); 168 LeaveCriticalSection(&d3d9_cs);172 wined3d_mutex_unlock(); 169 173 170 174 if (SUCCEEDED(hr)) pMode->Format = d3dformat_from_wined3dformat(pMode->Format); … … 177 181 HRESULT hr; 178 182 179 EnterCriticalSection(&d3d9_cs);183 wined3d_mutex_lock(); 180 184 hr = IWineD3D_GetAdapterDisplayMode(This->WineD3D, Adapter, (WINED3DDISPLAYMODE *) pMode); 181 LeaveCriticalSection(&d3d9_cs);185 wined3d_mutex_unlock(); 182 186 183 187 if (SUCCEEDED(hr)) pMode->Format = d3dformat_from_wined3dformat(pMode->Format); … … 186 190 } 187 191 188 static HRESULT WINAPI IDirect3D9Impl_CheckDeviceType( LPDIRECT3D9EX iface,189 UINT Adapter, D3DDEVTYPE CheckType, D3DFORMAT DisplayFormat, 190 D3DFORMAT BackBufferFormat, BOOL Windowed){192 static HRESULT WINAPI IDirect3D9Impl_CheckDeviceType(IDirect3D9Ex *iface, UINT Adapter, 193 D3DDEVTYPE CheckType, D3DFORMAT DisplayFormat, D3DFORMAT BackBufferFormat, BOOL Windowed) 194 { 191 195 IDirect3D9Impl *This = (IDirect3D9Impl *)iface; 192 196 HRESULT hr; … … 194 198 BackBufferFormat, Windowed ? "true" : "false"); 195 199 196 EnterCriticalSection(&d3d9_cs);200 wined3d_mutex_lock(); 197 201 hr = IWineD3D_CheckDeviceType(This->WineD3D, Adapter, CheckType, wined3dformat_from_d3dformat(DisplayFormat), 198 202 wined3dformat_from_d3dformat(BackBufferFormat), Windowed); 199 LeaveCriticalSection(&d3d9_cs); 200 return hr; 201 } 202 203 static HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormat(LPDIRECT3D9EX iface, 204 UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, 205 DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat) { 203 wined3d_mutex_unlock(); 204 205 return hr; 206 } 207 208 static HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormat(IDirect3D9Ex *iface, UINT Adapter, D3DDEVTYPE DeviceType, 209 D3DFORMAT AdapterFormat, DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat) 210 { 206 211 IDirect3D9Impl *This = (IDirect3D9Impl *)iface; 207 212 HRESULT hr; … … 232 237 } 233 238 234 EnterCriticalSection(&d3d9_cs);239 wined3d_mutex_lock(); 235 240 hr = IWineD3D_CheckDeviceFormat(This->WineD3D, Adapter, DeviceType, wined3dformat_from_d3dformat(AdapterFormat), 236 241 Usage, WineD3DRType, wined3dformat_from_d3dformat(CheckFormat), SURFACE_OPENGL); 237 LeaveCriticalSection(&d3d9_cs); 238 return hr; 239 } 240 241 static HRESULT WINAPI IDirect3D9Impl_CheckDeviceMultiSampleType(LPDIRECT3D9EX iface, 242 UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat, 243 BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType, DWORD* pQualityLevels) { 242 wined3d_mutex_unlock(); 243 244 return hr; 245 } 246 247 static HRESULT WINAPI IDirect3D9Impl_CheckDeviceMultiSampleType(IDirect3D9Ex *iface, UINT Adapter, 248 D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat, BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType, 249 DWORD *pQualityLevels) 250 { 244 251 IDirect3D9Impl *This = (IDirect3D9Impl *)iface; 245 252 HRESULT hr; 246 253 TRACE("%p\n", This); 247 254 248 EnterCriticalSection(&d3d9_cs);255 wined3d_mutex_lock(); 249 256 hr = IWineD3D_CheckDeviceMultiSampleType(This->WineD3D, Adapter, DeviceType, 250 257 wined3dformat_from_d3dformat(SurfaceFormat), Windowed, MultiSampleType, pQualityLevels); 251 LeaveCriticalSection(&d3d9_cs); 252 return hr; 253 } 254 255 static HRESULT WINAPI IDirect3D9Impl_CheckDepthStencilMatch(LPDIRECT3D9EX iface, 256 UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, 257 D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat) { 258 wined3d_mutex_unlock(); 259 260 return hr; 261 } 262 263 static HRESULT WINAPI IDirect3D9Impl_CheckDepthStencilMatch(IDirect3D9Ex *iface, UINT Adapter, 264 D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat) 265 { 258 266 IDirect3D9Impl *This = (IDirect3D9Impl *)iface; 259 267 HRESULT hr; 260 268 TRACE("%p\n", This); 261 269 262 EnterCriticalSection(&d3d9_cs);270 wined3d_mutex_lock(); 263 271 hr = IWineD3D_CheckDepthStencilMatch(This->WineD3D, Adapter, DeviceType, 264 272 wined3dformat_from_d3dformat(AdapterFormat), wined3dformat_from_d3dformat(RenderTargetFormat), 265 273 wined3dformat_from_d3dformat(DepthStencilFormat)); 266 LeaveCriticalSection(&d3d9_cs); 274 wined3d_mutex_unlock(); 275 267 276 return hr; 268 277 } … … 273 282 TRACE("%p\n", This); 274 283 275 EnterCriticalSection(&d3d9_cs);284 wined3d_mutex_lock(); 276 285 hr = IWineD3D_CheckDeviceFormatConversion(This->WineD3D, Adapter, DeviceType, 277 286 wined3dformat_from_d3dformat(SourceFormat), wined3dformat_from_d3dformat(TargetFormat)); 278 LeaveCriticalSection(&d3d9_cs); 287 wined3d_mutex_unlock(); 288 279 289 return hr; 280 290 } … … 337 347 338 348 pCaps->MaxVertexShaderConst = min(D3D9_MAX_VERTEX_SHADER_CONSTANTF, pCaps->MaxVertexShaderConst); 349 pCaps->NumSimultaneousRTs = min(D3D9_MAX_SIMULTANEOUS_RENDERTARGETS, pCaps->NumSimultaneousRTs); 339 350 } 340 351 … … 354 365 } 355 366 memset(pCaps, 0, sizeof(*pCaps)); 356 EnterCriticalSection(&d3d9_cs); 367 368 wined3d_mutex_lock(); 357 369 hrc = IWineD3D_GetDeviceCaps(This->WineD3D, Adapter, DeviceType, pWineCaps); 358 LeaveCriticalSection(&d3d9_cs); 370 wined3d_mutex_unlock(); 371 359 372 WINECAPSTOD3D9CAPS(pCaps, pWineCaps) 360 373 HeapFree(GetProcessHeap(), 0, pWineCaps); … … 374 387 TRACE("%p\n", This); 375 388 376 EnterCriticalSection(&d3d9_cs);389 wined3d_mutex_lock(); 377 390 ret = IWineD3D_GetAdapterMonitor(This->WineD3D, Adapter); 378 LeaveCriticalSection(&d3d9_cs); 391 wined3d_mutex_unlock(); 392 379 393 return ret; 380 }381 382 ULONG WINAPI D3D9CB_DestroyRenderTarget(IWineD3DSurface *pSurface) {383 IDirect3DSurface9Impl* surfaceParent;384 TRACE("(%p) call back\n", pSurface);385 386 IWineD3DSurface_GetParent(pSurface, (IUnknown **) &surfaceParent);387 surfaceParent->isImplicit = FALSE;388 /* Surface had refcount of 0 GetParent addrefed to 1, so 1 Release is enough */389 return IDirect3DSurface9_Release((IDirect3DSurface9*) surfaceParent);390 394 } 391 395 … … 398 402 /* Swap chain had refcount of 0 GetParent addrefed to 1, so 1 Release is enough */ 399 403 return IDirect3DSwapChain9_Release((IDirect3DSwapChain9*) swapChainParent); 400 }401 402 ULONG WINAPI D3D9CB_DestroyDepthStencilSurface(IWineD3DSurface *pSurface) {403 IDirect3DSurface9Impl* surfaceParent;404 TRACE("(%p) call back\n", pSurface);405 406 IWineD3DSurface_GetParent(pSurface, (IUnknown **) &surfaceParent);407 surfaceParent->isImplicit = FALSE;408 /* Surface had refcount of 0 GetParent addrefed to 1, so 1 Release is enough */409 return IDirect3DSurface9_Release((IDirect3DSurface9*) surfaceParent);410 404 } 411 405 … … 442 436 443 437 /* Allocate an associated WineD3DDevice object */ 444 EnterCriticalSection(&d3d9_cs);438 wined3d_mutex_lock(); 445 439 hr = IWineD3D_CreateDevice(This->WineD3D, Adapter, DeviceType, hFocusWindow, BehaviourFlags, 446 440 (IUnknown *)object, (IWineD3DDeviceParent *)&object->device_parent_vtbl, &object->WineD3DDevice); … … 448 442 HeapFree(GetProcessHeap(), 0, object); 449 443 *ppReturnedDeviceInterface = NULL; 450 LeaveCriticalSection(&d3d9_cs); 444 wined3d_mutex_unlock(); 445 451 446 return hr; 452 447 } … … 516 511 */ 517 512 object->convertedDecls = HeapAlloc(GetProcessHeap(), 0, 0); 518 LeaveCriticalSection(&d3d9_cs);513 wined3d_mutex_unlock(); 519 514 520 515 return hr; -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/indexbuffer.c
r19678 r23571 57 57 TRACE("(%p) : AddRef from %d\n", This, ref - 1); 58 58 59 if (ref == 1) 60 { 61 IDirect3DDevice9Ex_AddRef(This->parentDevice); 62 wined3d_mutex_lock(); 63 IWineD3DBuffer_AddRef(This->wineD3DIndexBuffer); 64 wined3d_mutex_unlock(); 65 } 66 59 67 return ref; 60 68 } … … 67 75 68 76 if (ref == 0) { 69 EnterCriticalSection(&d3d9_cs); 77 IDirect3DDevice9Ex_Release(This->parentDevice); 78 wined3d_mutex_lock(); 70 79 IWineD3DBuffer_Release(This->wineD3DIndexBuffer); 71 LeaveCriticalSection(&d3d9_cs); 72 IDirect3DDevice9Ex_Release(This->parentDevice); 73 HeapFree(GetProcessHeap(), 0, This); 80 wined3d_mutex_unlock(); 74 81 } 75 82 return ref; … … 83 90 TRACE("(%p) Relay\n", This); 84 91 85 EnterCriticalSection(&d3d9_cs);92 wined3d_mutex_lock(); 86 93 hr = IWineD3DBuffer_GetDevice(This->wineD3DIndexBuffer, &wined3d_device); 87 94 if (SUCCEEDED(hr)) … … 90 97 IWineD3DDevice_Release(wined3d_device); 91 98 } 92 LeaveCriticalSection(&d3d9_cs); 99 wined3d_mutex_unlock(); 100 93 101 return hr; 94 102 } … … 99 107 TRACE("(%p) Relay\n", This); 100 108 101 EnterCriticalSection(&d3d9_cs);109 wined3d_mutex_lock(); 102 110 hr = IWineD3DBuffer_SetPrivateData(This->wineD3DIndexBuffer, refguid, pData, SizeOfData, Flags); 103 LeaveCriticalSection(&d3d9_cs); 111 wined3d_mutex_unlock(); 112 104 113 return hr; 105 114 } … … 110 119 TRACE("(%p) Relay\n", This); 111 120 112 EnterCriticalSection(&d3d9_cs);121 wined3d_mutex_lock(); 113 122 hr = IWineD3DBuffer_GetPrivateData(This->wineD3DIndexBuffer, refguid, pData, pSizeOfData); 114 LeaveCriticalSection(&d3d9_cs); 123 wined3d_mutex_unlock(); 124 115 125 return hr; 116 126 } … … 121 131 TRACE("(%p) Relay\n", This); 122 132 123 EnterCriticalSection(&d3d9_cs);133 wined3d_mutex_lock(); 124 134 hr = IWineD3DBuffer_FreePrivateData(This->wineD3DIndexBuffer, refguid); 125 LeaveCriticalSection(&d3d9_cs); 135 wined3d_mutex_unlock(); 136 126 137 return hr; 127 138 } … … 132 143 TRACE("(%p) Relay\n", This); 133 144 134 EnterCriticalSection(&d3d9_cs);145 wined3d_mutex_lock(); 135 146 ret = IWineD3DBuffer_SetPriority(This->wineD3DIndexBuffer, PriorityNew); 136 LeaveCriticalSection(&d3d9_cs); 147 wined3d_mutex_unlock(); 148 137 149 return ret; 138 150 } … … 143 155 TRACE("(%p) Relay\n", This); 144 156 145 EnterCriticalSection(&d3d9_cs);157 wined3d_mutex_lock(); 146 158 ret = IWineD3DBuffer_GetPriority(This->wineD3DIndexBuffer); 147 LeaveCriticalSection(&d3d9_cs); 159 wined3d_mutex_unlock(); 160 148 161 return ret; 149 162 } … … 153 166 TRACE("(%p) Relay\n", This); 154 167 155 EnterCriticalSection(&d3d9_cs);168 wined3d_mutex_lock(); 156 169 IWineD3DBuffer_PreLoad(This->wineD3DIndexBuffer); 157 LeaveCriticalSection(&d3d9_cs);170 wined3d_mutex_unlock(); 158 171 } 159 172 … … 171 184 TRACE("(%p) Relay\n", This); 172 185 173 EnterCriticalSection(&d3d9_cs);186 wined3d_mutex_lock(); 174 187 hr = IWineD3DBuffer_Map(This->wineD3DIndexBuffer, OffsetToLock, SizeToLock, (BYTE **)ppbData, Flags); 175 LeaveCriticalSection(&d3d9_cs); 188 wined3d_mutex_unlock(); 189 176 190 return hr; 177 191 } … … 182 196 TRACE("(%p) Relay\n", This); 183 197 184 EnterCriticalSection(&d3d9_cs);198 wined3d_mutex_lock(); 185 199 hr = IWineD3DBuffer_Unmap(This->wineD3DIndexBuffer); 186 LeaveCriticalSection(&d3d9_cs); 200 wined3d_mutex_unlock(); 201 187 202 return hr; 188 203 } … … 194 209 TRACE("(%p) Relay\n", This); 195 210 196 EnterCriticalSection(&d3d9_cs);211 wined3d_mutex_lock(); 197 212 hr = IWineD3DBuffer_GetDesc(This->wineD3DIndexBuffer, &desc); 198 LeaveCriticalSection(&d3d9_cs);213 wined3d_mutex_unlock(); 199 214 200 215 if (SUCCEEDED(hr)) { … … 231 246 }; 232 247 233 234 /* IDirect3DDevice9 IDirect3DIndexBuffer9 Methods follow: */ 235 HRESULT WINAPI IDirect3DDevice9Impl_CreateIndexBuffer(LPDIRECT3DDEVICE9EX iface, 236 UINT Length, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, 237 IDirect3DIndexBuffer9** ppIndexBuffer, HANDLE* pSharedHandle) { 238 239 IDirect3DIndexBuffer9Impl *object; 240 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 241 HRESULT hrc = D3D_OK; 242 243 TRACE("(%p) Relay\n", This); 244 /* Allocate the storage for the device */ 245 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); 246 if (NULL == object) { 247 FIXME("Allocation of memory failed, returning D3DERR_OUTOFVIDEOMEMORY\n"); 248 return D3DERR_OUTOFVIDEOMEMORY; 249 } 250 251 object->lpVtbl = &Direct3DIndexBuffer9_Vtbl; 252 object->ref = 1; 253 object->format = wined3dformat_from_d3dformat(Format); 254 TRACE("Calling wined3d create index buffer\n"); 255 EnterCriticalSection(&d3d9_cs); 256 hrc = IWineD3DDevice_CreateIndexBuffer(This->WineD3DDevice, Length, Usage & WINED3DUSAGE_MASK, 257 (WINED3DPOOL)Pool, &object->wineD3DIndexBuffer, (IUnknown *)object); 258 LeaveCriticalSection(&d3d9_cs); 259 if (hrc != D3D_OK) { 260 261 /* free up object */ 262 FIXME("(%p) call to IWineD3DDevice_CreateIndexBuffer failed\n", This); 263 HeapFree(GetProcessHeap(), 0, object); 264 } else { 265 IDirect3DDevice9Ex_AddRef(iface); 266 object->parentDevice = iface; 267 *ppIndexBuffer = (LPDIRECT3DINDEXBUFFER9) object; 268 TRACE("(%p) : Created index buffer %p\n", This, object); 269 } 270 return hrc; 271 } 248 static void STDMETHODCALLTYPE d3d9_indexbuffer_wined3d_object_destroyed(void *parent) 249 { 250 HeapFree(GetProcessHeap(), 0, parent); 251 } 252 253 static const struct wined3d_parent_ops d3d9_indexbuffer_wined3d_parent_ops = 254 { 255 d3d9_indexbuffer_wined3d_object_destroyed, 256 }; 257 258 HRESULT indexbuffer_init(IDirect3DIndexBuffer9Impl *buffer, IDirect3DDevice9Impl *device, 259 UINT size, DWORD usage, D3DFORMAT format, D3DPOOL pool) 260 { 261 HRESULT hr; 262 263 buffer->lpVtbl = &Direct3DIndexBuffer9_Vtbl; 264 buffer->ref = 1; 265 buffer->format = wined3dformat_from_d3dformat(format); 266 267 wined3d_mutex_lock(); 268 hr = IWineD3DDevice_CreateIndexBuffer(device->WineD3DDevice, size, 269 usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool, &buffer->wineD3DIndexBuffer, 270 (IUnknown *)buffer, &d3d9_indexbuffer_wined3d_parent_ops); 271 wined3d_mutex_unlock(); 272 if (FAILED(hr)) 273 { 274 WARN("Failed to create wined3d buffer, hr %#x.\n", hr); 275 return hr; 276 } 277 278 buffer->parentDevice = (IDirect3DDevice9Ex *)device; 279 IDirect3DDevice9Ex_AddRef(buffer->parentDevice); 280 281 return D3D_OK; 282 } -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/pixelshader.c
r20612 r23571 56 56 TRACE("(%p) : AddRef from %d\n", This, ref - 1); 57 57 58 if (ref == 1) 59 { 60 IDirect3DDevice9Ex_AddRef(This->parentDevice); 61 wined3d_mutex_lock(); 62 IWineD3DPixelShader_AddRef(This->wineD3DPixelShader); 63 wined3d_mutex_unlock(); 64 } 65 58 66 return ref; 59 67 } … … 66 74 67 75 if (ref == 0) { 68 EnterCriticalSection(&d3d9_cs); 76 IDirect3DDevice9Ex_Release(This->parentDevice); 77 wined3d_mutex_lock(); 69 78 IWineD3DPixelShader_Release(This->wineD3DPixelShader); 70 LeaveCriticalSection(&d3d9_cs); 71 IDirect3DDevice9Ex_Release(This->parentDevice); 72 HeapFree(GetProcessHeap(), 0, This); 79 wined3d_mutex_unlock(); 73 80 } 74 81 return ref; … … 82 89 TRACE("(%p) : Relay\n", This); 83 90 84 EnterCriticalSection(&d3d9_cs);91 wined3d_mutex_lock(); 85 92 IWineD3DPixelShader_GetDevice(This->wineD3DPixelShader, &myDevice); 86 93 IWineD3DDevice_GetParent(myDevice, (IUnknown **)ppDevice); 87 94 IWineD3DDevice_Release(myDevice); 88 LeaveCriticalSection(&d3d9_cs); 95 wined3d_mutex_unlock(); 96 89 97 TRACE("(%p) returning (%p)\n", This, *ppDevice); 90 98 return D3D_OK; … … 96 104 TRACE("(%p) Relay\n", This); 97 105 98 EnterCriticalSection(&d3d9_cs);106 wined3d_mutex_lock(); 99 107 hr = IWineD3DPixelShader_GetFunction(This->wineD3DPixelShader, pData, pSizeOfData); 100 LeaveCriticalSection(&d3d9_cs); 108 wined3d_mutex_unlock(); 109 101 110 return hr; 102 111 } … … 114 123 }; 115 124 116 117 /* IDirect3DDevice9 IDirect3DPixelShader9 Methods follow: */ 118 HRESULT WINAPI IDirect3DDevice9Impl_CreatePixelShader(LPDIRECT3DDEVICE9EX iface, CONST DWORD* pFunction, IDirect3DPixelShader9** ppShader) { 119 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 120 IDirect3DPixelShader9Impl *object; 125 static void STDMETHODCALLTYPE d3d9_pixelshader_wined3d_object_destroyed(void *parent) 126 { 127 HeapFree(GetProcessHeap(), 0, parent); 128 } 129 130 static const struct wined3d_parent_ops d3d9_pixelshader_wined3d_parent_ops = 131 { 132 d3d9_pixelshader_wined3d_object_destroyed, 133 }; 134 135 HRESULT pixelshader_init(IDirect3DPixelShader9Impl *shader, IDirect3DDevice9Impl *device, const DWORD *byte_code) 136 { 137 HRESULT hr; 138 139 shader->ref = 1; 140 shader->lpVtbl = &Direct3DPixelShader9_Vtbl; 141 142 wined3d_mutex_lock(); 143 hr = IWineD3DDevice_CreatePixelShader(device->WineD3DDevice, byte_code, 144 NULL, &shader->wineD3DPixelShader, (IUnknown *)shader, 145 &d3d9_pixelshader_wined3d_parent_ops); 146 wined3d_mutex_unlock(); 147 if (FAILED(hr)) 148 { 149 WARN("Failed to created wined3d pixel shader, hr %#x.\n", hr); 150 return hr; 151 } 152 153 shader->parentDevice = (IDirect3DDevice9Ex *)device; 154 IDirect3DDevice9Ex_AddRef(shader->parentDevice); 155 156 return D3D_OK; 157 } 158 159 HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShader(LPDIRECT3DDEVICE9EX iface, IDirect3DPixelShader9* pShader) { 160 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 161 IDirect3DPixelShader9Impl *shader = (IDirect3DPixelShader9Impl *)pShader; 162 TRACE("(%p) Relay\n", This); 163 164 wined3d_mutex_lock(); 165 IWineD3DDevice_SetPixelShader(This->WineD3DDevice, shader == NULL ? NULL :shader->wineD3DPixelShader); 166 wined3d_mutex_unlock(); 167 168 return D3D_OK; 169 } 170 171 HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(LPDIRECT3DDEVICE9EX iface, IDirect3DPixelShader9** ppShader) { 172 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 173 IWineD3DPixelShader *object; 174 121 175 HRESULT hrc = D3D_OK; 122 123 TRACE("(%p) Relay\n", This); 124 176 TRACE("(%p) Relay\n", This); 125 177 if (ppShader == NULL) { 126 178 TRACE("(%p) Invalid call\n", This); … … 128 180 } 129 181 130 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); 131 132 if (NULL == object) { 133 FIXME("Allocation of memory failed, returning D3DERR_OUTOFVIDEOMEMORY\n"); 134 return E_OUTOFMEMORY; 135 } 136 137 object->ref = 1; 138 object->lpVtbl = &Direct3DPixelShader9_Vtbl; 139 EnterCriticalSection(&d3d9_cs); 140 hrc = IWineD3DDevice_CreatePixelShader(This->WineD3DDevice, pFunction, NULL, 141 &object->wineD3DPixelShader, (IUnknown *)object); 142 LeaveCriticalSection(&d3d9_cs); 143 if (hrc != D3D_OK) { 144 145 /* free up object */ 146 FIXME("(%p) call to IWineD3DDevice_CreatePixelShader failed\n", This); 147 HeapFree(GetProcessHeap(), 0 , object); 148 } else { 149 IDirect3DDevice9Ex_AddRef(iface); 150 object->parentDevice = iface; 151 *ppShader = (IDirect3DPixelShader9*) object; 152 TRACE("(%p) : Created pixel shader %p\n", This, object); 153 } 154 155 TRACE("(%p) : returning %p\n", This, *ppShader); 156 return hrc; 157 } 158 159 HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShader(LPDIRECT3DDEVICE9EX iface, IDirect3DPixelShader9* pShader) { 160 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 161 IDirect3DPixelShader9Impl *shader = (IDirect3DPixelShader9Impl *)pShader; 162 TRACE("(%p) Relay\n", This); 163 164 EnterCriticalSection(&d3d9_cs); 165 IWineD3DDevice_SetPixelShader(This->WineD3DDevice, shader == NULL ? NULL :shader->wineD3DPixelShader); 166 LeaveCriticalSection(&d3d9_cs); 167 return D3D_OK; 168 } 169 170 HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(LPDIRECT3DDEVICE9EX iface, IDirect3DPixelShader9** ppShader) { 171 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 172 IWineD3DPixelShader *object; 173 174 HRESULT hrc = D3D_OK; 175 TRACE("(%p) Relay\n", This); 176 if (ppShader == NULL) { 177 TRACE("(%p) Invalid call\n", This); 178 return D3DERR_INVALIDCALL; 179 } 180 181 EnterCriticalSection(&d3d9_cs); 182 wined3d_mutex_lock(); 182 183 hrc = IWineD3DDevice_GetPixelShader(This->WineD3DDevice, &object); 183 184 if (SUCCEEDED(hrc)) … … 197 198 WARN("(%p) : Call to IWineD3DDevice_GetPixelShader failed %u (device %p)\n", This, hrc, This->WineD3DDevice); 198 199 } 199 LeaveCriticalSection(&d3d9_cs);200 wined3d_mutex_unlock(); 200 201 201 202 TRACE("(%p) : returning %p\n", This, *ppShader); … … 206 207 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 207 208 HRESULT hr; 208 TRACE("(%p) Relay\n", This); 209 210 EnterCriticalSection(&d3d9_cs);209 TRACE("(%p) Relay\n", This); 210 211 wined3d_mutex_lock(); 211 212 hr = IWineD3DDevice_SetPixelShaderConstantF(This->WineD3DDevice, Register, pConstantData, Vector4fCount); 212 LeaveCriticalSection(&d3d9_cs); 213 wined3d_mutex_unlock(); 214 213 215 return hr; 214 216 } … … 220 222 TRACE("(%p) Relay\n", This); 221 223 222 EnterCriticalSection(&d3d9_cs);224 wined3d_mutex_lock(); 223 225 hr = IWineD3DDevice_GetPixelShaderConstantF(This->WineD3DDevice, Register, pConstantData, Vector4fCount); 224 LeaveCriticalSection(&d3d9_cs);226 wined3d_mutex_unlock(); 225 227 226 228 return hr; … … 232 234 TRACE("(%p) Relay\n", This); 233 235 234 EnterCriticalSection(&d3d9_cs);236 wined3d_mutex_lock(); 235 237 hr = IWineD3DDevice_SetPixelShaderConstantI(This->WineD3DDevice, Register, pConstantData, Vector4iCount); 236 LeaveCriticalSection(&d3d9_cs); 238 wined3d_mutex_unlock(); 239 237 240 return hr; 238 241 } … … 243 246 TRACE("(%p) Relay\n", This); 244 247 245 EnterCriticalSection(&d3d9_cs);248 wined3d_mutex_lock(); 246 249 hr = IWineD3DDevice_GetPixelShaderConstantI(This->WineD3DDevice, Register, pConstantData, Vector4iCount); 247 LeaveCriticalSection(&d3d9_cs); 250 wined3d_mutex_unlock(); 251 248 252 return hr; 249 253 } … … 254 258 TRACE("(%p) Relay\n", This); 255 259 256 EnterCriticalSection(&d3d9_cs);260 wined3d_mutex_lock(); 257 261 hr = IWineD3DDevice_SetPixelShaderConstantB(This->WineD3DDevice, Register, pConstantData, BoolCount); 258 LeaveCriticalSection(&d3d9_cs); 262 wined3d_mutex_unlock(); 263 259 264 return hr; 260 265 } … … 265 270 TRACE("(%p) Relay\n", This); 266 271 267 EnterCriticalSection(&d3d9_cs);272 wined3d_mutex_lock(); 268 273 hr = IWineD3DDevice_GetPixelShaderConstantB(This->WineD3DDevice, Register, pConstantData, BoolCount); 269 LeaveCriticalSection(&d3d9_cs); 270 return hr; 271 } 274 wined3d_mutex_unlock(); 275 276 return hr; 277 } -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/query.c
r19678 r23571 67 67 68 68 if (ref == 0) { 69 EnterCriticalSection(&d3d9_cs);69 wined3d_mutex_lock(); 70 70 IWineD3DQuery_Release(This->wineD3DQuery); 71 LeaveCriticalSection(&d3d9_cs); 71 wined3d_mutex_unlock(); 72 72 73 IDirect3DDevice9Ex_Release(This->parentDevice); 73 74 HeapFree(GetProcessHeap(), 0, This); … … 84 85 TRACE("(%p) Relay\n", This); 85 86 86 EnterCriticalSection(&d3d9_cs);87 wined3d_mutex_lock(); 87 88 hr = IWineD3DQuery_GetDevice(This->wineD3DQuery, &pDevice); 88 89 if(hr != D3D_OK){ … … 92 93 IWineD3DDevice_Release(pDevice); 93 94 } 94 LeaveCriticalSection(&d3d9_cs); 95 wined3d_mutex_unlock(); 96 95 97 return hr; 96 98 } … … 101 103 TRACE("(%p) Relay\n", This); 102 104 103 EnterCriticalSection(&d3d9_cs);105 wined3d_mutex_lock(); 104 106 hr = IWineD3DQuery_GetType(This->wineD3DQuery); 105 LeaveCriticalSection(&d3d9_cs); 107 wined3d_mutex_unlock(); 108 106 109 return hr; 107 110 } … … 112 115 TRACE("(%p) Relay\n", This); 113 116 114 EnterCriticalSection(&d3d9_cs);117 wined3d_mutex_lock(); 115 118 ret = IWineD3DQuery_GetDataSize(This->wineD3DQuery); 116 LeaveCriticalSection(&d3d9_cs); 119 wined3d_mutex_unlock(); 120 117 121 return ret; 118 122 } … … 123 127 TRACE("(%p) Relay\n", This); 124 128 125 EnterCriticalSection(&d3d9_cs);129 wined3d_mutex_lock(); 126 130 hr = IWineD3DQuery_Issue(This->wineD3DQuery, dwIssueFlags); 127 LeaveCriticalSection(&d3d9_cs); 131 wined3d_mutex_unlock(); 132 128 133 return hr; 129 134 } … … 134 139 TRACE("(%p) Relay\n", This); 135 140 136 EnterCriticalSection(&d3d9_cs);141 wined3d_mutex_lock(); 137 142 hr = IWineD3DQuery_GetData(This->wineD3DQuery, pData, dwSize, dwGetDataFlags); 138 LeaveCriticalSection(&d3d9_cs); 143 wined3d_mutex_unlock(); 144 139 145 return hr; 140 146 } … … 164 170 if (!ppQuery) 165 171 { 166 EnterCriticalSection(&d3d9_cs);172 wined3d_mutex_lock(); 167 173 hr = IWineD3DDevice_CreateQuery(This->WineD3DDevice, Type, NULL, NULL); 168 LeaveCriticalSection(&d3d9_cs); 174 wined3d_mutex_unlock(); 175 169 176 return hr; 170 177 } … … 179 186 object->lpVtbl = &Direct3DQuery9_Vtbl; 180 187 object->ref = 1; 181 EnterCriticalSection(&d3d9_cs); 188 189 wined3d_mutex_lock(); 182 190 hr = IWineD3DDevice_CreateQuery(This->WineD3DDevice, Type, &object->wineD3DQuery, (IUnknown *)object); 183 LeaveCriticalSection(&d3d9_cs);191 wined3d_mutex_unlock(); 184 192 185 193 if (FAILED(hr)) { -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/stateblock.c
r19678 r23571 67 67 68 68 if (ref == 0) { 69 EnterCriticalSection(&d3d9_cs);69 wined3d_mutex_lock(); 70 70 IWineD3DStateBlock_Release(This->wineD3DStateBlock); 71 LeaveCriticalSection(&d3d9_cs); 71 wined3d_mutex_unlock(); 72 72 73 IDirect3DDevice9Ex_Release(This->parentDevice); 73 74 HeapFree(GetProcessHeap(), 0, This); … … 83 84 TRACE("(%p) Relay\n", This); 84 85 85 EnterCriticalSection(&d3d9_cs);86 wined3d_mutex_lock(); 86 87 hr = IWineD3DStateBlock_GetDevice(This->wineD3DStateBlock, &wined3d_device); 87 88 if (SUCCEEDED(hr)) … … 90 91 IWineD3DDevice_Release(wined3d_device); 91 92 } 92 LeaveCriticalSection(&d3d9_cs); 93 wined3d_mutex_unlock(); 94 93 95 return hr; 94 96 } … … 97 99 IDirect3DStateBlock9Impl *This = (IDirect3DStateBlock9Impl *)iface; 98 100 HRESULT hr; 99 TRACE("(%p) Relay\n", This); 100 101 EnterCriticalSection(&d3d9_cs);101 TRACE("(%p) Relay\n", This); 102 103 wined3d_mutex_lock(); 102 104 hr = IWineD3DStateBlock_Capture(This->wineD3DStateBlock); 103 LeaveCriticalSection(&d3d9_cs); 105 wined3d_mutex_unlock(); 106 104 107 return hr; 105 108 } … … 110 113 TRACE("(%p) Relay\n", This); 111 114 112 EnterCriticalSection(&d3d9_cs);115 wined3d_mutex_lock(); 113 116 hr = IWineD3DStateBlock_Apply(This->wineD3DStateBlock); 114 LeaveCriticalSection(&d3d9_cs); 117 wined3d_mutex_unlock(); 118 115 119 return hr; 116 120 } … … 135 139 IDirect3DStateBlock9Impl* object; 136 140 HRESULT hrc = D3D_OK; 137 141 138 142 TRACE("(%p) Relay\n", This); 139 143 … … 143 147 return D3DERR_INVALIDCALL; 144 148 } 145 149 146 150 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DStateBlock9Impl)); 147 151 if (NULL == object) return E_OUTOFMEMORY; 148 152 object->lpVtbl = &Direct3DStateBlock9_Vtbl; 149 153 object->ref = 1; 150 151 EnterCriticalSection(&d3d9_cs);154 155 wined3d_mutex_lock(); 152 156 hrc = IWineD3DDevice_CreateStateBlock(This->WineD3DDevice, (WINED3DSTATEBLOCKTYPE)Type, &object->wineD3DStateBlock, (IUnknown*)object); 153 LeaveCriticalSection(&d3d9_cs); 157 wined3d_mutex_unlock(); 158 154 159 if(hrc != D3D_OK){ 155 160 FIXME("(%p) Call to IWineD3DDevice_CreateStateBlock failed.\n", This); … … 165 170 } 166 171 167 HRESULT WINAPI IDirect3DDevice9Impl_BeginStateBlock(LPDIRECT3DDEVICE9EX iface) { 168 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 169 HRESULT hr; 170 TRACE("(%p) Relay\n", This); 171 172 EnterCriticalSection(&d3d9_cs); 172 HRESULT WINAPI IDirect3DDevice9Impl_BeginStateBlock(IDirect3DDevice9Ex *iface) 173 { 174 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 175 HRESULT hr; 176 TRACE("(%p) Relay\n", This); 177 178 wined3d_mutex_lock(); 173 179 hr = IWineD3DDevice_BeginStateBlock(This->WineD3DDevice); 174 LeaveCriticalSection(&d3d9_cs); 175 return hr; 176 } 177 178 HRESULT WINAPI IDirect3DDevice9Impl_EndStateBlock(LPDIRECT3DDEVICE9EX iface, IDirect3DStateBlock9** ppSB) { 179 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 180 HRESULT hr; 181 IWineD3DStateBlock* wineD3DStateBlock; 182 IDirect3DStateBlock9Impl* object; 183 184 TRACE("(%p) Relay\n", This); 185 180 wined3d_mutex_unlock(); 181 182 return hr; 183 } 184 185 HRESULT WINAPI IDirect3DDevice9Impl_EndStateBlock(IDirect3DDevice9Ex *iface, IDirect3DStateBlock9 **ppSB) 186 { 187 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 188 IWineD3DStateBlock *wineD3DStateBlock; 189 IDirect3DStateBlock9Impl *object; 190 HRESULT hr; 191 192 TRACE("(%p) Relay\n", This); 193 186 194 /* Tell wineD3D to endstateblock before anything else (in case we run out 187 * of memory later and cause locking problems) 188 */ 189 EnterCriticalSection(&d3d9_cs); 195 * of memory later and cause locking problems) */ 196 wined3d_mutex_lock(); 190 197 hr=IWineD3DDevice_EndStateBlock(This->WineD3DDevice,&wineD3DStateBlock); 191 LeaveCriticalSection(&d3d9_cs); 192 if(hr!= D3D_OK){ 198 wined3d_mutex_unlock(); 199 200 if (hr!= D3D_OK) 201 { 193 202 WARN("IWineD3DDevice_EndStateBlock returned an error\n"); 194 203 return hr; 195 } 204 } 196 205 /* allocate a new IDirectD3DStateBlock */ 197 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY ,sizeof(IDirect3DStateBlock9Impl));206 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DStateBlock9Impl)); 198 207 if (!object) return E_OUTOFMEMORY; 199 208 object->ref = 1; -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/surface.c
r21731 r23571 63 63 /* No container, handle our own refcounting */ 64 64 ULONG ref = InterlockedIncrement(&This->ref); 65 if(ref == 1 && This->parentDevice) IDirect3DDevice9Ex_AddRef(This->parentDevice); 65 if (ref == 1) 66 { 67 if (This->parentDevice) IDirect3DDevice9Ex_AddRef(This->parentDevice); 68 wined3d_mutex_lock(); 69 IWineD3DSurface_AddRef(This->wineD3DSurface); 70 wined3d_mutex_unlock(); 71 } 66 72 TRACE("(%p) : AddRef from %d\n", This, ref - 1); 67 73 … … 87 93 if (ref == 0) { 88 94 if (This->parentDevice) IDirect3DDevice9Ex_Release(This->parentDevice); 89 if (!This->isImplicit) { 90 EnterCriticalSection(&d3d9_cs); 91 IWineD3DSurface_Release(This->wineD3DSurface); 92 LeaveCriticalSection(&d3d9_cs); 93 HeapFree(GetProcessHeap(), 0, This); 94 } 95 wined3d_mutex_lock(); 96 IWineD3DSurface_Release(This->wineD3DSurface); 97 wined3d_mutex_unlock(); 95 98 } 96 99 … … 106 109 TRACE("(%p)->(%p)\n", This, ppDevice); 107 110 108 EnterCriticalSection(&d3d9_cs);111 wined3d_mutex_lock(); 109 112 hr = IWineD3DSurface_GetDevice(This->wineD3DSurface, &wined3d_device); 110 113 if (SUCCEEDED(hr)) … … 113 116 IWineD3DDevice_Release(wined3d_device); 114 117 } 115 LeaveCriticalSection(&d3d9_cs); 118 wined3d_mutex_unlock(); 119 116 120 return hr; 117 121 } … … 122 126 TRACE("(%p) Relay\n", This); 123 127 124 EnterCriticalSection(&d3d9_cs);128 wined3d_mutex_lock(); 125 129 hr = IWineD3DSurface_SetPrivateData(This->wineD3DSurface, refguid, pData, SizeOfData, Flags); 126 LeaveCriticalSection(&d3d9_cs); 130 wined3d_mutex_unlock(); 131 127 132 return hr; 128 133 } … … 133 138 TRACE("(%p) Relay\n", This); 134 139 135 EnterCriticalSection(&d3d9_cs);140 wined3d_mutex_lock(); 136 141 hr = IWineD3DSurface_GetPrivateData(This->wineD3DSurface, refguid, pData, pSizeOfData); 137 LeaveCriticalSection(&d3d9_cs); 142 wined3d_mutex_unlock(); 143 138 144 return hr; 139 145 } … … 144 150 TRACE("(%p) Relay\n", This); 145 151 146 EnterCriticalSection(&d3d9_cs);152 wined3d_mutex_lock(); 147 153 hr = IWineD3DSurface_FreePrivateData(This->wineD3DSurface, refguid); 148 LeaveCriticalSection(&d3d9_cs); 154 wined3d_mutex_unlock(); 155 149 156 return hr; 150 157 } … … 155 162 TRACE("(%p) Relay\n", This); 156 163 157 EnterCriticalSection(&d3d9_cs);164 wined3d_mutex_lock(); 158 165 hr = IWineD3DSurface_SetPriority(This->wineD3DSurface, PriorityNew); 159 LeaveCriticalSection(&d3d9_cs); 166 wined3d_mutex_unlock(); 167 160 168 return hr; 161 169 } … … 166 174 TRACE("(%p) Relay\n", This); 167 175 168 EnterCriticalSection(&d3d9_cs);176 wined3d_mutex_lock(); 169 177 hr = IWineD3DSurface_GetPriority(This->wineD3DSurface); 170 LeaveCriticalSection(&d3d9_cs); 178 wined3d_mutex_unlock(); 179 171 180 return hr; 172 181 } … … 176 185 TRACE("(%p) Relay\n", This); 177 186 178 EnterCriticalSection(&d3d9_cs);187 wined3d_mutex_lock(); 179 188 IWineD3DSurface_PreLoad(This->wineD3DSurface); 180 LeaveCriticalSection(&d3d9_cs); 181 return ; 189 wined3d_mutex_unlock(); 182 190 } 183 191 … … 187 195 TRACE("(%p) Relay\n", This); 188 196 189 EnterCriticalSection(&d3d9_cs);197 wined3d_mutex_lock(); 190 198 ret = IWineD3DSurface_GetType(This->wineD3DSurface); 191 LeaveCriticalSection(&d3d9_cs); 199 wined3d_mutex_unlock(); 200 192 201 return ret; 193 202 } … … 219 228 TRACE("(%p) Relay\n", This); 220 229 221 EnterCriticalSection(&d3d9_cs);230 wined3d_mutex_lock(); 222 231 hr = IWineD3DSurface_GetDesc(This->wineD3DSurface, &wined3ddesc); 223 LeaveCriticalSection(&d3d9_cs);232 wined3d_mutex_unlock(); 224 233 225 234 if (SUCCEEDED(hr)) … … 243 252 TRACE("(%p) Relay\n", This); 244 253 245 EnterCriticalSection(&d3d9_cs);254 wined3d_mutex_lock(); 246 255 TRACE("(%p) calling IWineD3DSurface_LockRect %p %p %p %d\n", This, This->wineD3DSurface, pLockedRect, pRect, Flags); 247 256 hr = IWineD3DSurface_LockRect(This->wineD3DSurface, (WINED3DLOCKED_RECT *) pLockedRect, pRect, Flags); 248 LeaveCriticalSection(&d3d9_cs); 257 wined3d_mutex_unlock(); 258 249 259 return hr; 250 260 } … … 255 265 TRACE("(%p) Relay\n", This); 256 266 257 EnterCriticalSection(&d3d9_cs);267 wined3d_mutex_lock(); 258 268 hr = IWineD3DSurface_UnlockRect(This->wineD3DSurface); 259 LeaveCriticalSection(&d3d9_cs); 269 wined3d_mutex_unlock(); 270 260 271 switch(hr) 261 272 { … … 270 281 TRACE("(%p) Relay\n", This); 271 282 272 EnterCriticalSection(&d3d9_cs); 283 if(!This->getdc_supported) 284 { 285 WARN("Surface does not support GetDC, returning D3DERR_INVALIDCALL\n"); 286 /* Don't touch the DC */ 287 return D3DERR_INVALIDCALL; 288 } 289 290 wined3d_mutex_lock(); 273 291 hr = IWineD3DSurface_GetDC(This->wineD3DSurface, phdc); 274 LeaveCriticalSection(&d3d9_cs); 292 wined3d_mutex_unlock(); 293 275 294 return hr; 276 295 } … … 281 300 TRACE("(%p) Relay\n", This); 282 301 283 EnterCriticalSection(&d3d9_cs);302 wined3d_mutex_lock(); 284 303 hr = IWineD3DSurface_ReleaseDC(This->wineD3DSurface, hdc); 285 LeaveCriticalSection(&d3d9_cs); 304 wined3d_mutex_unlock(); 305 286 306 switch(hr) { 287 307 case WINEDDERR_NODC: return WINED3DERR_INVALIDCALL; … … 290 310 } 291 311 292 293 const IDirect3DSurface9Vtbl Direct3DSurface9_Vtbl = 312 static const IDirect3DSurface9Vtbl Direct3DSurface9_Vtbl = 294 313 { 295 314 /* IUnknown */ … … 314 333 IDirect3DSurface9Impl_ReleaseDC 315 334 }; 335 336 static void STDMETHODCALLTYPE surface_wined3d_object_destroyed(void *parent) 337 { 338 HeapFree(GetProcessHeap(), 0, parent); 339 } 340 341 static const struct wined3d_parent_ops d3d9_surface_wined3d_parent_ops = 342 { 343 surface_wined3d_object_destroyed, 344 }; 345 346 HRESULT surface_init(IDirect3DSurface9Impl *surface, IDirect3DDevice9Impl *device, 347 UINT width, UINT height, D3DFORMAT format, BOOL lockable, BOOL discard, UINT level, 348 DWORD usage, D3DPOOL pool, D3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality) 349 { 350 HRESULT hr; 351 352 surface->lpVtbl = &Direct3DSurface9_Vtbl; 353 surface->ref = 1; 354 355 switch (format) 356 { 357 case D3DFMT_A8R8G8B8: 358 case D3DFMT_X8R8G8B8: 359 case D3DFMT_R5G6B5: 360 case D3DFMT_X1R5G5B5: 361 case D3DFMT_A1R5G5B5: 362 case D3DFMT_R8G8B8: 363 surface->getdc_supported = TRUE; 364 break; 365 366 default: 367 surface->getdc_supported = FALSE; 368 break; 369 } 370 371 /* FIXME: Check MAX bounds of MultisampleQuality. */ 372 if (multisample_quality > 0) 373 { 374 FIXME("Multisample quality set to %u, substituting 0.\n", multisample_quality); 375 multisample_quality = 0; 376 } 377 378 wined3d_mutex_lock(); 379 hr = IWineD3DDevice_CreateSurface(device->WineD3DDevice, width, height, wined3dformat_from_d3dformat(format), 380 lockable, discard, level, &surface->wineD3DSurface, usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool, 381 multisample_type, multisample_quality, SURFACE_OPENGL, (IUnknown *)surface, 382 &d3d9_surface_wined3d_parent_ops); 383 wined3d_mutex_unlock(); 384 if (FAILED(hr)) 385 { 386 WARN("Failed to create wined3d surface, hr %#x.\n", hr); 387 return hr; 388 } 389 390 surface->parentDevice = (IDirect3DDevice9Ex *)device; 391 IDirect3DDevice9Ex_AddRef(surface->parentDevice); 392 393 return D3D_OK; 394 } -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/swapchain.c
r19678 r23571 72 72 if (This->parentDevice) IDirect3DDevice9Ex_Release(This->parentDevice); 73 73 if (!This->isImplicit) { 74 EnterCriticalSection(&d3d9_cs); 75 IWineD3DSwapChain_Destroy(This->wineD3DSwapChain, D3D9CB_DestroyRenderTarget); 76 LeaveCriticalSection(&d3d9_cs); 74 wined3d_mutex_lock(); 75 IWineD3DSwapChain_Destroy(This->wineD3DSwapChain); 76 wined3d_mutex_unlock(); 77 77 78 HeapFree(GetProcessHeap(), 0, This); 78 79 } … … 88 89 TRACE("(%p) Relay\n", This); 89 90 90 EnterCriticalSection(&d3d9_cs);91 wined3d_mutex_lock(); 91 92 hr = IWineD3DSwapChain_Present(This->wineD3DSwapChain, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion, dwFlags); 92 LeaveCriticalSection(&d3d9_cs);93 wined3d_mutex_unlock(); 93 94 94 95 return hr; … … 100 101 TRACE("(%p) Relay\n", This); 101 102 102 EnterCriticalSection(&d3d9_cs);103 wined3d_mutex_lock(); 103 104 hr = IWineD3DSwapChain_GetFrontBufferData(This->wineD3DSwapChain, ((IDirect3DSurface9Impl *)pDestSurface)->wineD3DSurface); 104 LeaveCriticalSection(&d3d9_cs); 105 wined3d_mutex_unlock(); 106 105 107 return hr; 106 108 } … … 113 115 TRACE("(%p) Relay\n", This); 114 116 115 EnterCriticalSection(&d3d9_cs);117 wined3d_mutex_lock(); 116 118 hrc = IWineD3DSwapChain_GetBackBuffer(This->wineD3DSwapChain, iBackBuffer, (WINED3DBACKBUFFER_TYPE) Type, &mySurface); 117 119 if (hrc == D3D_OK && NULL != mySurface) { … … 119 121 IWineD3DSurface_Release(mySurface); 120 122 } 121 LeaveCriticalSection(&d3d9_cs); 123 wined3d_mutex_unlock(); 124 122 125 /* Do not touch the **ppBackBuffer pointer otherwise! (see device test) */ 123 126 return hrc; … … 129 132 TRACE("(%p) Relay\n", This); 130 133 131 EnterCriticalSection(&d3d9_cs);134 wined3d_mutex_lock(); 132 135 hr = IWineD3DSwapChain_GetRasterStatus(This->wineD3DSwapChain, (WINED3DRASTER_STATUS *) pRasterStatus); 133 LeaveCriticalSection(&d3d9_cs); 136 wined3d_mutex_unlock(); 137 134 138 return hr; 135 139 } … … 140 144 TRACE("(%p) Relay\n", This); 141 145 142 EnterCriticalSection(&d3d9_cs);146 wined3d_mutex_lock(); 143 147 hr = IWineD3DSwapChain_GetDisplayMode(This->wineD3DSwapChain, (WINED3DDISPLAYMODE *) pMode); 144 LeaveCriticalSection(&d3d9_cs);148 wined3d_mutex_unlock(); 145 149 146 150 if (SUCCEEDED(hr)) pMode->Format = d3dformat_from_wined3dformat(pMode->Format); … … 156 160 TRACE("(%p) Relay\n", This); 157 161 158 EnterCriticalSection(&d3d9_cs);162 wined3d_mutex_lock(); 159 163 hrc = IWineD3DSwapChain_GetDevice(This->wineD3DSwapChain, &device); 160 164 if (hrc == D3D_OK && NULL != device) { … … 162 166 IWineD3DDevice_Release(device); 163 167 } 164 LeaveCriticalSection(&d3d9_cs); 168 wined3d_mutex_unlock(); 169 165 170 return hrc; 166 171 } … … 173 178 TRACE("(%p)->(%p): Relay\n", This, pPresentationParameters); 174 179 175 EnterCriticalSection(&d3d9_cs);180 wined3d_mutex_lock(); 176 181 hr = IWineD3DSwapChain_GetPresentParameters(This->wineD3DSwapChain, &winePresentParameters); 177 LeaveCriticalSection(&d3d9_cs);182 wined3d_mutex_unlock(); 178 183 179 184 pPresentationParameters->BackBufferWidth = winePresentParameters.BackBufferWidth; … … 250 255 localParameters.AutoRestoreDisplayMode = TRUE; 251 256 252 EnterCriticalSection(&d3d9_cs);257 wined3d_mutex_lock(); 253 258 hrc = IWineD3DDevice_CreateSwapChain(This->WineD3DDevice, &localParameters, 254 259 &object->wineD3DSwapChain, (IUnknown*)object, SURFACE_OPENGL); 255 LeaveCriticalSection(&d3d9_cs);260 wined3d_mutex_unlock(); 256 261 257 262 pPresentationParameters->BackBufferWidth = localParameters.BackBufferWidth; … … 290 295 TRACE("(%p) Relay\n", This); 291 296 292 EnterCriticalSection(&d3d9_cs);297 wined3d_mutex_lock(); 293 298 hrc = IWineD3DDevice_GetSwapChain(This->WineD3DDevice, iSwapChain, &swapchain); 294 299 if (hrc == D3D_OK && NULL != swapchain) { … … 298 303 *pSwapChain = NULL; 299 304 } 300 LeaveCriticalSection(&d3d9_cs); 305 wined3d_mutex_unlock(); 306 301 307 return hrc; 302 308 } … … 307 313 TRACE("(%p) Relay\n", This); 308 314 309 EnterCriticalSection(&d3d9_cs);315 wined3d_mutex_lock(); 310 316 ret = IWineD3DDevice_GetNumberOfSwapChains(This->WineD3DDevice); 311 LeaveCriticalSection(&d3d9_cs); 317 wined3d_mutex_unlock(); 318 312 319 return ret; 313 320 } -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/texture.c
r21731 r23571 59 59 TRACE("(%p) : AddRef from %d\n", This, ref - 1); 60 60 61 if (ref == 1) 62 { 63 IDirect3DDevice9Ex_AddRef(This->parentDevice); 64 wined3d_mutex_lock(); 65 IWineD3DTexture_AddRef(This->wineD3DTexture); 66 wined3d_mutex_unlock(); 67 } 68 61 69 return ref; 62 70 } … … 69 77 70 78 if (ref == 0) { 71 EnterCriticalSection(&d3d9_cs);72 IWineD3DTexture_Destroy(This->wineD3DTexture, D3D9CB_DestroySurface);73 LeaveCriticalSection(&d3d9_cs);74 79 IDirect3DDevice9Ex_Release(This->parentDevice); 75 HeapFree(GetProcessHeap(), 0, This); 80 wined3d_mutex_lock(); 81 IWineD3DTexture_Release(This->wineD3DTexture); 82 wined3d_mutex_unlock(); 76 83 } 77 84 return ref; … … 85 92 TRACE("(%p) Relay\n", This); 86 93 87 EnterCriticalSection(&d3d9_cs);94 wined3d_mutex_lock(); 88 95 hr = IWineD3DTexture_GetDevice(This->wineD3DTexture, &wined3d_device); 89 96 if (SUCCEEDED(hr)) … … 92 99 IWineD3DDevice_Release(wined3d_device); 93 100 } 94 LeaveCriticalSection(&d3d9_cs); 101 wined3d_mutex_unlock(); 102 95 103 return hr; 96 104 } … … 101 109 TRACE("(%p) Relay\n", This); 102 110 103 EnterCriticalSection(&d3d9_cs);111 wined3d_mutex_lock(); 104 112 hr = IWineD3DTexture_SetPrivateData(This->wineD3DTexture, refguid, pData, SizeOfData, Flags); 105 LeaveCriticalSection(&d3d9_cs); 113 wined3d_mutex_unlock(); 114 106 115 return hr; 107 116 } … … 112 121 TRACE("(%p) Relay\n", This); 113 122 114 EnterCriticalSection(&d3d9_cs);123 wined3d_mutex_lock(); 115 124 hr = IWineD3DTexture_GetPrivateData(This->wineD3DTexture, refguid, pData, pSizeOfData); 116 LeaveCriticalSection(&d3d9_cs); 125 wined3d_mutex_unlock(); 126 117 127 return hr; 118 128 } … … 123 133 TRACE("(%p) Relay\n", This); 124 134 125 EnterCriticalSection(&d3d9_cs);135 wined3d_mutex_lock(); 126 136 hr = IWineD3DTexture_FreePrivateData(This->wineD3DTexture, refguid); 127 LeaveCriticalSection(&d3d9_cs); 137 wined3d_mutex_unlock(); 138 128 139 return hr; 129 140 } … … 134 145 TRACE("(%p) Relay\n", This); 135 146 136 EnterCriticalSection(&d3d9_cs);147 wined3d_mutex_lock(); 137 148 ret = IWineD3DTexture_SetPriority(This->wineD3DTexture, PriorityNew); 138 LeaveCriticalSection(&d3d9_cs); 149 wined3d_mutex_unlock(); 150 139 151 return ret; 140 152 } … … 145 157 TRACE("(%p) Relay\n", This); 146 158 147 EnterCriticalSection(&d3d9_cs);159 wined3d_mutex_lock(); 148 160 ret = IWineD3DTexture_GetPriority(This->wineD3DTexture); 149 LeaveCriticalSection(&d3d9_cs); 161 wined3d_mutex_unlock(); 162 150 163 return ret; 151 164 } … … 155 168 TRACE("(%p) Relay\n", This); 156 169 157 EnterCriticalSection(&d3d9_cs);170 wined3d_mutex_lock(); 158 171 IWineD3DTexture_PreLoad(This->wineD3DTexture); 159 LeaveCriticalSection(&d3d9_cs);172 wined3d_mutex_unlock(); 160 173 } 161 174 … … 165 178 TRACE("(%p) Relay\n", This); 166 179 167 EnterCriticalSection(&d3d9_cs);180 wined3d_mutex_lock(); 168 181 ret = IWineD3DTexture_GetType(This->wineD3DTexture); 169 LeaveCriticalSection(&d3d9_cs); 182 wined3d_mutex_unlock(); 183 170 184 return ret; 171 185 } … … 177 191 TRACE("(%p) Relay\n", This); 178 192 179 EnterCriticalSection(&d3d9_cs);193 wined3d_mutex_lock(); 180 194 ret = IWineD3DTexture_SetLOD(This->wineD3DTexture, LODNew); 181 LeaveCriticalSection(&d3d9_cs); 195 wined3d_mutex_unlock(); 196 182 197 return ret; 183 198 } … … 188 203 TRACE("(%p) Relay\n", This); 189 204 190 EnterCriticalSection(&d3d9_cs);205 wined3d_mutex_lock(); 191 206 ret = IWineD3DTexture_GetLOD(This->wineD3DTexture); 192 LeaveCriticalSection(&d3d9_cs); 207 wined3d_mutex_unlock(); 208 193 209 return ret; 194 210 } … … 199 215 TRACE("(%p) Relay\n", This); 200 216 201 EnterCriticalSection(&d3d9_cs);217 wined3d_mutex_lock(); 202 218 ret = IWineD3DTexture_GetLevelCount(This->wineD3DTexture); 203 LeaveCriticalSection(&d3d9_cs); 219 wined3d_mutex_unlock(); 220 204 221 return ret; 205 222 } … … 210 227 TRACE("(%p) Relay\n", This); 211 228 212 EnterCriticalSection(&d3d9_cs);229 wined3d_mutex_lock(); 213 230 hr = IWineD3DTexture_SetAutoGenFilterType(This->wineD3DTexture, (WINED3DTEXTUREFILTERTYPE) FilterType); 214 LeaveCriticalSection(&d3d9_cs); 231 wined3d_mutex_unlock(); 232 215 233 return hr; 216 234 } … … 221 239 TRACE("(%p) Relay\n", This); 222 240 223 EnterCriticalSection(&d3d9_cs);241 wined3d_mutex_lock(); 224 242 ret = (D3DTEXTUREFILTERTYPE) IWineD3DTexture_GetAutoGenFilterType(This->wineD3DTexture); 225 LeaveCriticalSection(&d3d9_cs); 243 wined3d_mutex_unlock(); 244 226 245 return ret; 227 246 } … … 231 250 TRACE("(%p) Relay\n", This); 232 251 233 EnterCriticalSection(&d3d9_cs);252 wined3d_mutex_lock(); 234 253 IWineD3DTexture_GenerateMipSubLevels(This->wineD3DTexture); 235 LeaveCriticalSection(&d3d9_cs);254 wined3d_mutex_unlock(); 236 255 } 237 256 … … 244 263 TRACE("(%p) Relay\n", This); 245 264 246 EnterCriticalSection(&d3d9_cs);265 wined3d_mutex_lock(); 247 266 hr = IWineD3DTexture_GetLevelDesc(This->wineD3DTexture, Level, &wined3ddesc); 248 LeaveCriticalSection(&d3d9_cs);267 wined3d_mutex_unlock(); 249 268 250 269 if (SUCCEEDED(hr)) … … 269 288 270 289 TRACE("(%p) Relay\n", This); 271 EnterCriticalSection(&d3d9_cs); 290 291 wined3d_mutex_lock(); 272 292 hrc = IWineD3DTexture_GetSurfaceLevel(This->wineD3DTexture, Level, &mySurface); 273 293 if (hrc == D3D_OK && NULL != ppSurfaceLevel) { … … 275 295 IWineD3DSurface_Release(mySurface); 276 296 } 277 LeaveCriticalSection(&d3d9_cs); 297 wined3d_mutex_unlock(); 298 278 299 return hrc; 279 300 } … … 284 305 TRACE("(%p) Relay\n", This); 285 306 286 EnterCriticalSection(&d3d9_cs);307 wined3d_mutex_lock(); 287 308 hr = IWineD3DTexture_LockRect(This->wineD3DTexture, Level, (WINED3DLOCKED_RECT *) pLockedRect, pRect, Flags); 288 LeaveCriticalSection(&d3d9_cs); 309 wined3d_mutex_unlock(); 310 289 311 return hr; 290 312 } … … 295 317 TRACE("(%p) Relay\n", This); 296 318 297 EnterCriticalSection(&d3d9_cs);319 wined3d_mutex_lock(); 298 320 hr = IWineD3DTexture_UnlockRect(This->wineD3DTexture, Level); 299 LeaveCriticalSection(&d3d9_cs); 321 wined3d_mutex_unlock(); 322 300 323 return hr; 301 324 } … … 306 329 TRACE("(%p) Relay\n", This); 307 330 308 EnterCriticalSection(&d3d9_cs);331 wined3d_mutex_lock(); 309 332 hr = IWineD3DTexture_AddDirtyRect(This->wineD3DTexture, pDirtyRect); 310 LeaveCriticalSection(&d3d9_cs); 333 wined3d_mutex_unlock(); 334 311 335 return hr; 312 336 } … … 342 366 }; 343 367 344 345 /* IDirect3DDevice9 IDirect3DTexture9 Methods follow: */ 346 HRESULT WINAPI IDirect3DDevice9Impl_CreateTexture(LPDIRECT3DDEVICE9EX iface, UINT Width, UINT Height, UINT Levels, DWORD Usage, 347 D3DFORMAT Format, D3DPOOL Pool, IDirect3DTexture9** ppTexture, HANDLE* pSharedHandle) { 348 IDirect3DTexture9Impl *object; 349 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 350 HRESULT hrc = D3D_OK; 351 352 TRACE("(%p) : W(%d) H(%d), Lvl(%d) d(%d), Fmt(%#x), Pool(%d)\n", This, Width, Height, Levels, Usage, Format, Pool); 353 354 /* Allocate the storage for the device */ 355 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DTexture9Impl)); 356 357 if (NULL == object) { 358 ERR("Allocation of memory failed, returning D3DERR_OUTOFVIDEOMEMORY\n"); 359 return D3DERR_OUTOFVIDEOMEMORY; 360 } 361 362 object->lpVtbl = &Direct3DTexture9_Vtbl; 363 object->ref = 1; 364 EnterCriticalSection(&d3d9_cs); 365 hrc = IWineD3DDevice_CreateTexture(This->WineD3DDevice, Width, Height, Levels, Usage & WINED3DUSAGE_MASK, 366 wined3dformat_from_d3dformat(Format), Pool, &object->wineD3DTexture, (IUnknown *)object); 367 LeaveCriticalSection(&d3d9_cs); 368 if (FAILED(hrc)) { 369 370 /* free up object */ 371 WARN("(%p) call to IWineD3DDevice_CreateTexture failed\n", This); 372 HeapFree(GetProcessHeap(), 0, object); 373 } else { 374 IDirect3DDevice9Ex_AddRef(iface); 375 object->parentDevice = iface; 376 *ppTexture= (LPDIRECT3DTEXTURE9) object; 377 TRACE("(%p) Created Texture %p, %p\n", This, object, object->wineD3DTexture); 378 } 379 380 return hrc; 381 } 368 static void STDMETHODCALLTYPE d3d9_texture_wined3d_object_destroyed(void *parent) 369 { 370 HeapFree(GetProcessHeap(), 0, parent); 371 } 372 373 static const struct wined3d_parent_ops d3d9_texture_wined3d_parent_ops = 374 { 375 d3d9_texture_wined3d_object_destroyed, 376 }; 377 378 HRESULT texture_init(IDirect3DTexture9Impl *texture, IDirect3DDevice9Impl *device, 379 UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool) 380 { 381 HRESULT hr; 382 383 texture->lpVtbl = &Direct3DTexture9_Vtbl; 384 texture->ref = 1; 385 386 wined3d_mutex_lock(); 387 hr = IWineD3DDevice_CreateTexture(device->WineD3DDevice, width, height, levels, 388 usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(format), pool, 389 &texture->wineD3DTexture, (IUnknown *)texture, &d3d9_texture_wined3d_parent_ops); 390 wined3d_mutex_unlock(); 391 if (FAILED(hr)) 392 { 393 WARN("Failed to create wined3d texture, hr %#x.\n", hr); 394 return hr; 395 } 396 397 texture->parentDevice = (IDirect3DDevice9Ex *)device; 398 IDirect3DDevice9Ex_AddRef(texture->parentDevice); 399 400 return D3D_OK; 401 } -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/vertexbuffer.c
r19678 r23571 58 58 TRACE("(%p) : AddRef from %d\n", This, ref - 1); 59 59 60 if (ref == 1) 61 { 62 IDirect3DDevice9Ex_AddRef(This->parentDevice); 63 wined3d_mutex_lock(); 64 IWineD3DBuffer_AddRef(This->wineD3DVertexBuffer); 65 wined3d_mutex_unlock(); 66 } 67 60 68 return ref; 61 69 } … … 68 76 69 77 if (ref == 0) { 70 EnterCriticalSection(&d3d9_cs); 78 IDirect3DDevice9Ex_Release(This->parentDevice); 79 wined3d_mutex_lock(); 71 80 IWineD3DBuffer_Release(This->wineD3DVertexBuffer); 72 LeaveCriticalSection(&d3d9_cs); 73 IDirect3DDevice9Ex_Release(This->parentDevice); 74 HeapFree(GetProcessHeap(), 0, This); 81 wined3d_mutex_unlock(); 75 82 } 76 83 return ref; … … 84 91 TRACE("(%p) Relay\n", This); 85 92 86 EnterCriticalSection(&d3d9_cs);93 wined3d_mutex_lock(); 87 94 hr = IWineD3DBuffer_GetDevice(This->wineD3DVertexBuffer, &wined3d_device); 88 95 if (SUCCEEDED(hr)) … … 91 98 IWineD3DDevice_Release(wined3d_device); 92 99 } 93 LeaveCriticalSection(&d3d9_cs); 100 wined3d_mutex_unlock(); 101 94 102 return hr; 95 103 } … … 101 109 TRACE("(%p) Relay\n", This); 102 110 103 EnterCriticalSection(&d3d9_cs);111 wined3d_mutex_lock(); 104 112 hr = IWineD3DBuffer_SetPrivateData(This->wineD3DVertexBuffer, refguid, pData, SizeOfData, Flags); 105 LeaveCriticalSection(&d3d9_cs);113 wined3d_mutex_unlock(); 106 114 107 115 return hr; … … 113 121 TRACE("(%p) Relay\n", This); 114 122 115 EnterCriticalSection(&d3d9_cs);123 wined3d_mutex_lock(); 116 124 hr = IWineD3DBuffer_GetPrivateData(This->wineD3DVertexBuffer, refguid, pData, pSizeOfData); 117 LeaveCriticalSection(&d3d9_cs); 125 wined3d_mutex_unlock(); 126 118 127 return hr; 119 128 } … … 124 133 TRACE("(%p) Relay\n", This); 125 134 126 EnterCriticalSection(&d3d9_cs);135 wined3d_mutex_lock(); 127 136 hr = IWineD3DBuffer_FreePrivateData(This->wineD3DVertexBuffer, refguid); 128 LeaveCriticalSection(&d3d9_cs); 137 wined3d_mutex_unlock(); 138 129 139 return hr; 130 140 } … … 135 145 TRACE("(%p) Relay\n", This); 136 146 137 EnterCriticalSection(&d3d9_cs);147 wined3d_mutex_lock(); 138 148 hr = IWineD3DBuffer_SetPriority(This->wineD3DVertexBuffer, PriorityNew); 139 LeaveCriticalSection(&d3d9_cs); 149 wined3d_mutex_unlock(); 150 140 151 return hr; 141 152 } … … 146 157 TRACE("(%p) Relay\n", This); 147 158 148 EnterCriticalSection(&d3d9_cs);159 wined3d_mutex_lock(); 149 160 hr = IWineD3DBuffer_GetPriority(This->wineD3DVertexBuffer); 150 LeaveCriticalSection(&d3d9_cs); 161 wined3d_mutex_unlock(); 162 151 163 return hr; 152 164 } … … 156 168 TRACE("(%p) Relay\n", This); 157 169 158 EnterCriticalSection(&d3d9_cs);170 wined3d_mutex_lock(); 159 171 IWineD3DBuffer_PreLoad(This->wineD3DVertexBuffer); 160 LeaveCriticalSection(&d3d9_cs); 161 return ; 172 wined3d_mutex_unlock(); 162 173 } 163 174 … … 175 186 TRACE("(%p) Relay\n", This); 176 187 177 EnterCriticalSection(&d3d9_cs);188 wined3d_mutex_lock(); 178 189 hr = IWineD3DBuffer_Map(This->wineD3DVertexBuffer, OffsetToLock, SizeToLock, (BYTE **)ppbData, Flags); 179 LeaveCriticalSection(&d3d9_cs); 190 wined3d_mutex_unlock(); 191 180 192 return hr; 181 193 } … … 186 198 TRACE("(%p) Relay\n", This); 187 199 188 EnterCriticalSection(&d3d9_cs);200 wined3d_mutex_lock(); 189 201 hr = IWineD3DBuffer_Unmap(This->wineD3DVertexBuffer); 190 LeaveCriticalSection(&d3d9_cs); 202 wined3d_mutex_unlock(); 203 191 204 return hr; 192 205 } … … 198 211 TRACE("(%p) Relay\n", This); 199 212 200 EnterCriticalSection(&d3d9_cs);213 wined3d_mutex_lock(); 201 214 hr = IWineD3DBuffer_GetDesc(This->wineD3DVertexBuffer, &desc); 202 LeaveCriticalSection(&d3d9_cs);215 wined3d_mutex_unlock(); 203 216 204 217 if (SUCCEEDED(hr)) { … … 236 249 }; 237 250 238 239 /* IDirect3DDevice9 IDirect3DVertexBuffer9 Methods follow: */ 240 HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexBuffer(LPDIRECT3DDEVICE9EX iface, 241 UINT Size, DWORD Usage, DWORD FVF, D3DPOOL Pool, 242 IDirect3DVertexBuffer9** ppVertexBuffer, HANDLE* pSharedHandle) { 243 244 IDirect3DVertexBuffer9Impl *object; 245 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 246 HRESULT hrc = D3D_OK; 247 248 /* Allocate the storage for the device */ 249 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DVertexBuffer9Impl)); 250 if (NULL == object) { 251 FIXME("Allocation of memory failed, returning D3DERR_OUTOFVIDEOMEMORY\n"); 252 return D3DERR_OUTOFVIDEOMEMORY; 253 } 254 255 object->lpVtbl = &Direct3DVertexBuffer9_Vtbl; 256 object->ref = 1; 257 object->fvf = FVF; 258 EnterCriticalSection(&d3d9_cs); 259 hrc = IWineD3DDevice_CreateVertexBuffer(This->WineD3DDevice, Size, Usage & WINED3DUSAGE_MASK, 260 0 /* fvf for ddraw only */, (WINED3DPOOL) Pool, &(object->wineD3DVertexBuffer), (IUnknown *)object); 261 LeaveCriticalSection(&d3d9_cs); 262 263 if (hrc != D3D_OK) { 264 265 /* free up object */ 266 WARN("(%p) call to IWineD3DDevice_CreateVertexBuffer failed\n", This); 267 HeapFree(GetProcessHeap(), 0, object); 268 } else { 269 IDirect3DDevice9Ex_AddRef(iface); 270 object->parentDevice = iface; 271 TRACE("(%p) : Created vertex buffer %p\n", This, object); 272 *ppVertexBuffer = (LPDIRECT3DVERTEXBUFFER9) object; 273 } 274 return hrc; 275 } 251 static void STDMETHODCALLTYPE d3d9_vertexbuffer_wined3d_object_destroyed(void *parent) 252 { 253 HeapFree(GetProcessHeap(), 0, parent); 254 } 255 256 static const struct wined3d_parent_ops d3d9_vertexbuffer_wined3d_parent_ops = 257 { 258 d3d9_vertexbuffer_wined3d_object_destroyed, 259 }; 260 261 HRESULT vertexbuffer_init(IDirect3DVertexBuffer9Impl *buffer, IDirect3DDevice9Impl *device, 262 UINT size, UINT usage, DWORD fvf, D3DPOOL pool) 263 { 264 HRESULT hr; 265 266 buffer->lpVtbl = &Direct3DVertexBuffer9_Vtbl; 267 buffer->ref = 1; 268 buffer->fvf = fvf; 269 270 wined3d_mutex_lock(); 271 hr = IWineD3DDevice_CreateVertexBuffer(device->WineD3DDevice, size, 272 usage & WINED3DUSAGE_MASK, 0, (WINED3DPOOL)pool, &buffer->wineD3DVertexBuffer, 273 (IUnknown *)buffer, &d3d9_vertexbuffer_wined3d_parent_ops); 274 wined3d_mutex_unlock(); 275 if (FAILED(hr)) 276 { 277 WARN("Failed to create wined3d buffer, hr %#x.\n", hr); 278 return hr; 279 } 280 281 buffer->parentDevice = (IDirect3DDevice9Ex *)device; 282 IDirect3DDevice9Ex_AddRef(buffer->parentDevice); 283 284 return D3D_OK; 285 } -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/vertexdeclaration.c
r19678 r23571 46 46 {D3DDECLTYPE_FLOAT3, WINED3DFMT_R32G32B32_FLOAT, 3, sizeof(float)}, 47 47 {D3DDECLTYPE_FLOAT4, WINED3DFMT_R32G32B32A32_FLOAT, 4, sizeof(float)}, 48 {D3DDECLTYPE_D3DCOLOR, WINED3DFMT_ A8R8G8B8,4, sizeof(BYTE)},48 {D3DDECLTYPE_D3DCOLOR, WINED3DFMT_B8G8R8A8_UNORM, 4, sizeof(BYTE)}, 49 49 {D3DDECLTYPE_UBYTE4, WINED3DFMT_R8G8B8A8_UINT, 4, sizeof(BYTE)}, 50 50 {D3DDECLTYPE_SHORT2, WINED3DFMT_R16G16_SINT, 2, sizeof(short int)}, … … 97 97 /* convert the declaration */ 98 98 elements = HeapAlloc(GetProcessHeap(), 0, size * sizeof(D3DVERTEXELEMENT9)); 99 if (!elements) 100 return D3DERR_OUTOFVIDEOMEMORY; 99 if (!elements) return D3DERR_OUTOFVIDEOMEMORY; 101 100 102 101 elements[size-1] = end_element; … … 228 227 if(ref == 1) { 229 228 IDirect3DDevice9Ex_AddRef(This->parentDevice); 229 if (!This->convFVF) 230 { 231 wined3d_mutex_lock(); 232 IWineD3DVertexDeclaration_AddRef(This->wineD3DVertexDeclaration); 233 wined3d_mutex_unlock(); 234 } 230 235 } 231 236 … … 240 245 ERR("Destroying vdecl with ref != 0\n"); 241 246 } 242 EnterCriticalSection(&d3d9_cs); 247 248 wined3d_mutex_lock(); 243 249 IWineD3DVertexDeclaration_Release(This->wineD3DVertexDeclaration); 244 LeaveCriticalSection(&d3d9_cs); 245 HeapFree(GetProcessHeap(), 0, This->elements); 246 HeapFree(GetProcessHeap(), 0, This); 250 wined3d_mutex_unlock(); 247 251 } 248 252 … … 254 258 255 259 if (ref == 0) { 256 IDirect3DDevice9Ex *parentDevice = This->parentDevice; 257 260 IDirect3DDevice9Ex_Release(This->parentDevice); 258 261 if(!This->convFVF) { 259 IDirect3DVertexDeclaration9Impl_Release(iface); 260 } 261 IDirect3DDevice9Ex_Release(parentDevice); 262 IDirect3DVertexDeclaration9Impl_Destroy(iface); 263 } 262 264 } 263 265 return ref; … … 272 274 TRACE("(%p) : Relay\n", iface); 273 275 274 EnterCriticalSection(&d3d9_cs);276 wined3d_mutex_lock(); 275 277 hr = IWineD3DVertexDeclaration_GetDevice(This->wineD3DVertexDeclaration, &myDevice); 276 278 if (hr == D3D_OK && myDevice != NULL) { … … 278 280 IWineD3DDevice_Release(myDevice); 279 281 } 280 LeaveCriticalSection(&d3d9_cs); 282 wined3d_mutex_unlock(); 283 281 284 return hr; 282 285 } … … 312 315 }; 313 316 317 static void STDMETHODCALLTYPE d3d9_vertexdeclaration_wined3d_object_destroyed(void *parent) 318 { 319 IDirect3DVertexDeclaration9Impl *declaration = parent; 320 HeapFree(GetProcessHeap(), 0, declaration->elements); 321 HeapFree(GetProcessHeap(), 0, declaration); 322 } 323 324 static const struct wined3d_parent_ops d3d9_vertexdeclaration_wined3d_parent_ops = 325 { 326 d3d9_vertexdeclaration_wined3d_object_destroyed, 327 }; 328 314 329 static HRESULT convert_to_wined3d_declaration(const D3DVERTEXELEMENT9* d3d9_elements, 315 330 WINED3DVERTEXELEMENT **wined3d_elements, UINT *element_count) … … 357 372 } 358 373 359 /* IDirect3DDevice9 IDirect3DVertexDeclaration9 Methods follow: */ 360 HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexDeclaration(LPDIRECT3DDEVICE9EX iface, CONST D3DVERTEXELEMENT9* pVertexElements, IDirect3DVertexDeclaration9** ppDecl) { 361 362 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 363 IDirect3DVertexDeclaration9Impl *object = NULL; 364 WINED3DVERTEXELEMENT* wined3d_elements; 374 HRESULT vertexdeclaration_init(IDirect3DVertexDeclaration9Impl *declaration, 375 IDirect3DDevice9Impl *device, const D3DVERTEXELEMENT9 *elements) 376 { 377 WINED3DVERTEXELEMENT *wined3d_elements; 365 378 UINT wined3d_element_count; 366 379 UINT element_count; 367 380 HRESULT hr; 368 381 369 TRACE("(%p) : Relay\n", iface); 370 if (NULL == ppDecl) { 371 WARN("(%p) : Caller passed NULL As ppDecl, returning D3DERR_INVALIDCALL\n",This); 372 return D3DERR_INVALIDCALL; 373 } 374 375 hr = convert_to_wined3d_declaration(pVertexElements, &wined3d_elements, &wined3d_element_count); 382 hr = convert_to_wined3d_declaration(elements, &wined3d_elements, &wined3d_element_count); 376 383 if (FAILED(hr)) 377 384 { 378 WARN(" (%p) : Error parsing vertex declaration\n", This);385 WARN("Failed to create wined3d vertex declaration elements, hr %#x.\n", hr); 379 386 return hr; 380 387 } 381 388 382 /* Allocate the storage for the device */ 383 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DVertexDeclaration9Impl)); 384 if (NULL == object) { 389 declaration->lpVtbl = &Direct3DVertexDeclaration9_Vtbl; 390 declaration->ref = 1; 391 392 element_count = wined3d_element_count + 1; 393 declaration->elements = HeapAlloc(GetProcessHeap(), 0, element_count * sizeof(*declaration->elements)); 394 if (!declaration->elements) 395 { 385 396 HeapFree(GetProcessHeap(), 0, wined3d_elements); 386 FIXME("Allocation of memory failed, returning D3DERR_OUTOFVIDEOMEMORY\n");397 ERR("Failed to allocate vertex declaration elements memory.\n"); 387 398 return D3DERR_OUTOFVIDEOMEMORY; 388 399 } 389 390 object->lpVtbl = &Direct3DVertexDeclaration9_Vtbl; 391 object->ref = 0; 392 393 element_count = wined3d_element_count + 1; 394 object->elements = HeapAlloc(GetProcessHeap(), 0, element_count * sizeof(D3DVERTEXELEMENT9)); 395 if (!object->elements) { 396 HeapFree(GetProcessHeap(), 0, wined3d_elements); 397 HeapFree(GetProcessHeap(), 0, object); 398 ERR("Memory allocation failed\n"); 399 return D3DERR_OUTOFVIDEOMEMORY; 400 } 401 CopyMemory(object->elements, pVertexElements, element_count * sizeof(D3DVERTEXELEMENT9)); 402 object->element_count = element_count; 403 404 EnterCriticalSection(&d3d9_cs); 405 hr = IWineD3DDevice_CreateVertexDeclaration(This->WineD3DDevice, &object->wineD3DVertexDeclaration, 406 (IUnknown *)object, wined3d_elements, wined3d_element_count); 407 LeaveCriticalSection(&d3d9_cs); 408 400 memcpy(declaration->elements, elements, element_count * sizeof(*elements)); 401 declaration->element_count = element_count; 402 403 wined3d_mutex_lock(); 404 hr = IWineD3DDevice_CreateVertexDeclaration(device->WineD3DDevice, &declaration->wineD3DVertexDeclaration, 405 (IUnknown *)declaration, &d3d9_vertexdeclaration_wined3d_parent_ops, 406 wined3d_elements, wined3d_element_count); 407 wined3d_mutex_unlock(); 409 408 HeapFree(GetProcessHeap(), 0, wined3d_elements); 410 411 if (FAILED(hr)) { 412 413 /* free up object */ 414 WARN("(%p) call to IWineD3DDevice_CreateVertexDeclaration failed\n", This); 415 HeapFree(GetProcessHeap(), 0, object->elements); 416 HeapFree(GetProcessHeap(), 0, object); 417 } else { 418 object->parentDevice = iface; 419 *ppDecl = (LPDIRECT3DVERTEXDECLARATION9) object; 420 IDirect3DVertexDeclaration9_AddRef(*ppDecl); 421 TRACE("(%p) : Created vertex declaration %p\n", This, object); 422 } 423 return hr; 409 if (FAILED(hr)) 410 { 411 WARN("Failed to create wined3d vertex declaration, hr %#x.\n", hr); 412 return hr; 413 } 414 415 declaration->parentDevice = (IDirect3DDevice9Ex *)device; 416 IDirect3DDevice9Ex_AddRef(declaration->parentDevice); 417 418 return D3D_OK; 424 419 } 425 420 … … 431 426 TRACE("(%p) : Relay\n", iface); 432 427 433 EnterCriticalSection(&d3d9_cs);428 wined3d_mutex_lock(); 434 429 hr = IWineD3DDevice_SetVertexDeclaration(This->WineD3DDevice, pDeclImpl == NULL ? NULL : pDeclImpl->wineD3DVertexDeclaration); 435 LeaveCriticalSection(&d3d9_cs); 430 wined3d_mutex_unlock(); 431 436 432 return hr; 437 433 } … … 449 445 450 446 *ppDecl = NULL; 451 EnterCriticalSection(&d3d9_cs); 447 448 wined3d_mutex_lock(); 452 449 hr = IWineD3DDevice_GetVertexDeclaration(This->WineD3DDevice, &pTest); 453 450 if (hr == D3D_OK && NULL != pTest) { … … 457 454 *ppDecl = NULL; 458 455 } 459 LeaveCriticalSection(&d3d9_cs); 456 wined3d_mutex_unlock(); 457 460 458 TRACE("(%p) : returning %p\n", This, *ppDecl); 461 459 return hr; -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/vertexshader.c
r20612 r23571 56 56 TRACE("(%p) : AddRef from %d\n", This, ref - 1); 57 57 58 if (ref == 1) 59 { 60 IDirect3DDevice9Ex_AddRef(This->parentDevice); 61 wined3d_mutex_lock(); 62 IWineD3DVertexShader_AddRef(This->wineD3DVertexShader); 63 wined3d_mutex_unlock(); 64 } 65 58 66 return ref; 59 67 } … … 66 74 67 75 if (ref == 0) { 68 EnterCriticalSection(&d3d9_cs); 76 IDirect3DDevice9Ex_Release(This->parentDevice); 77 wined3d_mutex_lock(); 69 78 IWineD3DVertexShader_Release(This->wineD3DVertexShader); 70 LeaveCriticalSection(&d3d9_cs); 71 IDirect3DDevice9Ex_Release(This->parentDevice); 72 HeapFree(GetProcessHeap(), 0, This); 79 wined3d_mutex_unlock(); 73 80 } 74 81 return ref; … … 82 89 TRACE("(%p) : Relay\n", This); 83 90 84 EnterCriticalSection(&d3d9_cs);91 wined3d_mutex_lock(); 85 92 hr = IWineD3DVertexShader_GetDevice(This->wineD3DVertexShader, &myDevice); 86 93 if (WINED3D_OK == hr && myDevice != NULL) { … … 90 97 *ppDevice = NULL; 91 98 } 92 LeaveCriticalSection(&d3d9_cs); 99 wined3d_mutex_unlock(); 100 93 101 TRACE("(%p) returning (%p)\n", This, *ppDevice); 94 102 return hr; … … 100 108 TRACE("(%p) : Relay\n", This); 101 109 102 EnterCriticalSection(&d3d9_cs);110 wined3d_mutex_lock(); 103 111 hr = IWineD3DVertexShader_GetFunction(This->wineD3DVertexShader, pData, pSizeOfData); 104 LeaveCriticalSection(&d3d9_cs); 112 wined3d_mutex_unlock(); 113 105 114 return hr; 106 115 } … … 118 127 }; 119 128 120 121 /* IDirect3DDevice9 IDirect3DVertexShader9 Methods follow: */ 122 HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexShader(LPDIRECT3DDEVICE9EX iface, CONST DWORD* pFunction, IDirect3DVertexShader9** ppShader) { 129 static void STDMETHODCALLTYPE d3d9_vertexshader_wined3d_object_destroyed(void *parent) 130 { 131 HeapFree(GetProcessHeap(), 0, parent); 132 } 133 134 static const struct wined3d_parent_ops d3d9_vertexshader_wined3d_parent_ops = 135 { 136 d3d9_vertexshader_wined3d_object_destroyed, 137 }; 138 139 HRESULT vertexshader_init(IDirect3DVertexShader9Impl *shader, IDirect3DDevice9Impl *device, const DWORD *byte_code) 140 { 141 HRESULT hr; 142 143 shader->ref = 1; 144 shader->lpVtbl = &Direct3DVertexShader9_Vtbl; 145 146 wined3d_mutex_lock(); 147 hr = IWineD3DDevice_CreateVertexShader(device->WineD3DDevice, byte_code, 148 NULL /* output signature */, &shader->wineD3DVertexShader, 149 (IUnknown *)shader, &d3d9_vertexshader_wined3d_parent_ops); 150 wined3d_mutex_unlock(); 151 if (FAILED(hr)) 152 { 153 WARN("Failed to create wined3d vertex shader, hr %#x.\n", hr); 154 return hr; 155 } 156 157 shader->parentDevice = (IDirect3DDevice9Ex *)device; 158 IDirect3DDevice9Ex_AddRef(shader->parentDevice); 159 160 return D3D_OK; 161 } 162 163 HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShader(LPDIRECT3DDEVICE9EX iface, IDirect3DVertexShader9* pShader) { 123 164 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 124 165 HRESULT hrc = D3D_OK; 125 IDirect3DVertexShader9Impl *object; 126 127 /* Setup a stub object for now */ 128 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); 129 TRACE("(%p) : pFunction(%p), ppShader(%p)\n", This, pFunction, ppShader); 130 if (NULL == object) { 131 FIXME("Allocation of memory failed, returning D3DERR_OUTOFVIDEOMEMORY\n"); 132 return D3DERR_OUTOFVIDEOMEMORY; 133 } 134 135 object->ref = 1; 136 object->lpVtbl = &Direct3DVertexShader9_Vtbl; 137 EnterCriticalSection(&d3d9_cs); 138 hrc= IWineD3DDevice_CreateVertexShader(This->WineD3DDevice, pFunction, 139 NULL /* output signature */, &object->wineD3DVertexShader, (IUnknown *)object); 140 LeaveCriticalSection(&d3d9_cs); 141 142 if (FAILED(hrc)) { 143 144 /* free up object */ 145 FIXME("Call to IWineD3DDevice_CreateVertexShader failed\n"); 146 HeapFree(GetProcessHeap(), 0, object); 147 }else{ 148 IDirect3DDevice9Ex_AddRef(iface); 149 object->parentDevice = iface; 150 *ppShader = (IDirect3DVertexShader9 *)object; 151 TRACE("(%p) : Created vertex shader %p\n", This, object); 152 } 153 154 TRACE("(%p) : returning %p\n", This, *ppShader); 155 return hrc; 156 } 157 158 HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShader(LPDIRECT3DDEVICE9EX iface, IDirect3DVertexShader9* pShader) { 159 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 160 HRESULT hrc = D3D_OK; 161 162 TRACE("(%p) : Relay\n", This); 163 EnterCriticalSection(&d3d9_cs); 166 167 TRACE("(%p) : Relay\n", This); 168 169 wined3d_mutex_lock(); 164 170 hrc = IWineD3DDevice_SetVertexShader(This->WineD3DDevice, pShader==NULL?NULL:((IDirect3DVertexShader9Impl *)pShader)->wineD3DVertexShader); 165 LeaveCriticalSection(&d3d9_cs);171 wined3d_mutex_unlock(); 166 172 167 173 TRACE("(%p) : returning hr(%u)\n", This, hrc); … … 175 181 176 182 TRACE("(%p) : Relay device@%p\n", This, This->WineD3DDevice); 177 EnterCriticalSection(&d3d9_cs); 183 184 wined3d_mutex_lock(); 178 185 hrc = IWineD3DDevice_GetVertexShader(This->WineD3DDevice, &pShader); 179 186 if (SUCCEEDED(hrc)) … … 193 200 WARN("(%p) : Call to IWineD3DDevice_GetVertexShader failed %u (device %p)\n", This, hrc, This->WineD3DDevice); 194 201 } 195 LeaveCriticalSection(&d3d9_cs); 202 wined3d_mutex_unlock(); 203 196 204 TRACE("(%p) : returning %p\n", This, *ppShader); 197 205 return hrc; … … 209 217 } 210 218 211 EnterCriticalSection(&d3d9_cs);219 wined3d_mutex_lock(); 212 220 hr = IWineD3DDevice_SetVertexShaderConstantF(This->WineD3DDevice, Register, pConstantData, Vector4fCount); 213 LeaveCriticalSection(&d3d9_cs); 221 wined3d_mutex_unlock(); 222 214 223 return hr; 215 224 } … … 226 235 227 236 TRACE("(%p) : Relay\n", This); 228 EnterCriticalSection(&d3d9_cs); 237 238 wined3d_mutex_lock(); 229 239 hr = IWineD3DDevice_GetVertexShaderConstantF(This->WineD3DDevice, Register, pConstantData, Vector4fCount); 230 LeaveCriticalSection(&d3d9_cs); 240 wined3d_mutex_unlock(); 241 231 242 return hr; 232 243 } … … 237 248 TRACE("(%p) : Relay\n", This); 238 249 239 EnterCriticalSection(&d3d9_cs);250 wined3d_mutex_lock(); 240 251 hr = IWineD3DDevice_SetVertexShaderConstantI(This->WineD3DDevice, Register, pConstantData, Vector4iCount); 241 LeaveCriticalSection(&d3d9_cs); 252 wined3d_mutex_unlock(); 253 242 254 return hr; 243 255 } … … 248 260 TRACE("(%p) : Relay\n", This); 249 261 250 EnterCriticalSection(&d3d9_cs);262 wined3d_mutex_lock(); 251 263 hr = IWineD3DDevice_GetVertexShaderConstantI(This->WineD3DDevice, Register, pConstantData, Vector4iCount); 252 LeaveCriticalSection(&d3d9_cs); 264 wined3d_mutex_unlock(); 265 253 266 return hr; 254 267 } … … 259 272 TRACE("(%p) : Relay\n", This); 260 273 261 EnterCriticalSection(&d3d9_cs);274 wined3d_mutex_lock(); 262 275 hr = IWineD3DDevice_SetVertexShaderConstantB(This->WineD3DDevice, Register, pConstantData, BoolCount); 263 LeaveCriticalSection(&d3d9_cs); 276 wined3d_mutex_unlock(); 277 264 278 return hr; 265 279 } … … 270 284 TRACE("(%p) : Relay\n", This); 271 285 272 EnterCriticalSection(&d3d9_cs);286 wined3d_mutex_lock(); 273 287 hr = IWineD3DDevice_GetVertexShaderConstantB(This->WineD3DDevice, Register, pConstantData, BoolCount); 274 LeaveCriticalSection(&d3d9_cs); 275 return hr; 276 } 288 wined3d_mutex_unlock(); 289 290 return hr; 291 } -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/volume.c
r21731 r23571 63 63 ULONG ref = InterlockedIncrement(&This->ref); 64 64 TRACE("(%p) : AddRef from %d\n", This, ref - 1); 65 66 if (ref == 1) 67 { 68 wined3d_mutex_lock(); 69 IWineD3DVolume_AddRef(This->wineD3DVolume); 70 wined3d_mutex_unlock(); 71 } 72 65 73 return ref; 66 74 } … … 82 90 83 91 if (ref == 0) { 84 EnterCriticalSection(&d3d9_cs);92 wined3d_mutex_lock(); 85 93 IWineD3DVolume_Release(This->wineD3DVolume); 86 LeaveCriticalSection(&d3d9_cs); 87 HeapFree(GetProcessHeap(), 0, This); 94 wined3d_mutex_unlock(); 88 95 } 89 96 … … 99 106 TRACE("iface %p, ppDevice %p\n", iface, ppDevice); 100 107 101 EnterCriticalSection(&d3d9_cs);108 wined3d_mutex_lock(); 102 109 103 110 IWineD3DVolume_GetDevice(This->wineD3DVolume, &myDevice); … … 105 112 IWineD3DDevice_Release(myDevice); 106 113 107 LeaveCriticalSection(&d3d9_cs);114 wined3d_mutex_unlock(); 108 115 109 116 return D3D_OK; … … 116 123 TRACE("(%p) Relay\n", This); 117 124 118 EnterCriticalSection(&d3d9_cs);125 wined3d_mutex_lock(); 119 126 120 127 hr = IWineD3DVolume_SetPrivateData(This->wineD3DVolume, refguid, pData, SizeOfData, Flags); 121 128 122 LeaveCriticalSection(&d3d9_cs);129 wined3d_mutex_unlock(); 123 130 124 131 return hr; … … 131 138 TRACE("(%p) Relay\n", This); 132 139 133 EnterCriticalSection(&d3d9_cs);140 wined3d_mutex_lock(); 134 141 135 142 hr = IWineD3DVolume_GetPrivateData(This->wineD3DVolume, refguid, pData, pSizeOfData); 136 143 137 LeaveCriticalSection(&d3d9_cs);144 wined3d_mutex_unlock(); 138 145 139 146 return hr; … … 146 153 TRACE("(%p) Relay\n", This); 147 154 148 EnterCriticalSection(&d3d9_cs);155 wined3d_mutex_lock(); 149 156 150 157 hr = IWineD3DVolume_FreePrivateData(This->wineD3DVolume, refguid); 151 158 152 LeaveCriticalSection(&d3d9_cs);159 wined3d_mutex_unlock(); 153 160 154 161 return hr; … … 181 188 TRACE("(%p) Relay\n", This); 182 189 183 EnterCriticalSection(&d3d9_cs);190 wined3d_mutex_lock(); 184 191 185 192 hr = IWineD3DVolume_GetDesc(This->wineD3DVolume, &wined3ddesc); 186 193 187 LeaveCriticalSection(&d3d9_cs);194 wined3d_mutex_unlock(); 188 195 189 196 if (SUCCEEDED(hr)) … … 207 214 TRACE("(%p) relay %p %p %p %d\n", This, This->wineD3DVolume, pLockedVolume, pBox, Flags); 208 215 209 EnterCriticalSection(&d3d9_cs);216 wined3d_mutex_lock(); 210 217 211 218 hr = IWineD3DVolume_LockBox(This->wineD3DVolume, (WINED3DLOCKED_BOX *)pLockedVolume, 212 219 (const WINED3DBOX *)pBox, Flags); 213 220 214 LeaveCriticalSection(&d3d9_cs);221 wined3d_mutex_unlock(); 215 222 216 223 return hr; … … 223 230 TRACE("(%p) relay %p\n", This, This->wineD3DVolume); 224 231 225 EnterCriticalSection(&d3d9_cs);232 wined3d_mutex_lock(); 226 233 227 234 hr = IWineD3DVolume_UnlockBox(This->wineD3DVolume); 228 235 229 LeaveCriticalSection(&d3d9_cs);230 231 return hr; 232 } 233 234 const IDirect3DVolume9Vtbl Direct3DVolume9_Vtbl =236 wined3d_mutex_unlock(); 237 238 return hr; 239 } 240 241 static const IDirect3DVolume9Vtbl Direct3DVolume9_Vtbl = 235 242 { 236 243 /* IUnknown */ … … 249 256 }; 250 257 251 ULONG WINAPI D3D9CB_DestroyVolume(IWineD3DVolume *pVolume) { 252 IDirect3DVolume9Impl* volumeParent; 253 254 IWineD3DVolume_GetParent(pVolume, (IUnknown **) &volumeParent); 255 /* GetParent's AddRef was forwarded to an object in destruction. 256 * Releasing it here again would cause an endless recursion. */ 257 volumeParent->forwardReference = NULL; 258 return IDirect3DVolume9_Release((IDirect3DVolume9*) volumeParent); 259 } 258 static void STDMETHODCALLTYPE volume_wined3d_object_destroyed(void *parent) 259 { 260 HeapFree(GetProcessHeap(), 0, parent); 261 } 262 263 static const struct wined3d_parent_ops d3d9_volume_wined3d_parent_ops = 264 { 265 volume_wined3d_object_destroyed, 266 }; 267 268 HRESULT volume_init(IDirect3DVolume9Impl *volume, IDirect3DDevice9Impl *device, UINT width, UINT height, 269 UINT depth, DWORD usage, WINED3DFORMAT format, WINED3DPOOL pool) 270 { 271 HRESULT hr; 272 273 volume->lpVtbl = &Direct3DVolume9_Vtbl; 274 volume->ref = 1; 275 276 hr = IWineD3DDevice_CreateVolume(device->WineD3DDevice, width, height, depth, usage & WINED3DUSAGE_MASK, 277 format, pool, &volume->wineD3DVolume, (IUnknown *)volume, &d3d9_volume_wined3d_parent_ops); 278 if (FAILED(hr)) 279 { 280 WARN("Failed to create wined3d volume, hr %#x.\n", hr); 281 return hr; 282 } 283 284 return D3D_OK; 285 } -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/volumetexture.c
r21731 r23571 58 58 TRACE("(%p) : AddRef from %d\n", This, ref - 1); 59 59 60 if (ref == 1) 61 { 62 IDirect3DDevice9Ex_AddRef(This->parentDevice); 63 wined3d_mutex_lock(); 64 IWineD3DVolumeTexture_AddRef(This->wineD3DVolumeTexture); 65 wined3d_mutex_unlock(); 66 } 67 60 68 return ref; 61 69 } … … 68 76 69 77 if (ref == 0) { 70 EnterCriticalSection(&d3d9_cs);71 IWineD3DVolumeTexture_Destroy(This->wineD3DVolumeTexture, D3D9CB_DestroyVolume);72 LeaveCriticalSection(&d3d9_cs);73 78 IDirect3DDevice9Ex_Release(This->parentDevice); 74 HeapFree(GetProcessHeap(), 0, This); 79 wined3d_mutex_lock(); 80 IWineD3DVolumeTexture_Release(This->wineD3DVolumeTexture); 81 wined3d_mutex_unlock(); 75 82 } 76 83 return ref; … … 85 92 TRACE("(%p) Relay\n", This); 86 93 87 EnterCriticalSection(&d3d9_cs);94 wined3d_mutex_lock(); 88 95 hr = IWineD3DStateBlock_GetDevice(This->wineD3DVolumeTexture, &wined3d_device); 89 96 if (SUCCEEDED(hr)) … … 92 99 IWineD3DDevice_Release(wined3d_device); 93 100 } 94 LeaveCriticalSection(&d3d9_cs);101 wined3d_mutex_unlock(); 95 102 96 103 return hr; … … 103 110 TRACE("(%p) Relay\n", This); 104 111 105 EnterCriticalSection(&d3d9_cs);112 wined3d_mutex_lock(); 106 113 107 114 hr = IWineD3DVolumeTexture_SetPrivateData(This->wineD3DVolumeTexture, refguid, pData, SizeOfData, Flags); 108 115 109 LeaveCriticalSection(&d3d9_cs);116 wined3d_mutex_unlock(); 110 117 111 118 return hr; … … 118 125 TRACE("(%p) Relay\n", This); 119 126 120 EnterCriticalSection(&d3d9_cs);127 wined3d_mutex_lock(); 121 128 122 129 hr = IWineD3DVolumeTexture_GetPrivateData(This->wineD3DVolumeTexture, refguid, pData, pSizeOfData); 123 130 124 LeaveCriticalSection(&d3d9_cs);131 wined3d_mutex_unlock(); 125 132 126 133 return hr; … … 133 140 TRACE("(%p) Relay\n", This); 134 141 135 EnterCriticalSection(&d3d9_cs);142 wined3d_mutex_lock(); 136 143 137 144 hr = IWineD3DVolumeTexture_FreePrivateData(This->wineD3DVolumeTexture, refguid); 138 145 139 LeaveCriticalSection(&d3d9_cs);146 wined3d_mutex_unlock(); 140 147 141 148 return hr; … … 148 155 TRACE("(%p) Relay\n", This); 149 156 150 EnterCriticalSection(&d3d9_cs);157 wined3d_mutex_lock(); 151 158 152 159 priority = IWineD3DVolumeTexture_SetPriority(This->wineD3DVolumeTexture, PriorityNew); 153 160 154 LeaveCriticalSection(&d3d9_cs);161 wined3d_mutex_unlock(); 155 162 156 163 return priority; … … 163 170 TRACE("(%p) Relay\n", This); 164 171 165 EnterCriticalSection(&d3d9_cs);172 wined3d_mutex_lock(); 166 173 167 174 priority = IWineD3DVolumeTexture_GetPriority(This->wineD3DVolumeTexture); 168 175 169 LeaveCriticalSection(&d3d9_cs);176 wined3d_mutex_unlock(); 170 177 171 178 return priority; … … 177 184 TRACE("(%p) Relay\n", This); 178 185 179 EnterCriticalSection(&d3d9_cs);186 wined3d_mutex_lock(); 180 187 181 188 IWineD3DVolumeTexture_PreLoad(This->wineD3DVolumeTexture); 182 189 183 LeaveCriticalSection(&d3d9_cs);190 wined3d_mutex_unlock(); 184 191 } 185 192 … … 190 197 TRACE("(%p) Relay\n", This); 191 198 192 EnterCriticalSection(&d3d9_cs);199 wined3d_mutex_lock(); 193 200 194 201 type = IWineD3DVolumeTexture_GetType(This->wineD3DVolumeTexture); 195 202 196 LeaveCriticalSection(&d3d9_cs);203 wined3d_mutex_unlock(); 197 204 198 205 return type; … … 206 213 TRACE("(%p) Relay\n", This); 207 214 208 EnterCriticalSection(&d3d9_cs);215 wined3d_mutex_lock(); 209 216 210 217 lod = IWineD3DVolumeTexture_SetLOD(This->wineD3DVolumeTexture, LODNew); 211 218 212 LeaveCriticalSection(&d3d9_cs);219 wined3d_mutex_unlock(); 213 220 214 221 return lod; … … 221 228 TRACE("(%p) Relay\n", This); 222 229 223 EnterCriticalSection(&d3d9_cs);230 wined3d_mutex_lock(); 224 231 225 232 lod = IWineD3DVolumeTexture_GetLOD(This->wineD3DVolumeTexture); 226 233 227 LeaveCriticalSection(&d3d9_cs);234 wined3d_mutex_unlock(); 228 235 229 236 return lod; … … 236 243 TRACE("(%p) Relay\n", This); 237 244 238 EnterCriticalSection(&d3d9_cs);245 wined3d_mutex_lock(); 239 246 240 247 level_count = IWineD3DVolumeTexture_GetLevelCount(This->wineD3DVolumeTexture); 241 248 242 LeaveCriticalSection(&d3d9_cs);249 wined3d_mutex_unlock(); 243 250 244 251 return level_count; … … 251 258 TRACE("(%p) Relay\n", This); 252 259 253 EnterCriticalSection(&d3d9_cs);260 wined3d_mutex_lock(); 254 261 255 262 hr = IWineD3DVolumeTexture_SetAutoGenFilterType(This->wineD3DVolumeTexture, (WINED3DTEXTUREFILTERTYPE) FilterType); 256 263 257 LeaveCriticalSection(&d3d9_cs);264 wined3d_mutex_unlock(); 258 265 259 266 return hr; … … 266 273 TRACE("(%p) Relay\n", This); 267 274 268 EnterCriticalSection(&d3d9_cs);275 wined3d_mutex_lock(); 269 276 270 277 filter_type = (D3DTEXTUREFILTERTYPE)IWineD3DVolumeTexture_GetAutoGenFilterType(This->wineD3DVolumeTexture); 271 278 272 LeaveCriticalSection(&d3d9_cs);279 wined3d_mutex_unlock(); 273 280 274 281 return filter_type; … … 280 287 TRACE("(%p) Relay\n", This); 281 288 282 EnterCriticalSection(&d3d9_cs);289 wined3d_mutex_lock(); 283 290 284 291 IWineD3DVolumeTexture_GenerateMipSubLevels(This->wineD3DVolumeTexture); 285 292 286 LeaveCriticalSection(&d3d9_cs);293 wined3d_mutex_unlock(); 287 294 } 288 295 … … 295 302 TRACE("(%p) Relay\n", This); 296 303 297 EnterCriticalSection(&d3d9_cs);304 wined3d_mutex_lock(); 298 305 299 306 hr = IWineD3DVolumeTexture_GetLevelDesc(This->wineD3DVolumeTexture, Level, &wined3ddesc); 300 307 301 LeaveCriticalSection(&d3d9_cs);308 wined3d_mutex_unlock(); 302 309 303 310 if (SUCCEEDED(hr)) … … 322 329 TRACE("(%p) Relay\n", This); 323 330 324 EnterCriticalSection(&d3d9_cs);331 wined3d_mutex_lock(); 325 332 326 333 hrc = IWineD3DVolumeTexture_GetVolumeLevel(This->wineD3DVolumeTexture, Level, &myVolume); … … 330 337 } 331 338 332 LeaveCriticalSection(&d3d9_cs);339 wined3d_mutex_unlock(); 333 340 334 341 return hrc; … … 341 348 TRACE("(%p) Relay %p %p %p %d\n", This, This->wineD3DVolumeTexture, pLockedVolume, pBox,Flags); 342 349 343 EnterCriticalSection(&d3d9_cs);350 wined3d_mutex_lock(); 344 351 345 352 hr = IWineD3DVolumeTexture_LockBox(This->wineD3DVolumeTexture, Level, (WINED3DLOCKED_BOX *)pLockedVolume, 346 353 (const WINED3DBOX *)pBox, Flags); 347 354 348 LeaveCriticalSection(&d3d9_cs);355 wined3d_mutex_unlock(); 349 356 350 357 return hr; … … 357 364 TRACE("(%p) Relay %p %d\n", This, This->wineD3DVolumeTexture, Level); 358 365 359 EnterCriticalSection(&d3d9_cs);366 wined3d_mutex_lock(); 360 367 361 368 hr = IWineD3DVolumeTexture_UnlockBox(This->wineD3DVolumeTexture, Level); 362 369 363 LeaveCriticalSection(&d3d9_cs);370 wined3d_mutex_unlock(); 364 371 365 372 return hr; … … 372 379 TRACE("(%p) Relay\n", This); 373 380 374 EnterCriticalSection(&d3d9_cs);381 wined3d_mutex_lock(); 375 382 376 383 hr = IWineD3DVolumeTexture_AddDirtyBox(This->wineD3DVolumeTexture, (CONST WINED3DBOX *)pDirtyBox); 377 384 378 LeaveCriticalSection(&d3d9_cs);385 wined3d_mutex_unlock(); 379 386 380 387 return hr; … … 412 419 }; 413 420 414 415 /* IDirect3DDevice9 IDirect3DVolumeTexture9 Methods follow: */ 416 HRESULT WINAPI IDirect3DDevice9Impl_CreateVolumeTexture(LPDIRECT3DDEVICE9EX iface, 417 UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, 418 D3DFORMAT Format, D3DPOOL Pool, 419 IDirect3DVolumeTexture9** ppVolumeTexture, HANDLE* pSharedHandle) { 420 421 IDirect3DVolumeTexture9Impl *object; 422 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 423 HRESULT hrc = D3D_OK; 424 425 TRACE("(%p) Relay\n", This); 426 427 /* Allocate the storage for the device */ 428 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DVolumeTexture9Impl)); 429 if (NULL == object) { 430 ERR("(%p) allocation of memory failed, returning D3DERR_OUTOFVIDEOMEMORY\n", This); 431 return D3DERR_OUTOFVIDEOMEMORY; 432 } 433 434 object->lpVtbl = &Direct3DVolumeTexture9_Vtbl; 435 object->ref = 1; 436 437 EnterCriticalSection(&d3d9_cs); 438 439 hrc = IWineD3DDevice_CreateVolumeTexture(This->WineD3DDevice, Width, Height, Depth, Levels, 440 Usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(Format), 441 Pool, &object->wineD3DVolumeTexture, (IUnknown *)object); 442 443 LeaveCriticalSection(&d3d9_cs); 444 445 if (hrc != D3D_OK) { 446 447 /* free up object */ 448 WARN("(%p) call to IWineD3DDevice_CreateVolumeTexture failed\n", This); 449 HeapFree(GetProcessHeap(), 0, object); 450 } else { 451 IDirect3DDevice9Ex_AddRef(iface); 452 object->parentDevice = iface; 453 *ppVolumeTexture = (LPDIRECT3DVOLUMETEXTURE9) object; 454 TRACE("(%p) : Created volume texture %p\n", This, object); 455 } 456 TRACE("(%p) returning %p\n", This , *ppVolumeTexture); 457 return hrc; 458 } 421 static void STDMETHODCALLTYPE volumetexture_wined3d_object_destroyed(void *parent) 422 { 423 HeapFree(GetProcessHeap(), 0, parent); 424 } 425 426 static const struct wined3d_parent_ops d3d9_volumetexture_wined3d_parent_ops = 427 { 428 volumetexture_wined3d_object_destroyed, 429 }; 430 431 HRESULT volumetexture_init(IDirect3DVolumeTexture9Impl *texture, IDirect3DDevice9Impl *device, 432 UINT width, UINT height, UINT depth, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool) 433 { 434 HRESULT hr; 435 436 texture->lpVtbl = &Direct3DVolumeTexture9_Vtbl; 437 texture->ref = 1; 438 439 wined3d_mutex_lock(); 440 hr = IWineD3DDevice_CreateVolumeTexture(device->WineD3DDevice, width, height, depth, levels, 441 usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(format), pool, 442 &texture->wineD3DVolumeTexture, (IUnknown *)texture, &d3d9_volumetexture_wined3d_parent_ops); 443 wined3d_mutex_unlock(); 444 if (FAILED(hr)) 445 { 446 WARN("Failed to create wined3d volume texture, hr %#x.\n", hr); 447 return hr; 448 } 449 450 texture->parentDevice = (IDirect3DDevice9Ex *)device; 451 IDirect3DDevice9Ex_AddRef(texture->parentDevice); 452 453 return D3D_OK; 454 }
Note:
See TracChangeset
for help on using the changeset viewer.