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.
This commit is contained in:
Stefan Dösinger 2007-03-10 00:44:46 +01:00 committed by Alexandre Julliard
parent 39fb7839a7
commit 850bd7b414
1 changed files with 10 additions and 2 deletions

View File

@ -4250,12 +4250,17 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitive(IWineD3DDevice *iface, WI
UINT PrimitiveCount) { UINT PrimitiveCount) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
This->stateBlock->streamIsUP = FALSE;
TRACE("(%p) : Type=(%d,%s), Start=%d, Count=%d\n", This, PrimitiveType, TRACE("(%p) : Type=(%d,%s), Start=%d, Count=%d\n", This, PrimitiveType,
debug_d3dprimitivetype(PrimitiveType), debug_d3dprimitivetype(PrimitiveType),
StartVertex, PrimitiveCount); 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) { if(This->stateBlock->loadBaseVertexIndex != 0) {
This->stateBlock->loadBaseVertexIndex = 0; This->stateBlock->loadBaseVertexIndex = 0;
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_STREAMSRC); IWineD3DDeviceImpl_MarkStateDirty(This, STATE_STREAMSRC);
@ -4277,8 +4282,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitive(IWineD3DDevice *
WINED3DINDEXBUFFER_DESC IdxBufDsc; WINED3DINDEXBUFFER_DESC IdxBufDsc;
GLuint vbo; GLuint vbo;
if(This->stateBlock->streamIsUP) {
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_INDEXBUFFER);
This->stateBlock->streamIsUP = FALSE;
}
pIB = This->stateBlock->pIndexData; pIB = This->stateBlock->pIndexData;
This->stateBlock->streamIsUP = FALSE;
vbo = ((IWineD3DIndexBufferImpl *) pIB)->vbo; vbo = ((IWineD3DIndexBufferImpl *) pIB)->vbo;
TRACE("(%p) : Type=(%d,%s), min=%d, CountV=%d, startIdx=%d, countP=%d\n", This, TRACE("(%p) : Type=(%d,%s), min=%d, CountV=%d, startIdx=%d, countP=%d\n", This,