Stefan Dösinger : wined3d: Better tracking of vertex buffer assignments.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Jan 15 07:43:06 CST 2007
Module: wine
Branch: master
Commit: e328e24daa63269117f69badaa3887d4d6358089
URL: http://source.winehq.org/git/wine.git/?a=commit;h=e328e24daa63269117f69badaa3887d4d6358089
Author: Stefan Dösinger <stefan at codeweavers.com>
Date: Fri Jan 12 19:01:59 2007 +0100
wined3d: Better tracking of vertex buffer assignments.
---
dlls/wined3d/device.c | 8 ++------
dlls/wined3d/vertexbuffer.c | 2 +-
dlls/wined3d/wined3d_private.h | 7 +++----
3 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 8a02e31..1845446 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -2243,14 +2243,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl
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);
diff --git a/dlls/wined3d/vertexbuffer.c b/dlls/wined3d/vertexbuffer.c
index c7a8a97..6ef7533 100644
--- a/dlls/wined3d/vertexbuffer.c
+++ b/dlls/wined3d/vertexbuffer.c
@@ -266,7 +266,7 @@ static void WINAPI IWineD3DVertexBuf
}
/* 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
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 6d99657..3611f87 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -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 IW
#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)
More information about the wine-cvs
mailing list