Module: wine
Branch: master
Commit: 93dcfe350d8adb26703035343a619240443aa4b5
URL: http://source.winehq.org/git/wine.git/?a=commit;h=93dcfe350d8adb26703035343…
Author: H. Verbeet <hverbeet(a)gmail.com>
Date: Sat Jun 2 15:54:49 2007 +0200
wined3d: Return WINED3DERR_INVALIDCALL in DrawIndexedPrimitive if no index buffer is set.
---
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,