Commit 70f4e66f authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: IWineD3DBuffer_Unmap() can't fail.

parent 1fa33658
......@@ -197,15 +197,13 @@ static HRESULT WINAPI d3d8_vertexbuffer_Lock(IDirect3DVertexBuffer8 *iface,
static HRESULT WINAPI d3d8_vertexbuffer_Unlock(IDirect3DVertexBuffer8 *iface)
{
HRESULT hr;
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
hr = IWineD3DBuffer_Unmap(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer);
IWineD3DBuffer_Unmap(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer);
wined3d_mutex_unlock();
return hr;
return D3D_OK;
}
static HRESULT WINAPI d3d8_vertexbuffer_GetDesc(IDirect3DVertexBuffer8 *iface, D3DVERTEXBUFFER_DESC *desc)
......@@ -461,15 +459,13 @@ static HRESULT WINAPI d3d8_indexbuffer_Lock(IDirect3DIndexBuffer8 *iface,
static HRESULT WINAPI d3d8_indexbuffer_Unlock(IDirect3DIndexBuffer8 *iface)
{
HRESULT hr;
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
hr = IWineD3DBuffer_Unmap(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer);
IWineD3DBuffer_Unmap(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer);
wined3d_mutex_unlock();
return hr;
return D3D_OK;
}
static HRESULT WINAPI d3d8_indexbuffer_GetDesc(IDirect3DIndexBuffer8 *iface, D3DINDEXBUFFER_DESC *desc)
......
......@@ -199,15 +199,13 @@ static HRESULT WINAPI d3d9_vertexbuffer_Lock(IDirect3DVertexBuffer9 *iface,
static HRESULT WINAPI d3d9_vertexbuffer_Unlock(IDirect3DVertexBuffer9 *iface)
{
HRESULT hr;
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
hr = IWineD3DBuffer_Unmap(((IDirect3DVertexBuffer9Impl *)iface)->wineD3DVertexBuffer);
IWineD3DBuffer_Unmap(((IDirect3DVertexBuffer9Impl *)iface)->wineD3DVertexBuffer);
wined3d_mutex_unlock();
return hr;
return D3D_OK;
}
static HRESULT WINAPI d3d9_vertexbuffer_GetDesc(IDirect3DVertexBuffer9 *iface, D3DVERTEXBUFFER_DESC *desc)
......@@ -463,15 +461,13 @@ static HRESULT WINAPI d3d9_indexbuffer_Lock(IDirect3DIndexBuffer9 *iface,
static HRESULT WINAPI d3d9_indexbuffer_Unlock(IDirect3DIndexBuffer9 *iface)
{
HRESULT hr;
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
hr = IWineD3DBuffer_Unmap(((IDirect3DIndexBuffer9Impl *)iface)->wineD3DIndexBuffer);
IWineD3DBuffer_Unmap(((IDirect3DIndexBuffer9Impl *)iface)->wineD3DIndexBuffer);
wined3d_mutex_unlock();
return hr;
return D3D_OK;
}
static HRESULT WINAPI d3d9_indexbuffer_GetDesc(IDirect3DIndexBuffer9 *iface, D3DINDEXBUFFER_DESC *desc)
......
......@@ -4364,13 +4364,7 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface,
return hr;
}
memcpy(LockedIndices, Indices, IndexCount * sizeof(WORD));
hr = IWineD3DBuffer_Unmap(This->indexbuffer);
if(hr != D3D_OK)
{
ERR("(%p) IWineD3DBuffer::Unmap failed with hr = %08x\n", This, hr);
LeaveCriticalSection(&ddraw_cs);
return hr;
}
IWineD3DBuffer_Unmap(This->indexbuffer);
/* Set the index stream */
IWineD3DDevice_SetBaseVertexIndex(This->wineD3DDevice, StartVertex);
......
......@@ -266,15 +266,14 @@ static HRESULT WINAPI
IDirect3DVertexBufferImpl_Unlock(IDirect3DVertexBuffer7 *iface)
{
IDirect3DVertexBufferImpl *This = (IDirect3DVertexBufferImpl *)iface;
HRESULT hr;
TRACE("iface %p.\n", iface);
EnterCriticalSection(&ddraw_cs);
hr = IWineD3DBuffer_Unmap(This->wineD3DVertexBuffer);
IWineD3DBuffer_Unmap(This->wineD3DVertexBuffer);
LeaveCriticalSection(&ddraw_cs);
return hr;
return D3D_OK;
}
static HRESULT WINAPI
......
......@@ -1338,7 +1338,7 @@ static HRESULT STDMETHODCALLTYPE buffer_Map(IWineD3DBuffer *iface, UINT offset,
return WINED3D_OK;
}
static HRESULT STDMETHODCALLTYPE buffer_Unmap(IWineD3DBuffer *iface)
static void STDMETHODCALLTYPE buffer_Unmap(IWineD3DBuffer *iface)
{
struct wined3d_buffer *This = (struct wined3d_buffer *)iface;
ULONG i;
......@@ -1351,15 +1351,15 @@ static HRESULT STDMETHODCALLTYPE buffer_Unmap(IWineD3DBuffer *iface)
* the next call (this will happen if the lock_count is < 0). */
if (!This->lock_count)
{
TRACE("Unmap called without a previous Map call!\n");
return WINED3D_OK;
WARN("Unmap called without a previous Map call.\n");
return;
}
if (InterlockedDecrement(&This->lock_count))
{
/* Delay loading the buffer until everything is unlocked */
TRACE("Ignoring unlock\n");
return WINED3D_OK;
return;
}
if(!(This->flags & WINED3D_BUFFER_DOUBLEBUFFER) && This->buffer_object)
......@@ -1410,8 +1410,6 @@ static HRESULT STDMETHODCALLTYPE buffer_Unmap(IWineD3DBuffer *iface)
{
buffer_PreLoad(iface);
}
return WINED3D_OK;
}
static void STDMETHODCALLTYPE buffer_GetDesc(IWineD3DBuffer *iface, WINED3DBUFFER_DESC *desc)
......@@ -1520,14 +1518,7 @@ HRESULT buffer_init(struct wined3d_buffer *buffer, IWineD3DDeviceImpl *device,
memcpy(ptr, data, size);
hr = IWineD3DBuffer_Unmap((IWineD3DBuffer *)buffer);
if (FAILED(hr))
{
ERR("Failed to unmap buffer, hr %#x\n", hr);
buffer_UnLoad((IWineD3DBuffer *)buffer);
resource_cleanup((IWineD3DResource *)buffer);
return hr;
}
IWineD3DBuffer_Unmap((IWineD3DBuffer *)buffer);
}
buffer->maps = HeapAlloc(GetProcessHeap(), 0, sizeof(*buffer->maps));
......
......@@ -2731,7 +2731,7 @@ interface IWineD3DBuffer : IWineD3DResource
[out] BYTE **data,
[in] DWORD flags
);
HRESULT Unmap(
void Unmap(
);
void GetDesc(
[out] WINED3DBUFFER_DESC *desc
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment