[WINED3D] Resend: Set pIndexData to 0 in DrawIndexedPrimitiveUP

Ivan Gyurdiev ivg2 at cornell.edu
Wed May 10 12:57:49 CDT 2006


This is a resend. The patch was corrected once to not include undesired 
side effects, and I also re-synced to Stefan's changes.

The original changelog was:
=====================
MSDN says: "Following any DrawIndexedPrimitiveUP call, the stream 0 
settings, referenced by GetStreamSource, are set to NULL. Also, the 
index buffer setting for SetIndices is set to NULL."

We Release() the stream 0 settings, and set them to NULL.
We only Release() the index buffer setting.

This causes the RollerCoaster.exe shaders demo that I have to segfault 
after doing: SetIndices(), DrawIndexedPrimitiveUP(), 
DrawIndexedPrimitiveUP(), then SetIndices() again with the same buffer [ 
now released due to refcount beind continually decreased down to 0 ]. 
After this change, the demo does not crash anymore.
-------------- next part --------------
---

 dlls/wined3d/device.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)

eabdc0f2200fe02d86dd52ed07b1042f12f3b311
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index b2497c4..4590df0 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -5329,9 +5329,8 @@ HRESULT WINAPI IWineD3DDeviceImpl_DrawPr
 
     drawPrimitive(iface, PrimitiveType, PrimitiveCount, 0 /* start vertex */, 0  /* NumVertices */,
                   0 /* indxStart*/, 0 /* indxSize*/, NULL /* indxData */, 0 /* indxMin */, NULL);
-    /* stream zero settings set to null at end, as per the msdn
-            http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/directx9_c/directx/graphics/reference/d3d/interfaces/idirect3ddevice9/DrawPrimitiveUP.asp
-    */
+
+    /* MSDN specifies stream zero settings must be set to NULL */
     This->stateBlock->streamStride[0] = 0;
     This->stateBlock->streamSource[0] = NULL;
 
@@ -5372,13 +5371,11 @@ HRESULT WINAPI IWineD3DDeviceImpl_DrawIn
     This->stateBlock->streamStride[0] = VertexStreamZeroStride;
 
     drawPrimitive(iface, PrimitiveType, PrimitiveCount, 0 /* vertexStart */, NumVertices, 0 /* indxStart */, idxStride, pIndexData, MinVertexIndex, NULL);
-    /* stream zero settings set to null at end as per the msdn
-    http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/directx9_c/directx/graphics/reference/d3d/interfaces/idirect3ddevice9/DrawPrimitiveUP.asp
-    */
 
-    /* stream zero settings set to null at end as per the msdn */
+    /* MSDN specifies stream zero settings and index buffer must be set to NULL */
     This->stateBlock->streamSource[0] = NULL;
     This->stateBlock->streamStride[0] = 0;
+    This->stateBlock->pIndexData = NULL;
 
     return WINED3D_OK;
 }
-- 
1.3.1



More information about the wine-patches mailing list