wined3d: Better tracking of vertex buffer assignments.

This commit is contained in:
Stefan Dösinger 2007-01-12 19:01:59 +01:00 committed by Alexandre Julliard
parent 03389acc30
commit e328e24daa
3 changed files with 6 additions and 11 deletions

View File

@ -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);

View File

@ -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

View File

@ -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)