[1/2] wined3d: Return WINED3DERR_INVALIDCALL in DrawIndexedPrimitive if no index buffer is set

H. Verbeet hverbeet at gmail.com
Sat Jun 2 08:54:49 CDT 2007


Changelog:
  - Return WINED3DERR_INVALIDCALL in DrawIndexedPrimitive if no index
buffer is set
-------------- next part --------------
---

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

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 0b399d5..3ecf65c 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4526,11 +4526,20 @@ static HRESULT  WINAPI  IWineD3DDeviceImpl_DrawIndexedPrimitive(IWineD3DDevice *
     WINED3DINDEXBUFFER_DESC  IdxBufDsc;
     GLuint vbo;
 
+    pIB = This->stateBlock->pIndexData;
+    if (!pIB) {
+        /* D3D9 returns D3DERR_INVALIDCALL when DrawIndexedPrimitive is called
+         * without an index buffer set. (The first time at least...)
+         * D3D8 simply dies, but I doubt it can do much harm to return
+         * D3DERR_INVALIDCALL there as well. */
+        ERR("(%p) : Called without a valid index buffer set, returning WINED3DERR_INVALIDCALL\n", This);
+        return WINED3DERR_INVALIDCALL;
+    }
+
     if(This->stateBlock->streamIsUP) {
         IWineD3DDeviceImpl_MarkStateDirty(This, STATE_INDEXBUFFER);
         This->stateBlock->streamIsUP = FALSE;
     }
-    pIB = This->stateBlock->pIndexData;
     vbo = ((IWineD3DIndexBufferImpl *) pIB)->vbo;
 
     TRACE("(%p) : Type=(%d,%s), min=%d, CountV=%d, startIdx=%d, countP=%d\n", This,


More information about the wine-patches mailing list