Stefan Dösinger : wined3d: Restore the index buffer when switching from UP to buffer drawing.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Mar 12 08:28:29 CDT 2007


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

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Sat Mar 10 00:44:46 2007 +0100

wined3d: Restore the index buffer when switching from UP to buffer drawing.

The state handler binds index buffer 0 when a user pointer is used. Likewise the real index
buffer has to be restored when switching back to drawing from index buffers.

---

 dlls/wined3d/device.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 0998eec..c7eda3b 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4250,12 +4250,17 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitive(IWineD3DDevice *iface, WI
                                                 UINT PrimitiveCount) {
 
     IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
-    This->stateBlock->streamIsUP = FALSE;
 
     TRACE("(%p) : Type=(%d,%s), Start=%d, Count=%d\n", This, PrimitiveType,
                                debug_d3dprimitivetype(PrimitiveType),
                                StartVertex, PrimitiveCount);
 
+    /* The index buffer is not needed here, but restore it, otherwise it is hell to keep track of */
+    if(This->stateBlock->streamIsUP) {
+        IWineD3DDeviceImpl_MarkStateDirty(This, STATE_INDEXBUFFER);
+        This->stateBlock->streamIsUP = FALSE;
+    }
+
     if(This->stateBlock->loadBaseVertexIndex != 0) {
         This->stateBlock->loadBaseVertexIndex = 0;
         IWineD3DDeviceImpl_MarkStateDirty(This, STATE_STREAMSRC);
@@ -4277,8 +4282,11 @@ static HRESULT  WINAPI  IWineD3DDeviceImpl_DrawIndexedPrimitive(IWineD3DDevice *
     WINED3DINDEXBUFFER_DESC  IdxBufDsc;
     GLuint vbo;
 
+    if(This->stateBlock->streamIsUP) {
+        IWineD3DDeviceImpl_MarkStateDirty(This, STATE_INDEXBUFFER);
+        This->stateBlock->streamIsUP = FALSE;
+    }
     pIB = This->stateBlock->pIndexData;
-    This->stateBlock->streamIsUP = FALSE;
     vbo = ((IWineD3DIndexBufferImpl *) pIB)->vbo;
 
     TRACE("(%p) : Type=(%d,%s), min=%d, CountV=%d, startIdx=%d, countP=%d\n", This,




More information about the wine-cvs mailing list