case WINED3DFMT_X8L8V8U8: return D3DFMT_X8L8V8U8;
case WINED3DFMT_R8G8B8A8_SNORM: return D3DFMT_Q8W8V8U8;
case WINED3DFMT_R16G16_SNORM: return D3DFMT_V16U16;
+ case WINED3DFMT_W11V11U10: return D3DFMT_W11V11U10;
case WINED3DFMT_A2W10V10U10: return D3DFMT_A2W10V10U10;
case WINED3DFMT_D16_LOCKABLE: return D3DFMT_D16_LOCKABLE;
case WINED3DFMT_D32: return D3DFMT_D32;
case D3DFMT_X8L8V8U8: return WINED3DFMT_X8L8V8U8;
case D3DFMT_Q8W8V8U8: return WINED3DFMT_R8G8B8A8_SNORM;
case D3DFMT_V16U16: return WINED3DFMT_R16G16_SNORM;
+ case D3DFMT_W11V11U10: return WINED3DFMT_W11V11U10;
case D3DFMT_A2W10V10U10: return WINED3DFMT_A2W10V10U10;
case D3DFMT_D16_LOCKABLE: return WINED3DFMT_D16_LOCKABLE;
case D3DFMT_D32: return WINED3DFMT_D32;
}
/* Handle table functions */
-static DWORD d3d8_allocate_handle(struct d3d8_handle_table *t, void *object)
+static DWORD d3d8_allocate_handle(struct d3d8_handle_table *t, void *object, enum d3d8_handle_type type)
{
+ struct d3d8_handle_entry *entry;
+
if (t->free_entries)
{
/* Use a free handle */
- void **entry = t->free_entries;
- t->free_entries = *entry;
- *entry = object;
+ entry = t->free_entries;
+ if (entry->type != D3D8_HANDLE_FREE)
+ {
+ ERR("Handle %u(%p) is in the free list, but has type %#x.\n", (entry - t->entries), entry, entry->type);
+ return D3D8_INVALID_HANDLE;
+ }
+ t->free_entries = entry->object;
+ entry->object = object;
+ entry->type = type;
+
return entry - t->entries;
}
{
/* Grow the table */
UINT new_size = t->table_size + (t->table_size >> 1);
- void **new_entries = HeapReAlloc(GetProcessHeap(), 0, t->entries, new_size * sizeof(void *));
- if (!new_entries) return D3D8_INVALID_HANDLE;
+ struct d3d8_handle_entry *new_entries = HeapReAlloc(GetProcessHeap(),
+ 0, t->entries, new_size * sizeof(*t->entries));
+ if (!new_entries)
+ {
+ ERR("Failed to grow the handle table.\n");
+ return D3D8_INVALID_HANDLE;
+ }
t->entries = new_entries;
t->table_size = new_size;
}
- t->entries[t->entry_count] = object;
+ entry = &t->entries[t->entry_count];
+ entry->object = object;
+ entry->type = type;
+
return t->entry_count++;
}
-static void *d3d8_free_handle(struct d3d8_handle_table *t, DWORD handle)
+static void *d3d8_free_handle(struct d3d8_handle_table *t, DWORD handle, enum d3d8_handle_type type)
{
- void **entry, *object;
+ struct d3d8_handle_entry *entry;
+ void *object;
- if (handle >= t->entry_count) return NULL;
+ if (handle == D3D8_INVALID_HANDLE || handle >= t->entry_count)
+ {
+ WARN("Invalid handle %u passed.\n", handle);
+ return NULL;
+ }
entry = &t->entries[handle];
- object = *entry;
- *entry = t->free_entries;
+ if (entry->type != type)
+ {
+ WARN("Handle %u(%p) is not of type %#x.\n", handle, entry, type);
+ return NULL;
+ }
+
+ object = entry->object;
+ entry->object = t->free_entries;
+ entry->type = D3D8_HANDLE_FREE;
t->free_entries = entry;
return object;
}
-static void *d3d8_get_object(struct d3d8_handle_table *t, DWORD handle)
+static void *d3d8_get_object(struct d3d8_handle_table *t, DWORD handle, enum d3d8_handle_type type)
{
- if (handle >= t->entry_count) return NULL;
- return t->entries[handle];
+ struct d3d8_handle_entry *entry;
+
+ if (handle == D3D8_INVALID_HANDLE || handle >= t->entry_count)
+ {
+ WARN("Invalid handle %u passed.\n", handle);
+ return NULL;
+ }
+
+ entry = &t->entries[handle];
+ if (entry->type != type)
+ {
+ WARN("Handle %u(%p) is not of type %#x.\n", handle, entry, type);
+ return NULL;
+ }
+
+ return entry->object;
}
/* IDirect3D IUnknown parts follow: */
unsigned i;
TRACE("Releasing wined3d device %p\n", This->WineD3DDevice);
- EnterCriticalSection(&d3d8_cs);
+
+ wined3d_mutex_lock();
+
This->inDestruction = TRUE;
for(i = 0; i < This->numConvertedDecls; i++) {
IWineD3DDevice_Release(This->WineD3DDevice);
HeapFree(GetProcessHeap(), 0, This->handle_table.entries);
HeapFree(GetProcessHeap(), 0, This);
- LeaveCriticalSection(&d3d8_cs);
+
+ wined3d_mutex_unlock();
}
return ref;
}
HRESULT hr;
TRACE("(%p) : Relay\n", This);
- EnterCriticalSection(&d3d8_cs);
+
+ wined3d_mutex_lock();
hr = IWineD3DDevice_TestCooperativeLevel(This->WineD3DDevice);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
HRESULT hr;
TRACE("(%p) Relay\n", This);
- EnterCriticalSection(&d3d8_cs);
+
+ wined3d_mutex_lock();
hr = IWineD3DDevice_GetAvailableTextureMem(This->WineD3DDevice);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
HRESULT hr;
TRACE("(%p) : Relay bytes(%d)\n", This, Bytes);
- EnterCriticalSection(&d3d8_cs);
+
+ wined3d_mutex_lock();
hr = IWineD3DDevice_EvictManagedResources(This->WineD3DDevice);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
return D3DERR_INVALIDCALL;
}
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_GetDirect3D(This->WineD3DDevice, &pWineD3D);
if (hr == D3D_OK && pWineD3D != NULL)
{
FIXME("Call to IWineD3DDevice_GetDirect3D failed\n");
*ppD3D8 = NULL;
}
+ wined3d_mutex_unlock();
+
TRACE("(%p) returning %p\n",This , *ppD3D8);
- LeaveCriticalSection(&d3d8_cs);
return hr;
}
return D3DERR_INVALIDCALL; /* well this is what MSDN says to return */
}
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hrc = IWineD3DDevice_GetDeviceCaps(This->WineD3DDevice, pWineCaps);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
+ fixup_caps(pWineCaps);
WINECAPSTOD3D8CAPS(pCaps, pWineCaps)
HeapFree(GetProcessHeap(), 0, pWineCaps);
- /* D3D8 doesn't support SM 2.0 or higher, so clamp to 1.x */
- if(pCaps->PixelShaderVersion > D3DPS_VERSION(1,4)){
- pCaps->PixelShaderVersion = D3DPS_VERSION(1,4);
- }
- if(pCaps->VertexShaderVersion > D3DVS_VERSION(1,1)){
- pCaps->VertexShaderVersion = D3DVS_VERSION(1,1);
- }
- pCaps->MaxVertexShaderConst = min(D3D8_MAX_VERTEX_SHADER_CONSTANTF, pCaps->MaxVertexShaderConst);
-
TRACE("Returning %p %p\n", This, pCaps);
return hrc;
}
HRESULT hr;
TRACE("(%p) Relay\n", This);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_GetDisplayMode(This->WineD3DDevice, 0, (WINED3DDISPLAYMODE *) pMode);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
if (SUCCEEDED(hr)) pMode->Format = d3dformat_from_wined3dformat(pMode->Format);
HRESULT hr;
TRACE("(%p) Relay\n", This);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_GetCreationParameters(This->WineD3DDevice, (WINED3DDEVICE_CREATION_PARAMETERS *) pParameters);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
return WINED3DERR_INVALIDCALL;
}
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_SetCursorProperties(This->WineD3DDevice,XHotSpot,YHotSpot,pSurface->wineD3DSurface);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
TRACE("(%p) Relay\n", This);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
IWineD3DDevice_SetCursorPosition(This->WineD3DDevice, XScreenSpace, YScreenSpace, Flags);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
}
static BOOL WINAPI IDirect3DDevice8Impl_ShowCursor(LPDIRECT3DDEVICE8 iface, BOOL bShow) {
BOOL ret;
TRACE("(%p) Relay\n", This);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
ret = IWineD3DDevice_ShowCursor(This->WineD3DDevice, bShow);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return ret;
}
localParameters.PresentationInterval = pPresentationParameters->FullScreen_PresentationInterval;
localParameters.AutoRestoreDisplayMode = TRUE;
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hrc = IWineD3DDevice_CreateSwapChain(This->WineD3DDevice, &localParameters,
&object->wineD3DSwapChain, (IUnknown *)object, SURFACE_OPENGL);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
pPresentationParameters->BackBufferWidth = localParameters.BackBufferWidth;
pPresentationParameters->BackBufferHeight = localParameters.BackBufferHeight;
localParameters.PresentationInterval = pPresentationParameters->FullScreen_PresentationInterval;
localParameters.AutoRestoreDisplayMode = TRUE;
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_Reset(This->WineD3DDevice, &localParameters);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
pPresentationParameters->BackBufferWidth = localParameters.BackBufferWidth;
pPresentationParameters->BackBufferHeight = localParameters.BackBufferHeight;
HRESULT hr;
TRACE("(%p) Relay\n", This);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_Present(This->WineD3DDevice, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
TRACE("(%p) Relay\n", This);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
rc = IWineD3DDevice_GetBackBuffer(This->WineD3DDevice, 0, BackBuffer, (WINED3DBACKBUFFER_TYPE) Type, &retSurface);
if (rc == D3D_OK && NULL != retSurface && NULL != ppBackBuffer) {
IWineD3DSurface_GetParent(retSurface, (IUnknown **)ppBackBuffer);
IWineD3DSurface_Release(retSurface);
}
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return rc;
}
HRESULT hr;
TRACE("(%p) Relay\n", This);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_GetRasterStatus(This->WineD3DDevice, 0, (WINED3DRASTER_STATUS *) pRasterStatus);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
TRACE("(%p) Relay\n", This);
/* Note: D3DGAMMARAMP is compatible with WINED3DGAMMARAMP */
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
IWineD3DDevice_SetGammaRamp(This->WineD3DDevice, 0, Flags, (CONST WINED3DGAMMARAMP *) pRamp);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
}
static void WINAPI IDirect3DDevice8Impl_GetGammaRamp(LPDIRECT3DDEVICE8 iface, D3DGAMMARAMP* pRamp) {
TRACE("(%p) Relay\n", This);
/* Note: D3DGAMMARAMP is compatible with WINED3DGAMMARAMP */
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
IWineD3DDevice_GetGammaRamp(This->WineD3DDevice, 0, (WINED3DGAMMARAMP *) pRamp);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
}
static HRESULT WINAPI IDirect3DDevice8Impl_CreateTexture(LPDIRECT3DDEVICE8 iface, UINT Width, UINT Height, UINT Levels, DWORD Usage,
object->lpVtbl = &Direct3DTexture8_Vtbl;
object->ref = 1;
- EnterCriticalSection(&d3d8_cs);
+
+ wined3d_mutex_lock();
hrc = IWineD3DDevice_CreateTexture(This->WineD3DDevice, Width, Height, Levels, Usage & WINED3DUSAGE_MASK,
wined3dformat_from_d3dformat(Format), Pool, &object->wineD3DTexture, (IUnknown *)object);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
if (FAILED(hrc)) {
- /* free up object */
+ /* free up object */
FIXME("(%p) call to IWineD3DDevice_CreateTexture failed\n", This);
HeapFree(GetProcessHeap(), 0, object);
/* *ppTexture = NULL; */
return hrc;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_CreateVolumeTexture(LPDIRECT3DDEVICE8 iface,
- UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage,
- D3DFORMAT Format, D3DPOOL Pool, IDirect3DVolumeTexture8** ppVolumeTexture) {
-
+static HRESULT WINAPI IDirect3DDevice8Impl_CreateVolumeTexture(IDirect3DDevice8 *iface,
+ UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, D3DFORMAT Format,
+ D3DPOOL Pool, IDirect3DVolumeTexture8 **ppVolumeTexture)
+{
IDirect3DVolumeTexture8Impl *object;
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
HRESULT hrc = D3D_OK;
object->lpVtbl = &Direct3DVolumeTexture8_Vtbl;
object->ref = 1;
- EnterCriticalSection(&d3d8_cs);
+
+ wined3d_mutex_lock();
hrc = IWineD3DDevice_CreateVolumeTexture(This->WineD3DDevice, Width, Height, Depth, Levels,
Usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(Format),
Pool, &object->wineD3DVolumeTexture, (IUnknown *)object);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
if (hrc != D3D_OK) {
return hrc;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_CreateCubeTexture(LPDIRECT3DDEVICE8 iface, UINT EdgeLength, UINT Levels, DWORD Usage,
- D3DFORMAT Format, D3DPOOL Pool, IDirect3DCubeTexture8** ppCubeTexture) {
-
+static HRESULT WINAPI IDirect3DDevice8Impl_CreateCubeTexture(IDirect3DDevice8 *iface, UINT EdgeLength,
+ UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DCubeTexture8 **ppCubeTexture)
+{
IDirect3DCubeTexture8Impl *object;
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
HRESULT hr = D3D_OK;
object->lpVtbl = &Direct3DCubeTexture8_Vtbl;
object->ref = 1;
- EnterCriticalSection(&d3d8_cs);
+
+ wined3d_mutex_lock();
hr = IWineD3DDevice_CreateCubeTexture(This->WineD3DDevice, EdgeLength, Levels, Usage & WINED3DUSAGE_MASK,
wined3dformat_from_d3dformat(Format), Pool, &object->wineD3DCubeTexture, (IUnknown *)object);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
if (hr != D3D_OK){
object->lpVtbl = &Direct3DVertexBuffer8_Vtbl;
object->ref = 1;
- EnterCriticalSection(&d3d8_cs);
+
+ wined3d_mutex_lock();
hrc = IWineD3DDevice_CreateVertexBuffer(This->WineD3DDevice, Size, Usage & WINED3DUSAGE_MASK,
0 /* fvf for ddraw only */, (WINED3DPOOL)Pool, &object->wineD3DVertexBuffer, (IUnknown *)object);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
object->fvf = FVF;
if (D3D_OK != hrc) {
object->ref = 1;
object->format = wined3dformat_from_d3dformat(Format);
TRACE("Calling wined3d create index buffer\n");
- EnterCriticalSection(&d3d8_cs);
+
+ wined3d_mutex_lock();
hrc = IWineD3DDevice_CreateIndexBuffer(This->WineD3DDevice, Length, Usage & WINED3DUSAGE_MASK,
(WINED3DPOOL)Pool, &object->wineD3DIndexBuffer, (IUnknown *)object);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
if (D3D_OK != hrc) {
return hrc;
}
-static HRESULT IDirect3DDevice8Impl_CreateSurface(LPDIRECT3DDEVICE8 iface, UINT Width, UINT Height, D3DFORMAT Format, BOOL Lockable, BOOL Discard, UINT Level, IDirect3DSurface8 **ppSurface,D3DRESOURCETYPE Type, UINT Usage,D3DPOOL Pool, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality) {
+static HRESULT IDirect3DDevice8Impl_CreateSurface(LPDIRECT3DDEVICE8 iface, UINT Width, UINT Height,
+ D3DFORMAT Format, BOOL Lockable, BOOL Discard, UINT Level, IDirect3DSurface8 **ppSurface,
+ UINT Usage, D3DPOOL Pool, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality)
+{
HRESULT hrc;
IDirect3DSurface8Impl *object;
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
TRACE("(%p) : w(%d) h(%d) fmt(%d) surf@%p\n", This, Width, Height, Format, *ppSurface);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hrc = IWineD3DDevice_CreateSurface(This->WineD3DDevice, Width, Height, wined3dformat_from_d3dformat(Format),
- Lockable, Discard, Level, &object->wineD3DSurface, Type, Usage & WINED3DUSAGE_MASK,
- (WINED3DPOOL)Pool, MultiSample, MultisampleQuality, SURFACE_OPENGL, (IUnknown *)object);
- LeaveCriticalSection(&d3d8_cs);
+ Lockable, Discard, Level, &object->wineD3DSurface, Usage & WINED3DUSAGE_MASK, (WINED3DPOOL)Pool,
+ MultiSample, MultisampleQuality, SURFACE_OPENGL, (IUnknown *)object);
+ wined3d_mutex_unlock();
+
if (hrc != D3D_OK || NULL == object->wineD3DSurface) {
/* free up object */
FIXME("(%p) call to IWineD3DDevice_CreateSurface failed\n", This);
HRESULT hr;
TRACE("Relay\n");
- hr = IDirect3DDevice8Impl_CreateSurface(iface, Width, Height, Format, Lockable, FALSE /* Discard */, 0 /* Level */ , ppSurface, D3DRTYPE_SURFACE, D3DUSAGE_RENDERTARGET, D3DPOOL_DEFAULT, MultiSample, 0);
+ hr = IDirect3DDevice8Impl_CreateSurface(iface, Width, Height, Format, Lockable, FALSE /* Discard */,
+ 0 /* Level */, ppSurface, D3DUSAGE_RENDERTARGET, D3DPOOL_DEFAULT, MultiSample, 0);
+
return hr;
}
TRACE("Relay\n");
/* TODO: Verify that Discard is false */
- hr = IDirect3DDevice8Impl_CreateSurface(iface, Width, Height, Format, TRUE /* Lockable */, FALSE, 0 /* Level */
- ,ppSurface, D3DRTYPE_SURFACE, D3DUSAGE_DEPTHSTENCIL,
- D3DPOOL_DEFAULT, MultiSample, 0);
+ hr = IDirect3DDevice8Impl_CreateSurface(iface, Width, Height, Format, TRUE /* Lockable */, FALSE,
+ 0 /* Level */, ppSurface, D3DUSAGE_DEPTHSTENCIL, D3DPOOL_DEFAULT, MultiSample, 0);
+
return hr;
}
HRESULT hr;
TRACE("Relay\n");
- hr = IDirect3DDevice8Impl_CreateSurface(iface, Width, Height, Format, TRUE /* Loackable */ , FALSE /*Discard*/ , 0 /* Level */ , ppSurface,
- D3DRTYPE_SURFACE, 0 /* Usage (undefined/none) */ , D3DPOOL_SYSTEMMEM, D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */);
+ hr = IDirect3DDevice8Impl_CreateSurface(iface, Width, Height, Format, TRUE /* Lockable */, FALSE /* Discard */,
+ 0 /* Level */, ppSurface, 0 /* Usage (undefined/none) */, D3DPOOL_SYSTEMMEM, D3DMULTISAMPLE_NONE,
+ 0 /* MultisampleQuality */);
+
return hr;
}
/* Check that the source texture is in WINED3DPOOL_SYSTEMMEM and the destination texture is in WINED3DPOOL_DEFAULT */
- memset(&winedesc, 0, sizeof(winedesc));
- winedesc.Format = &srcFormat;
- winedesc.Width = &srcWidth;
- winedesc.Height = &srcHeight;
- winedesc.Size = &srcSize;
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
IWineD3DSurface_GetDesc(Source->wineD3DSurface, &winedesc);
+ srcFormat = winedesc.format;
+ srcWidth = winedesc.width;
+ srcHeight = winedesc.height;
+ srcSize = winedesc.size;
- winedesc.Format = &destFormat;
- winedesc.Width = &destWidth;
- winedesc.Height = &destHeight;
- winedesc.Size = NULL;
IWineD3DSurface_GetDesc(Dest->wineD3DSurface, &winedesc);
+ destFormat = winedesc.format;
+ destWidth = winedesc.width;
+ destHeight = winedesc.height;
/* Check that the source and destination formats match */
if (srcFormat != destFormat && WINED3DFMT_UNKNOWN != destFormat) {
WARN("(%p) source %p format must match the dest %p format, returning WINED3DERR_INVALIDCALL\n", iface, pSourceSurface, pDestinationSurface);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
return WINED3DERR_INVALIDCALL;
} else if (WINED3DFMT_UNKNOWN == destFormat) {
TRACE("(%p) : Converting destination surface from WINED3DFMT_UNKNOWN to the source format\n", iface);
}
}
}
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
return hr;
}
HRESULT hr;
TRACE("(%p) Relay\n" , This);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_UpdateTexture(This->WineD3DDevice, ((IDirect3DBaseTexture8Impl *)pSourceTexture)->wineD3DBaseTexture, ((IDirect3DBaseTexture8Impl *)pDestinationTexture)->wineD3DBaseTexture);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
return D3DERR_INVALIDCALL;
}
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_GetFrontBufferData(This->WineD3DDevice, 0, destSurface->wineD3DSurface);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
HRESULT hr;
TRACE("(%p) Relay\n" , This);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_GetDepthStencilSurface(This->WineD3DDevice, &original_ds);
if (hr == WINED3D_OK || hr == WINED3DERR_NOTFOUND)
}
if (original_ds) IWineD3DSurface_Release(original_ds);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
if (ppRenderTarget == NULL) {
return D3DERR_INVALIDCALL;
}
- EnterCriticalSection(&d3d8_cs);
+
+ wined3d_mutex_lock();
hr = IWineD3DDevice_GetRenderTarget(This->WineD3DDevice, 0, &pRenderTarget);
if (hr == D3D_OK && pRenderTarget != NULL) {
FIXME("Call to IWineD3DDevice_GetRenderTarget failed\n");
*ppRenderTarget = NULL;
}
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
return hr;
}
return D3DERR_INVALIDCALL;
}
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr=IWineD3DDevice_GetDepthStencilSurface(This->WineD3DDevice,&pZStencilSurface);
if (hr == WINED3D_OK) {
IWineD3DSurface_GetParent(pZStencilSurface,(IUnknown**)ppZStencilSurface);
FIXME("Call to IWineD3DDevice_GetDepthStencilSurface failed with 0x%08x\n", hr);
*ppZStencilSurface = NULL;
}
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
return hr;
}
HRESULT hr;
TRACE("(%p) Relay\n" , This);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_BeginScene(This->WineD3DDevice);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
HRESULT hr;
TRACE("(%p) Relay\n" , This);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_EndScene(This->WineD3DDevice);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
TRACE("(%p) Relay\n" , This);
/* Note: D3DRECT is compatible with WINED3DRECT */
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_Clear(This->WineD3DDevice, Count, (CONST WINED3DRECT*) pRects, Flags, Color, Z, Stencil);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
TRACE("(%p) Relay\n" , This);
/* Note: D3DMATRIX is compatible with WINED3DMATRIX */
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_SetTransform(This->WineD3DDevice, State, (CONST WINED3DMATRIX*) lpMatrix);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
TRACE("(%p) Relay\n" , This);
/* Note: D3DMATRIX is compatible with WINED3DMATRIX */
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_GetTransform(This->WineD3DDevice, State, (WINED3DMATRIX*) pMatrix);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
TRACE("(%p) Relay\n" , This);
/* Note: D3DMATRIX is compatible with WINED3DMATRIX */
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_MultiplyTransform(This->WineD3DDevice, State, (CONST WINED3DMATRIX*) pMatrix);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
TRACE("(%p) Relay\n" , This);
/* Note: D3DVIEWPORT8 is compatible with WINED3DVIEWPORT */
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_SetViewport(This->WineD3DDevice, (const WINED3DVIEWPORT *)pViewport);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
TRACE("(%p) Relay\n" , This);
/* Note: D3DVIEWPORT8 is compatible with WINED3DVIEWPORT */
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_GetViewport(This->WineD3DDevice, (WINED3DVIEWPORT *)pViewport);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
TRACE("(%p) Relay\n" , This);
/* Note: D3DMATERIAL8 is compatible with WINED3DMATERIAL */
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_SetMaterial(This->WineD3DDevice, (const WINED3DMATERIAL *)pMaterial);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
TRACE("(%p) Relay\n" , This);
/* Note: D3DMATERIAL8 is compatible with WINED3DMATERIAL */
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_GetMaterial(This->WineD3DDevice, (WINED3DMATERIAL *)pMaterial);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
HRESULT hr;
TRACE("(%p) Relay\n" , This);
-
+
/* Note: D3DLIGHT8 is compatible with WINED3DLIGHT */
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_SetLight(This->WineD3DDevice, Index, (const WINED3DLIGHT *)pLight);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
TRACE("(%p) Relay\n" , This);
/* Note: D3DLIGHT8 is compatible with WINED3DLIGHT */
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_GetLight(This->WineD3DDevice, Index, (WINED3DLIGHT *)pLight);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
HRESULT hr;
TRACE("(%p) Relay\n" , This);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_SetLightEnable(This->WineD3DDevice, Index, Enable);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
HRESULT hr;
TRACE("(%p) Relay\n" , This);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_GetLightEnable(This->WineD3DDevice, Index, pEnable);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
HRESULT hr;
TRACE("(%p) Relay\n" , This);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_SetClipPlane(This->WineD3DDevice, Index, pPlane);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
HRESULT hr;
TRACE("(%p) Relay\n" , This);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_GetClipPlane(This->WineD3DDevice, Index, pPlane);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
HRESULT hr;
TRACE("(%p) Relay\n" , This);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_SetRenderState(This->WineD3DDevice, State, Value);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
HRESULT hr;
TRACE("(%p) Relay\n" , This);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_GetRenderState(This->WineD3DDevice, State, pValue);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
HRESULT hr;
TRACE("(%p)\n", This);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_BeginStateBlock(This->WineD3DDevice);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
/* Tell wineD3D to endstateblock before anything else (in case we run out
* of memory later and cause locking problems)
*/
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_EndStateBlock(This->WineD3DDevice , &wineD3DStateBlock);
if (hr != D3D_OK) {
WARN("IWineD3DDevice_EndStateBlock returned an error\n");
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
return hr;
}
object->wineD3DStateBlock = wineD3DStateBlock;
- *pToken = d3d8_allocate_handle(&This->handle_table, object);
- LeaveCriticalSection(&d3d8_cs);
+ *pToken = d3d8_allocate_handle(&This->handle_table, object, D3D8_HANDLE_SB);
+ wined3d_mutex_unlock();
if (*pToken == D3D8_INVALID_HANDLE)
{
TRACE("(%p) %#x Relay\n", This, Token);
- EnterCriticalSection(&d3d8_cs);
- pSB = d3d8_get_object(&This->handle_table, Token - 1);
+ wined3d_mutex_lock();
+ pSB = d3d8_get_object(&This->handle_table, Token - 1, D3D8_HANDLE_SB);
if (!pSB)
{
WARN("Invalid handle (%#x) passed.\n", Token);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
return D3DERR_INVALIDCALL;
}
hr = IWineD3DStateBlock_Apply(pSB->wineD3DStateBlock);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
TRACE("(%p) %#x Relay\n", This, Token);
- EnterCriticalSection(&d3d8_cs);
- pSB = d3d8_get_object(&This->handle_table, Token - 1);
+ wined3d_mutex_lock();
+ pSB = d3d8_get_object(&This->handle_table, Token - 1, D3D8_HANDLE_SB);
if (!pSB)
{
WARN("Invalid handle (%#x) passed.\n", Token);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
return D3DERR_INVALIDCALL;
}
hr = IWineD3DStateBlock_Capture(pSB->wineD3DStateBlock);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
TRACE("(%p) Relay\n", This);
- EnterCriticalSection(&d3d8_cs);
- pSB = d3d8_free_handle(&This->handle_table, Token - 1);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
+ pSB = d3d8_free_handle(&This->handle_table, Token - 1, D3D8_HANDLE_SB);
+ wined3d_mutex_unlock();
if (!pSB)
{
object->lpVtbl = &Direct3DStateBlock8_Vtbl;
object->ref = 1;
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_CreateStateBlock(This->WineD3DDevice, (WINED3DSTATEBLOCKTYPE)Type,
&object->wineD3DStateBlock, (IUnknown *)object);
if (FAILED(hr))
{
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
ERR("IWineD3DDevice_CreateStateBlock failed, hr %#x\n", hr);
HeapFree(GetProcessHeap(), 0, object);
return hr;
}
- *handle = d3d8_allocate_handle(&This->handle_table, object);
- LeaveCriticalSection(&d3d8_cs);
+ *handle = d3d8_allocate_handle(&This->handle_table, object, D3D8_HANDLE_SB);
+ wined3d_mutex_unlock();
if (*handle == D3D8_INVALID_HANDLE)
{
HRESULT hr;
TRACE("(%p) Relay\n" , This);
/* FIXME: Verify that D3DCLIPSTATUS8 ~= WINED3DCLIPSTATUS */
- EnterCriticalSection(&d3d8_cs);
+
+ wined3d_mutex_lock();
hr = IWineD3DDevice_SetClipStatus(This->WineD3DDevice, (const WINED3DCLIPSTATUS *)pClipStatus);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
HRESULT hr;
TRACE("(%p) Relay\n" , This);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_GetClipStatus(This->WineD3DDevice, (WINED3DCLIPSTATUS *)pClipStatus);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
return D3DERR_INVALIDCALL;
}
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
rc = IWineD3DDevice_GetTexture(This->WineD3DDevice, Stage, &retTexture);
if (rc == D3D_OK && NULL != retTexture) {
IWineD3DBaseTexture_GetParent(retTexture, (IUnknown **)ppTexture);
FIXME("Call to get texture (%d) failed (%p)\n", Stage, retTexture);
*ppTexture = NULL;
}
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
return rc;
}
HRESULT hr;
TRACE("(%p) Relay %d %p\n" , This, Stage, pTexture);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_SetTexture(This->WineD3DDevice, Stage,
pTexture==NULL ? NULL : ((IDirect3DBaseTexture8Impl *)pTexture)->wineD3DBaseTexture);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
HRESULT hr;
TRACE("(%p) Relay\n" , This);
- EnterCriticalSection(&d3d8_cs);
-
+ wined3d_mutex_lock();
if (l->sampler_state) hr = IWineD3DDevice_GetSamplerState(This->WineD3DDevice, Stage, l->state, pValue);
else hr = IWineD3DDevice_GetTextureStageState(This->WineD3DDevice, Stage, l->state, pValue);
+ wined3d_mutex_unlock();
- LeaveCriticalSection(&d3d8_cs);
return hr;
}
HRESULT hr;
TRACE("(%p) Relay\n" , This);
- EnterCriticalSection(&d3d8_cs);
-
+ wined3d_mutex_lock();
if (l->sampler_state) hr = IWineD3DDevice_SetSamplerState(This->WineD3DDevice, Stage, l->state, Value);
else hr = IWineD3DDevice_SetTextureStageState(This->WineD3DDevice, Stage, l->state, Value);
+ wined3d_mutex_unlock();
- LeaveCriticalSection(&d3d8_cs);
return hr;
}
HRESULT hr;
TRACE("(%p) Relay\n" , This);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_ValidateDevice(This->WineD3DDevice, pNumPasses);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
HRESULT hr;
TRACE("(%p) Relay\n" , This);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_SetPaletteEntries(This->WineD3DDevice, PaletteNumber, pEntries);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
HRESULT hr;
TRACE("(%p) Relay\n" , This);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_GetPaletteEntries(This->WineD3DDevice, PaletteNumber, pEntries);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
HRESULT hr;
TRACE("(%p) Relay\n" , This);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_SetCurrentTexturePalette(This->WineD3DDevice, PaletteNumber);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
HRESULT hr;
TRACE("(%p) Relay\n" , This);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_GetCurrentTexturePalette(This->WineD3DDevice, PaletteNumber);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_DrawPrimitive(LPDIRECT3DDEVICE8 iface, D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount) {
- IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
+static HRESULT WINAPI IDirect3DDevice8Impl_DrawPrimitive(IDirect3DDevice8 *iface, D3DPRIMITIVETYPE PrimitiveType,
+ UINT StartVertex, UINT PrimitiveCount)
+{
+ IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
HRESULT hr;
TRACE("(%p) Relay\n" , This);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
IWineD3DDevice_SetPrimitiveType(This->WineD3DDevice, PrimitiveType);
hr = IWineD3DDevice_DrawPrimitive(This->WineD3DDevice, StartVertex,
vertex_count_from_primitive_count(PrimitiveType, PrimitiveCount));
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
HRESULT hr;
TRACE("(%p) Relay\n" , This);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
IWineD3DDevice_SetPrimitiveType(This->WineD3DDevice, PrimitiveType);
hr = IWineD3DDevice_DrawIndexedPrimitive(This->WineD3DDevice, MinVertexIndex, NumVertices,
startIndex, vertex_count_from_primitive_count(PrimitiveType, primCount));
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
HRESULT hr;
TRACE("(%p) Relay\n" , This);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
IWineD3DDevice_SetPrimitiveType(This->WineD3DDevice, PrimitiveType);
hr = IWineD3DDevice_DrawPrimitiveUP(This->WineD3DDevice,
vertex_count_from_primitive_count(PrimitiveType, PrimitiveCount),
pVertexStreamZeroData, VertexStreamZeroStride);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
HRESULT hr;
TRACE("(%p) Relay\n" , This);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
IWineD3DDevice_SetPrimitiveType(This->WineD3DDevice, PrimitiveType);
hr = IWineD3DDevice_DrawIndexedPrimitiveUP(This->WineD3DDevice, MinVertexIndex, NumVertexIndices,
vertex_count_from_primitive_count(PrimitiveType, PrimitiveCount), pIndexData,
wined3dformat_from_d3dformat(IndexDataFormat), pVertexStreamZeroData, VertexStreamZeroStride);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
IDirect3DVertexBuffer8Impl *dest = (IDirect3DVertexBuffer8Impl *) pDestBuffer;
TRACE("(%p) Relay\n" , This);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_ProcessVertices(This->WineD3DDevice,SrcStartIndex, DestIndex, VertexCount, dest->wineD3DVertexBuffer, NULL, Flags, dest->fvf);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
CopyMemory(object->elements, declaration, object->elements_size);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_CreateVertexDeclaration(This->WineD3DDevice, &object->wined3d_vertex_declaration,
(IUnknown *)object, wined3d_elements, wined3d_element_count);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
HeapFree(GetProcessHeap(), 0, wined3d_elements);
if (FAILED(hr)) {
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
HRESULT hrc = D3D_OK;
IDirect3DVertexShader8Impl *object;
- IWineD3DVertexDeclaration *wined3d_vertex_declaration;
const DWORD *token = pDeclaration;
DWORD handle;
return D3DERR_INVALIDCALL;
}
- EnterCriticalSection(&d3d8_cs);
- handle = d3d8_allocate_handle(&This->handle_table, object);
+ wined3d_mutex_lock();
+ handle = d3d8_allocate_handle(&This->handle_table, object, D3D8_HANDLE_VS);
if (handle == D3D8_INVALID_HANDLE)
{
ERR("Failed to allocate shader handle\n");
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
IDirect3DVertexDeclaration8_Release(object->vertex_declaration);
HeapFree(GetProcessHeap(), 0, object);
*ppShader = 0;
*ppShader = ((IDirect3DVertexDeclaration8Impl *)object->vertex_declaration)->shader_handle = shader_handle;
}
- wined3d_vertex_declaration = ((IDirect3DVertexDeclaration8Impl *)object->vertex_declaration)->wined3d_vertex_declaration;
-
if (pFunction)
{
/* Usage is missing ... Use SetRenderState to set the sw vp render state in SetVertexShader */
- hrc = IWineD3DDevice_CreateVertexShader(This->WineD3DDevice, wined3d_vertex_declaration,
- pFunction, &object->wineD3DVertexShader, (IUnknown *)object);
+ hrc = IWineD3DDevice_CreateVertexShader(This->WineD3DDevice, pFunction,
+ NULL /* output signature */, &object->wineD3DVertexShader, (IUnknown *)object);
if (FAILED(hrc))
{
/* free up object */
FIXME("Call to IWineD3DDevice_CreateVertexShader failed\n");
- d3d8_free_handle(&This->handle_table, handle);
+ d3d8_free_handle(&This->handle_table, handle, D3D8_HANDLE_VS);
IDirect3DVertexDeclaration8_Release(object->vertex_declaration);
HeapFree(GetProcessHeap(), 0, object);
*ppShader = 0;
}
}
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
return hrc;
}
if (VS_HIGHESTFIXEDFXF >= pShader) {
TRACE("Setting FVF, %#x\n", pShader);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
IWineD3DDevice_SetVertexDeclaration(This->WineD3DDevice,
IDirect3DDevice8Impl_FindDecl(This, pShader)->wined3d_vertex_declaration);
IWineD3DDevice_SetVertexShader(This->WineD3DDevice, NULL);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return D3D_OK;
}
TRACE("Setting shader\n");
- EnterCriticalSection(&d3d8_cs);
- shader = d3d8_get_object(&This->handle_table, pShader - (VS_HIGHESTFIXEDFXF + 1));
+ wined3d_mutex_lock();
+ shader = d3d8_get_object(&This->handle_table, pShader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_VS);
if (!shader)
{
WARN("Invalid handle (%#x) passed.\n", pShader);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return D3DERR_INVALIDCALL;
}
hr = IWineD3DDevice_SetVertexDeclaration(This->WineD3DDevice,
((IDirect3DVertexDeclaration8Impl *)shader->vertex_declaration)->wined3d_vertex_declaration);
if (SUCCEEDED(hr)) hr = IWineD3DDevice_SetVertexShader(This->WineD3DDevice, shader->wineD3DVertexShader);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
TRACE("Returning hr %#x\n", hr);
HRESULT hrc;
TRACE("(%p) : Relay device@%p\n", This, This->WineD3DDevice);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hrc = IWineD3DDevice_GetVertexDeclaration(This->WineD3DDevice, &wined3d_declaration);
if (FAILED(hrc))
{
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
WARN("(%p) : Call to IWineD3DDevice_GetVertexDeclaration failed %#x (device %p)\n",
This, hrc, This->WineD3DDevice);
return hrc;
if (!wined3d_declaration)
{
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
*ppShader = 0;
return D3D_OK;
}
hrc = IWineD3DVertexDeclaration_GetParent(wined3d_declaration, (IUnknown **)&d3d8_declaration);
IWineD3DVertexDeclaration_Release(wined3d_declaration);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
if (SUCCEEDED(hrc))
{
*ppShader = ((IDirect3DVertexDeclaration8Impl *)d3d8_declaration)->shader_handle;
TRACE("(%p) : pShader %#x\n", This, pShader);
- EnterCriticalSection(&d3d8_cs);
-
- shader = d3d8_free_handle(&This->handle_table, pShader - (VS_HIGHESTFIXEDFXF + 1));
+ wined3d_mutex_lock();
+ shader = d3d8_free_handle(&This->handle_table, pShader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_VS);
if (!shader)
{
WARN("Invalid handle (%#x) passed.\n", pShader);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return D3DERR_INVALIDCALL;
}
IWineD3DVertexShader_Release(cur);
}
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
if (IUnknown_Release((IUnknown *)shader))
{
return D3DERR_INVALIDCALL;
}
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_SetVertexShaderConstantF(This->WineD3DDevice, Register, pConstantData, ConstantCount);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
return D3DERR_INVALIDCALL;
}
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_GetVertexShaderConstantF(This->WineD3DDevice, Register, pConstantData, ConstantCount);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
TRACE("(%p) : pVertexShader 0x%08x, pData %p, *pSizeOfData %u\n", This, pVertexShader, pData, *pSizeOfData);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
+ shader = d3d8_get_object(&This->handle_table, pVertexShader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_VS);
+ wined3d_mutex_unlock();
- shader = d3d8_get_object(&This->handle_table, pVertexShader - (VS_HIGHESTFIXEDFXF + 1));
- LeaveCriticalSection(&d3d8_cs);
if (!shader)
{
WARN("Invalid handle (%#x) passed.\n", pVertexShader);
TRACE("(%p) : pVertexShader %#x, pData %p, pSizeOfData %p\n", This, pVertexShader, pData, pSizeOfData);
- EnterCriticalSection(&d3d8_cs);
-
- shader = d3d8_get_object(&This->handle_table, pVertexShader - (VS_HIGHESTFIXEDFXF + 1));
+ wined3d_mutex_lock();
+ shader = d3d8_get_object(&This->handle_table, pVertexShader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_VS);
if (!shader)
{
WARN("Invalid handle (%#x) passed.\n", pVertexShader);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return D3DERR_INVALIDCALL;
}
if (!shader->wineD3DVertexShader)
{
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
*pSizeOfData = 0;
return D3D_OK;
}
hr = IWineD3DVertexShader_GetFunction(shader->wineD3DVertexShader, pData, pSizeOfData);
+ wined3d_mutex_unlock();
- LeaveCriticalSection(&d3d8_cs);
return hr;
}
IDirect3DIndexBuffer8Impl *ib = (IDirect3DIndexBuffer8Impl *)pIndexData;
TRACE("(%p) Relay\n", This);
- EnterCriticalSection(&d3d8_cs);
/* WineD3D takes an INT(due to d3d9), but d3d8 uses UINTs. Do I have to add a check here that
* the UINT doesn't cause an overflow in the INT? It seems rather unlikely because such large
* vertex buffers can't be created to address them with an index that requires the 32nd bit
* (4 Byte minimum vertex size * 2^31-1 -> 8 gb buffer. The index sign would be the least
* problem)
*/
+ wined3d_mutex_lock();
IWineD3DDevice_SetBaseVertexIndex(This->WineD3DDevice, baseVertexIndex);
hr = IWineD3DDevice_SetIndices(This->WineD3DDevice,
ib ? ib->wineD3DIndexBuffer : NULL,
ib ? ib->format : WINED3DFMT_UNKNOWN);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
return D3DERR_INVALIDCALL;
}
- EnterCriticalSection(&d3d8_cs);
/* The case from UINT to INT is safe because d3d8 will never set negative values */
+ wined3d_mutex_lock();
IWineD3DDevice_GetBaseVertexIndex(This->WineD3DDevice, (INT *) pBaseVertexIndex);
rc = IWineD3DDevice_GetIndices(This->WineD3DDevice, &retIndexData);
if (SUCCEEDED(rc) && retIndexData) {
if (FAILED(rc)) FIXME("Call to GetIndices failed\n");
*ppIndexData = NULL;
}
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
return rc;
}
object->ref = 1;
object->lpVtbl = &Direct3DPixelShader8_Vtbl;
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_CreatePixelShader(This->WineD3DDevice, pFunction,
NULL, &object->wineD3DPixelShader, (IUnknown *)object);
if (FAILED(hr))
{
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
FIXME("(%p) call to IWineD3DDevice_CreatePixelShader failed\n", This);
HeapFree(GetProcessHeap(), 0 , object);
*ppShader = 0;
return hr;
}
- handle = d3d8_allocate_handle(&This->handle_table, object);
- LeaveCriticalSection(&d3d8_cs);
+ handle = d3d8_allocate_handle(&This->handle_table, object, D3D8_HANDLE_PS);
+ wined3d_mutex_unlock();
+
if (handle == D3D8_INVALID_HANDLE)
{
ERR("Failed to allocate shader handle\n");
TRACE("(%p) : pShader %#x\n", This, pShader);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
if (!pShader)
{
hr = IWineD3DDevice_SetPixelShader(This->WineD3DDevice, NULL);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
return hr;
}
- shader = d3d8_get_object(&This->handle_table, pShader - (VS_HIGHESTFIXEDFXF + 1));
+ shader = d3d8_get_object(&This->handle_table, pShader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_PS);
if (!shader)
{
WARN("Invalid handle (%#x) passed.\n", pShader);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
return D3DERR_INVALIDCALL;
}
TRACE("(%p) : Setting shader %p\n", This, shader);
hr = IWineD3DDevice_SetPixelShader(This->WineD3DDevice, shader->wineD3DPixelShader);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
return D3DERR_INVALIDCALL;
}
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hrc = IWineD3DDevice_GetPixelShader(This->WineD3DDevice, &object);
if (D3D_OK == hrc && NULL != object) {
IDirect3DPixelShader8Impl *d3d8_shader;
} else {
*ppShader = 0;
}
+ wined3d_mutex_unlock();
TRACE("(%p) : returning %#x\n", This, *ppShader);
- LeaveCriticalSection(&d3d8_cs);
+
return hrc;
}
TRACE("(%p) : pShader %#x\n", This, pShader);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
- shader = d3d8_free_handle(&This->handle_table, pShader - (VS_HIGHESTFIXEDFXF + 1));
+ shader = d3d8_free_handle(&This->handle_table, pShader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_PS);
if (!shader)
{
WARN("Invalid handle (%#x) passed.\n", pShader);
- LeaveCriticalSection(&d3d8_cs);
- return D3DERR_INVALIDCALL;
+ wined3d_mutex_unlock();
+ return D3D_OK;
}
IWineD3DDevice_GetPixelShader(This->WineD3DDevice, &cur);
IWineD3DPixelShader_Release(cur);
}
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
if (IUnknown_Release((IUnknown *)shader))
{
HRESULT hr;
TRACE("(%p) Relay\n", This);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_SetPixelShaderConstantF(This->WineD3DDevice, Register, pConstantData, ConstantCount);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
HRESULT hr;
TRACE("(%p) Relay\n", This);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_GetPixelShaderConstantF(This->WineD3DDevice, Register, pConstantData, ConstantCount);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
TRACE("(%p) : pPixelShader %#x, pData %p, pSizeOfData %p\n", This, pPixelShader, pData, pSizeOfData);
- EnterCriticalSection(&d3d8_cs);
- shader = d3d8_get_object(&This->handle_table, pPixelShader - (VS_HIGHESTFIXEDFXF + 1));
+ wined3d_mutex_lock();
+ shader = d3d8_get_object(&This->handle_table, pPixelShader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_PS);
if (!shader)
{
WARN("Invalid handle (%#x) passed.\n", pPixelShader);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return D3DERR_INVALIDCALL;
}
hr = IWineD3DPixelShader_GetFunction(shader->wineD3DPixelShader, pData, pSizeOfData);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
HRESULT hr;
TRACE("(%p) Relay\n", This);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_DrawRectPatch(This->WineD3DDevice, Handle, pNumSegs, (CONST WINED3DRECTPATCH_INFO *)pRectPatchInfo);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
HRESULT hr;
TRACE("(%p) Relay\n", This);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_DrawTriPatch(This->WineD3DDevice, Handle, pNumSegs, (CONST WINED3DTRIPATCH_INFO *)pTriPatchInfo);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
HRESULT hr;
TRACE("(%p) Relay\n", This);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_DeletePatch(This->WineD3DDevice, Handle);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
HRESULT hr;
TRACE("(%p) Relay\n" , This);
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
hr = IWineD3DDevice_SetStreamSource(This->WineD3DDevice, StreamNumber,
NULL == pStreamData ? NULL : ((IDirect3DVertexBuffer8Impl *)pStreamData)->wineD3DVertexBuffer,
0/* Offset in bytes */, Stride);
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
+
return hr;
}
return D3DERR_INVALIDCALL;
}
- EnterCriticalSection(&d3d8_cs);
+ wined3d_mutex_lock();
rc = IWineD3DDevice_GetStreamSource(This->WineD3DDevice, StreamNumber, &retStream, 0 /* Offset in bytes */, pStride);
if (rc == D3D_OK && NULL != retStream) {
IWineD3DBuffer_GetParent(retStream, (IUnknown **)pStream);
}
*pStream = NULL;
}
- LeaveCriticalSection(&d3d8_cs);
+ wined3d_mutex_unlock();
return rc;
}
hr = IDirect3DDevice8Impl_CreateSurface((IDirect3DDevice8 *)This, width, height,
d3dformat_from_wined3dformat(format), lockable, FALSE /* Discard */, level,
- (IDirect3DSurface8 **)&d3d_surface, D3DRTYPE_SURFACE, usage, pool,
- D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */);
+ (IDirect3DSurface8 **)&d3d_surface, usage, pool, D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */);
if (FAILED(hr))
{
ERR("(%p) CreateSurface failed, returning %#x\n", iface, hr);