Henri Verbeet : wined3d: IWineD3DBuffer_Unmap() can't fail.
Alexandre Julliard
julliard at winehq.org
Fri Oct 15 10:40:29 CDT 2010
Module: wine
Branch: master
Commit: 70f4e66f84b0a3e027b8d71c254ea32df810546b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=70f4e66f84b0a3e027b8d71c254ea32df810546b
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Fri Oct 15 14:35:12 2010 +0200
wined3d: IWineD3DBuffer_Unmap() can't fail.
---
dlls/d3d8/buffer.c | 12 ++++--------
dlls/d3d9/buffer.c | 12 ++++--------
dlls/ddraw/device.c | 8 +-------
dlls/ddraw/vertexbuffer.c | 5 ++---
dlls/wined3d/buffer.c | 19 +++++--------------
include/wine/wined3d.idl | 2 +-
6 files changed, 17 insertions(+), 41 deletions(-)
diff --git a/dlls/d3d8/buffer.c b/dlls/d3d8/buffer.c
index f7dc12d..e2a026b 100644
--- a/dlls/d3d8/buffer.c
+++ b/dlls/d3d8/buffer.c
@@ -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)
diff --git a/dlls/d3d9/buffer.c b/dlls/d3d9/buffer.c
index ac8c244..231e0c8 100644
--- a/dlls/d3d9/buffer.c
+++ b/dlls/d3d9/buffer.c
@@ -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)
diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
index 720aaa0..7976ecb 100644
--- a/dlls/ddraw/device.c
+++ b/dlls/ddraw/device.c
@@ -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);
diff --git a/dlls/ddraw/vertexbuffer.c b/dlls/ddraw/vertexbuffer.c
index 36087f2..a001b03 100644
--- a/dlls/ddraw/vertexbuffer.c
+++ b/dlls/ddraw/vertexbuffer.c
@@ -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
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index 23b4a4a..2306d1f 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -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));
diff --git a/include/wine/wined3d.idl b/include/wine/wined3d.idl
index e024940..fda722a 100644
--- a/include/wine/wined3d.idl
+++ b/include/wine/wined3d.idl
@@ -2731,7 +2731,7 @@ interface IWineD3DBuffer : IWineD3DResource
[out] BYTE **data,
[in] DWORD flags
);
- HRESULT Unmap(
+ void Unmap(
);
void GetDesc(
[out] WINED3DBUFFER_DESC *desc
More information about the wine-cvs
mailing list