Commit e328e24d authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Better tracking of vertex buffer assignments.

parent 03389acc
......@@ -2243,14 +2243,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetStreamSource(IWineD3DDevice *iface,
so for now, just count internally */
if (pStreamData != NULL) {
IWineD3DVertexBufferImpl *vbImpl = (IWineD3DVertexBufferImpl *) pStreamData;
if( (vbImpl->Flags & VBFLAG_STREAM) && vbImpl->stream != StreamNumber) {
WARN("Assigning a Vertex Buffer to stream %d which is already assigned to stream %d\n", StreamNumber, vbImpl->stream);
}
vbImpl->stream = StreamNumber;
vbImpl->Flags |= VBFLAG_STREAM;
InterlockedIncrement(&vbImpl->bindCount);
}
if (oldSrc != NULL) {
((IWineD3DVertexBufferImpl *) oldSrc)->Flags &= ~VBFLAG_STREAM;
InterlockedDecrement(&((IWineD3DVertexBufferImpl *) oldSrc)->bindCount);
}
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_STREAMSRC);
......
......@@ -266,7 +266,7 @@ static void WINAPI IWineD3DVertexBufferImpl_PreLoad(IWineD3DVertexBuffer *if
}
/* Reading the declaration makes only sense if the stateblock is finalized and the buffer bound to a stream */
if(This->resource.wineD3DDevice->isInDraw && This->Flags & VBFLAG_STREAM) {
if(This->resource.wineD3DDevice->isInDraw && This->bindCount > 0) {
declChanged = IWineD3DVertexBufferImpl_FindDecl(This);
} else if(This->Flags & VBFLAG_HASDESC) {
/* Reuse the declaration stored in the buffer. It will most likely not change, and if it does
......
......@@ -751,7 +751,7 @@ typedef struct IWineD3DVertexBufferImpl
/* Vertex buffer object support */
GLuint vbo;
BYTE Flags;
UINT stream;
LONG bindCount;
UINT dirtystart, dirtyend;
LONG lockcount;
......@@ -766,9 +766,8 @@ extern const IWineD3DVertexBufferVtbl IWineD3DVertexBuffer_Vtbl;
#define VBFLAG_LOAD 0x01 /* Data is written from allocatedMemory to the VBO */
#define VBFLAG_OPTIMIZED 0x02 /* Optimize has been called for the VB */
#define VBFLAG_DIRTY 0x04 /* Buffer data has been modified */
#define VBFLAG_STREAM 0x08 /* The vertex buffer is in a stream */
#define VBFLAG_HASDESC 0x10 /* A vertex description has been found */
#define VBFLAG_VBOCREATEFAIL 0x20 /* An attempt to create a vbo has failed */
#define VBFLAG_HASDESC 0x08 /* A vertex description has been found */
#define VBFLAG_VBOCREATEFAIL 0x10 /* An attempt to create a vbo has failed */
/*****************************************************************************
* IWineD3DIndexBuffer implementation structure (extends IWineD3DResourceImpl)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment