wined3d: Add emtpy vertex declaration and related states to the state table.

This commit is contained in:
Stefan Dösinger 2007-01-02 00:35:07 +01:00 committed by Alexandre Julliard
parent a710f721c3
commit ef1ebb6e4d
3 changed files with 36 additions and 6 deletions

View File

@ -2146,7 +2146,6 @@ static UINT WINAPI IWineD3DDeviceImpl_GetAvailableTextureMem(IWineD3DDevice *ifa
*****/
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_SetFVF(IWineD3DDevice *iface, DWORD fvf
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_SetStreamSource(IWineD3DDevice *iface,
IWineD3DVertexBuffer_Release(oldSrc);
}
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_STREAMSRC);
return WINED3D_OK;
}
@ -3228,6 +3230,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexDeclaration(IWineD3DDevice* if
if (NULL != oldDecl) {
IWineD3DVertexDeclaration_Release(oldDecl);
}
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VDECL);
return WINED3D_OK;
}
@ -3261,9 +3264,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShader(IWineD3DDevice *iface,
}
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_DrawPrimitiveUP(IWineD3DDevice *iface,
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_DrawIndexedPrimitiveUP(IWineD3DDevice *
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_DrawIndexedPrimitiveUP(IWineD3DDevice *
}
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;
}

View File

@ -1847,6 +1847,10 @@ static void transform_worldex(DWORD state, IWineD3DStateBlockImpl *stateBlock) {
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 },
};

View File

@ -426,7 +426,16 @@ typedef void (*APPLYSTATEFUNC)(DWORD state, IWineD3DStateBlockImpl *stateblock);
#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
{