Module: wine Branch: master Commit: ef1ebb6e4d8aeb711e639363e815ebd189f54a93 URL: http://source.winehq.org/git/wine.git/?a=commit;h=ef1ebb6e4d8aeb711e639363e8...
Author: Stefan Dösinger stefandoesinger@gmx.at Date: Tue Jan 2 00:35:07 2007 +0100
wined3d: Add emtpy vertex declaration and related states to the state table.
---
dlls/wined3d/device.c | 22 +++++++++++++++++----- dlls/wined3d/state.c | 9 +++++++++ dlls/wined3d/wined3d_private.h | 11 ++++++++++- 3 files changed, 36 insertions(+), 6 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 0c2a180..cfb3354 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -2146,7 +2146,6 @@ static UINT WINAPI IWineD3DDeviceImpl_Ge *****/ static HRESULT WINAPI IWineD3DDeviceImpl_SetFVF(IWineD3DDevice *iface, DWORD fvf) { IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - HRESULT hr = WINED3D_OK;
/* Update the current state block */ This->updateStateBlock->fvf = fvf; @@ -2154,7 +2153,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl This->updateStateBlock->set.fvf = TRUE;
TRACE("(%p) : FVF Shader FVF set to %x\n", This, fvf); - return hr; + IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VDECL); + return WINED3D_OK; }
@@ -2238,6 +2238,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl IWineD3DVertexBuffer_Release(oldSrc); }
+ IWineD3DDeviceImpl_MarkStateDirty(This, STATE_STREAMSRC); + return WINED3D_OK; }
@@ -3228,6 +3230,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl if (NULL != oldDecl) { IWineD3DVertexDeclaration_Release(oldDecl); } + IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VDECL); return WINED3D_OK; }
@@ -3261,9 +3264,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl }
TRACE("(%p) : setting pShader(%p)\n", This, pShader); - /** - * TODO: merge HAL shaders context switching from prototype - */ + + IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VSHADER); + return WINED3D_OK; }
@@ -4718,6 +4721,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl This->stateBlock->streamStride[0] = VertexStreamZeroStride; This->stateBlock->streamIsUP = TRUE;
+ /* Mark the state dirty until we have nicer tracking */ + IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VDECL); + drawPrimitive(iface, PrimitiveType, PrimitiveCount, 0 /* start vertex */, 0 /* NumVertices */, 0 /* indxStart*/, 0 /* indxSize*/, NULL /* indxData */, 0 /* indxMin */, NULL);
@@ -4761,6 +4767,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl This->stateBlock->streamIsUP = TRUE; This->stateBlock->streamStride[0] = VertexStreamZeroStride;
+ /* Mark the state dirty until we have nicer tracking */ + IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VDECL); + drawPrimitive(iface, PrimitiveType, PrimitiveCount, 0 /* vertexStart */, NumVertices, 0 /* indxStart */, idxStride, pIndexData, MinVertexIndex, NULL);
/* MSDN specifies stream zero settings and index buffer must be set to NULL */ @@ -4772,7 +4781,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl }
static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitiveStrided (IWineD3DDevice *iface, WINED3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, WineDirect3DVertexStridedData *DrawPrimStrideData) { + IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
+ /* Mark the state dirty until we have nicer tracking */ + IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VDECL); drawPrimitive(iface, PrimitiveType, PrimitiveCount, 0, 0, 0, 0, NULL, 0, DrawPrimStrideData); return WINED3D_OK; } diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 28ec973..fae9d6b 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -1847,6 +1847,10 @@ static void transform_worldex(DWORD stat WARN("World matrix 1 - 255 not supported yet\n"); }
+static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateBlock) { + TRACE("To be filled later\n"); +} + const struct StateEntry StateTable[] = { /* State name representative, apply function */ @@ -2860,4 +2864,9 @@ const struct StateEntry StateTable[] = { /*509, WINED3DTS_WORLDMATRIX(253) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(253)), transform_worldex }, { /*510, WINED3DTS_WORLDMATRIX(254) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(254)), transform_worldex }, { /*511, WINED3DTS_WORLDMATRIX(255) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(255)), transform_worldex }, + /* Various Vertex states follow */ + { /* , STATE_STREAMSRC */ STATE_VDECL, vertexdeclaration }, + { /* , STATE_VDECL */ STATE_VDECL, vertexdeclaration }, + { /* , STATE_VSHADER */ STATE_VDECL, vertexdeclaration }, + }; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 74655d2..a6fe6c5 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -426,7 +426,16 @@ typedef void (*APPLYSTATEFUNC)(DWORD sta #define STATE_TRANSFORM(a) (STATE_PIXELSHADER + (a)) #define STATE_IS_TRANSFORM(a) ((a) >= STATE_TRANSFORM(1) && (a) <= STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(255)))
-#define STATE_HIGHEST (STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(255))) +#define STATE_STREAMSRC (STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(255)) + 1) +#define STATE_IS_STREAMSRC(a) ((a) == STATE_STREAMSRC) + +#define STATE_VDECL (STATE_STREAMSRC + 1) +#define STATE_IS_VDECL(a) ((a) == STATE_VDECL) + +#define STATE_VSHADER (STATE_VDECL + 1) +#define STATE_IS_VSHADER(a) ((a) == STATE_VSHADER) + +#define STATE_HIGHEST (STATE_VSHADER)
struct StateEntry {