wined3d: Put the decoded strided data structure into the device.

This commit is contained in:
Stefan Dösinger 2007-01-02 00:21:26 +01:00 committed by Alexandre Julliard
parent f5fafab663
commit 091f9c28e4
2 changed files with 15 additions and 23 deletions

View File

@ -1947,7 +1947,6 @@ void drawPrimitive(IWineD3DDevice *iface,
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
BOOL useVertexShaderFunction = FALSE; BOOL useVertexShaderFunction = FALSE;
BOOL usePixelShaderFunction = FALSE; BOOL usePixelShaderFunction = FALSE;
WineDirect3DVertexStridedData *dataLocations;
IWineD3DSwapChainImpl *swapchain; IWineD3DSwapChainImpl *swapchain;
int i; int i;
BOOL fixup = FALSE; BOOL fixup = FALSE;
@ -2002,8 +2001,8 @@ void drawPrimitive(IWineD3DDevice *iface,
/* Note: this is a ddraw fixed-function code path */ /* Note: this is a ddraw fixed-function code path */
TRACE("================ Strided Input ===================\n"); TRACE("================ Strided Input ===================\n");
dataLocations = DrawPrimStrideData; memcpy(&This->strided_streams, DrawPrimStrideData, sizeof(This->strided_streams));
drawPrimitiveTraceDataLocations(dataLocations); drawPrimitiveTraceDataLocations(&This->strided_streams);
fixup = FALSE; fixup = FALSE;
} }
@ -2015,17 +2014,13 @@ void drawPrimitive(IWineD3DDevice *iface,
* don't set any declaration at all */ * don't set any declaration at all */
TRACE("================ Vertex Declaration ===================\n"); TRACE("================ Vertex Declaration ===================\n");
dataLocations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*dataLocations)); memset(&This->strided_streams, 0, sizeof(This->strided_streams));
if(!dataLocations) {
ERR("Out of memory!\n");
return;
}
if (This->stateBlock->vertexDecl != NULL || if (This->stateBlock->vertexDecl != NULL ||
((IWineD3DVertexShaderImpl *)This->stateBlock->vertexShader)->vertexDeclaration != NULL) ((IWineD3DVertexShaderImpl *)This->stateBlock->vertexShader)->vertexDeclaration != NULL)
primitiveDeclarationConvertToStridedData(iface, useVertexShaderFunction, primitiveDeclarationConvertToStridedData(iface, useVertexShaderFunction,
dataLocations, StartVertexIndex, &fixup); &This->strided_streams, StartVertexIndex, &fixup);
} else { } else {
@ -2034,20 +2029,16 @@ void drawPrimitive(IWineD3DDevice *iface,
* It will not work properly for shaders. */ * It will not work properly for shaders. */
TRACE("================ FVF ===================\n"); TRACE("================ FVF ===================\n");
dataLocations = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*dataLocations)); memset(&This->strided_streams, 0, sizeof(This->strided_streams));
if(!dataLocations) { primitiveConvertToStridedData(iface, &This->strided_streams, StartVertexIndex, &fixup);
ERR("Out of memory!\n"); drawPrimitiveTraceDataLocations(&This->strided_streams);
return;
}
primitiveConvertToStridedData(iface, dataLocations, StartVertexIndex, &fixup);
drawPrimitiveTraceDataLocations(dataLocations);
} }
/* Setup transform matrices and sort out */ /* Setup transform matrices and sort out */
primitiveInitState(iface, dataLocations, useVertexShaderFunction, &lighting_changed, &lighting_original); primitiveInitState(iface, &This->strided_streams, useVertexShaderFunction, &lighting_changed, &lighting_original);
/* Now initialize the materials state */ /* Now initialize the materials state */
init_materials(iface, (dataLocations->u.s.diffuse.lpData != NULL || dataLocations->u.s.diffuse.VBO != 0)); init_materials(iface, (This->strided_streams.u.s.diffuse.lpData != NULL || This->strided_streams.u.s.diffuse.VBO != 0));
{ {
GLenum glPrimType; GLenum glPrimType;
@ -2058,12 +2049,10 @@ void drawPrimitive(IWineD3DDevice *iface,
numberOfVertices = calculatedNumberOfindices; numberOfVertices = calculatedNumberOfindices;
drawPrimitiveDrawStrided(iface, useVertexShaderFunction, usePixelShaderFunction, drawPrimitiveDrawStrided(iface, useVertexShaderFunction, usePixelShaderFunction,
dataLocations, numberOfVertices, calculatedNumberOfindices, glPrimType, &This->strided_streams, numberOfVertices, calculatedNumberOfindices, glPrimType,
idxData, idxSize, minIndex, StartIdx, fixup); idxData, idxSize, minIndex, StartIdx, fixup);
} }
if(!DrawPrimStrideData) HeapFree(GetProcessHeap(), 0, dataLocations);
/* If vertex shaders or no normals, restore previous lighting state */ /* If vertex shaders or no normals, restore previous lighting state */
if (lighting_changed) { if (lighting_changed) {
if (lighting_original) glEnable(GL_LIGHTING); if (lighting_original) glEnable(GL_LIGHTING);

View File

@ -659,6 +659,9 @@ typedef struct IWineD3DDeviceImpl
DWORD texUnitMap[MAX_SAMPLERS]; DWORD texUnitMap[MAX_SAMPLERS];
BOOL oneToOneTexUnitMap; BOOL oneToOneTexUnitMap;
/* Stream source management */
WineDirect3DVertexStridedData strided_streams;
} IWineD3DDeviceImpl; } IWineD3DDeviceImpl;
extern const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl; extern const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl;