Stefan Dösinger : wined3d: Activate a thread before mapping a buffer.

Alexandre Julliard julliard at winehq.org
Tue Apr 28 07:53:01 CDT 2009


Module: wine
Branch: master
Commit: 926fe798c50309fecb6f901e1310569d3257ff88
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=926fe798c50309fecb6f901e1310569d3257ff88

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Mon Apr 20 14:40:53 2009 +0200

wined3d: Activate a thread before mapping a buffer.

This fixes a regression in EverQuest 2.

---

 dlls/wined3d/buffer.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index b68dcf7..d201a53 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -951,12 +951,18 @@ static HRESULT STDMETHODCALLTYPE buffer_Map(IWineD3DBuffer *iface, UINT offset,
     {
         if(count == 1)
         {
+            IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
+
             if(This->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER_ARB)
             {
                 IWineD3DDeviceImpl_MarkStateDirty(This->resource.wineD3DDevice, STATE_INDEXBUFFER);
             }
+
+            ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
+            ENTER_GL();
             GL_EXTCALL(glBindBufferARB(This->buffer_type_hint, This->buffer_object));
             This->resource.allocatedMemory = GL_EXTCALL(glMapBufferARB(This->buffer_type_hint, GL_READ_WRITE_ARB));
+            LEAVE_GL();
         }
     }
     else
@@ -987,12 +993,19 @@ static HRESULT STDMETHODCALLTYPE buffer_Unmap(IWineD3DBuffer *iface)
 
     if(!(This->flags & WINED3D_BUFFER_DOUBLEBUFFER) && This->buffer_object)
     {
+        IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
+
         if(This->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER_ARB)
         {
             IWineD3DDeviceImpl_MarkStateDirty(This->resource.wineD3DDevice, STATE_INDEXBUFFER);
         }
+
+        ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
+        ENTER_GL();
         GL_EXTCALL(glBindBufferARB(This->buffer_type_hint, This->buffer_object));
         GL_EXTCALL(glUnmapBufferARB(This->buffer_type_hint));
+        LEAVE_GL();
+
         This->resource.allocatedMemory = NULL;
     }
     else if (This->flags & WINED3D_BUFFER_HASDESC)




More information about the wine-cvs mailing list