WineD3D: Restore the index buffer when switching from UP to buffer drawing

Stefan Dösinger stefan at codeweavers.com
Fri Mar 9 17:58:27 CST 2007


fixes a regression in eve online
-------------- next part --------------
From 79fece415c210b677610015948dc07808fcb9b94 Mon Sep 17 00:00:00 2001
From: Stefan Doesinger <stefan at codeweavers.com>
Date: Sat, 10 Mar 2007 00:44:46 +0100
Subject: [PATCH] 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 205fca2..13d0fa5 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4269,12 +4269,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);
@@ -4296,8 +4301,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,
-- 
1.4.4.3



More information about the wine-patches mailing list