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

wined3d: Do not try to read the vertex decl when the stateblock isn't finalized.

parent 2e55c196
...@@ -1247,6 +1247,9 @@ void drawPrimitive(IWineD3DDevice *iface, ...@@ -1247,6 +1247,9 @@ void drawPrimitive(IWineD3DDevice *iface,
DWORD dirtyState, idx; DWORD dirtyState, idx;
BYTE shift; BYTE shift;
/* Signals other modules that a drawing is in progress and the stateblock finalized */
This->isInDraw = TRUE;
/* Invalidate the back buffer memory so LockRect will read it the next time */ /* Invalidate the back buffer memory so LockRect will read it the next time */
for(i = 0; i < IWineD3DDevice_GetNumberOfSwapChains(iface); i++) { for(i = 0; i < IWineD3DDevice_GetNumberOfSwapChains(iface); i++) {
IWineD3DDevice_GetSwapChain(iface, i, (IWineD3DSwapChain **) &swapchain); IWineD3DDevice_GetSwapChain(iface, i, (IWineD3DSwapChain **) &swapchain);
...@@ -1340,4 +1343,7 @@ void drawPrimitive(IWineD3DDevice *iface, ...@@ -1340,4 +1343,7 @@ void drawPrimitive(IWineD3DDevice *iface,
++primCounter; ++primCounter;
} }
#endif #endif
/* Control goes back to the device, stateblock values may change again */
This->isInDraw = FALSE;
} }
...@@ -258,7 +258,20 @@ static void WINAPI IWineD3DVertexBufferImpl_PreLoad(IWineD3DVertexBuffer *if ...@@ -258,7 +258,20 @@ static void WINAPI IWineD3DVertexBufferImpl_PreLoad(IWineD3DVertexBuffer *if
return; /* Not doing any conversion */ return; /* Not doing any conversion */
} }
declChanged = IWineD3DVertexBufferImpl_FindDecl(This); /* 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) {
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
* the stream source state handler will call PreLoad again and the change will be cought
*/
} else {
/* Cannot get a declaration, and no declaration is stored in the buffer. It is pointless to preload
* now. When the buffer is used, PreLoad will be called by the stream source state handler and a valid
* declaration for the buffer can be found
*/
return;
}
/* If applications change the declaration over and over, reconverting all the time is a huge /* If applications change the declaration over and over, reconverting all the time is a huge
* performance hit. So count the declaration changes and release the VBO if there are too much * performance hit. So count the declaration changes and release the VBO if there are too much
......
...@@ -588,6 +588,7 @@ typedef struct IWineD3DDeviceImpl ...@@ -588,6 +588,7 @@ typedef struct IWineD3DDeviceImpl
BOOL isRecordingState; BOOL isRecordingState;
IWineD3DStateBlockImpl *stateBlock; IWineD3DStateBlockImpl *stateBlock;
IWineD3DStateBlockImpl *updateStateBlock; IWineD3DStateBlockImpl *updateStateBlock;
BOOL isInDraw;
/* Internal use fields */ /* Internal use fields */
WINED3DDEVICE_CREATION_PARAMETERS createParms; WINED3DDEVICE_CREATION_PARAMETERS createParms;
......
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