wined3d: Move decoding the vertex declaration to the vertexshader state handler.
This commit is contained in:
parent
04ce141940
commit
438c172841
|
@ -1943,7 +1943,7 @@ void drawPrimitive(IWineD3DDevice *iface,
|
|||
BOOL usePixelShaderFunction = FALSE;
|
||||
IWineD3DSwapChainImpl *swapchain;
|
||||
int i;
|
||||
BOOL fixup = FALSE;
|
||||
BOOL fixup;
|
||||
DWORD dirtyState, idx;
|
||||
BYTE shift;
|
||||
|
||||
|
@ -1980,6 +1980,7 @@ void drawPrimitive(IWineD3DDevice *iface,
|
|||
StateTable[dirtyState].apply(dirtyState, This->stateBlock);
|
||||
}
|
||||
This->numDirtyEntries = 0; /* This makes the whole list clean */
|
||||
fixup = This->streamFixedUp;
|
||||
|
||||
if (TRACE_ON(d3d_draw) && wined3d_settings.offscreen_rendering_mode == ORM_FBO) {
|
||||
check_fbo_status(iface);
|
||||
|
@ -1990,44 +1991,6 @@ void drawPrimitive(IWineD3DDevice *iface,
|
|||
}
|
||||
This->depth_copy_state = WINED3D_DCS_INITIAL;
|
||||
|
||||
if(This->up_strided) {
|
||||
|
||||
/* Note: this is a ddraw fixed-function code path */
|
||||
|
||||
TRACE("================ Strided Input ===================\n");
|
||||
memcpy(&This->strided_streams, This->up_strided, sizeof(This->strided_streams));
|
||||
drawPrimitiveTraceDataLocations(&This->strided_streams);
|
||||
fixup = FALSE;
|
||||
}
|
||||
|
||||
else if (This->stateBlock->vertexDecl || This->stateBlock->vertexShader) {
|
||||
|
||||
/* Note: This is a fixed function or shader codepath.
|
||||
* This means it must handle both types of strided data.
|
||||
* Shaders must go through here to zero the strided data, even if they
|
||||
* don't set any declaration at all */
|
||||
|
||||
TRACE("================ Vertex Declaration ===================\n");
|
||||
memset(&This->strided_streams, 0, sizeof(This->strided_streams));
|
||||
|
||||
if (This->stateBlock->vertexDecl != NULL ||
|
||||
((IWineD3DVertexShaderImpl *)This->stateBlock->vertexShader)->vertexDeclaration != NULL)
|
||||
|
||||
primitiveDeclarationConvertToStridedData(iface, useVertexShaderFunction,
|
||||
&This->strided_streams, &fixup);
|
||||
|
||||
} else {
|
||||
|
||||
/* Note: This codepath is not reachable from d3d9 (see fvf->decl9 conversion)
|
||||
* It is reachable through d3d8, but only for fixed-function.
|
||||
* It will not work properly for shaders. */
|
||||
|
||||
TRACE("================ FVF ===================\n");
|
||||
memset(&This->strided_streams, 0, sizeof(This->strided_streams));
|
||||
primitiveConvertToStridedData(iface, &This->strided_streams, &fixup);
|
||||
drawPrimitiveTraceDataLocations(&This->strided_streams);
|
||||
}
|
||||
|
||||
/* Setup transform matrices and sort out */
|
||||
primitiveInitState(iface, &This->strided_streams, useVertexShaderFunction, &lighting_changed, &lighting_original);
|
||||
|
||||
|
|
|
@ -1857,8 +1857,49 @@ 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");
|
||||
static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock) {
|
||||
BOOL useVertexShaderFunction = FALSE;
|
||||
stateblock->wineD3DDevice->streamFixedUp = FALSE;
|
||||
|
||||
/* Shaders can be implemented using ARB_PROGRAM, GLSL, or software -
|
||||
* here simply check whether a shader was set, or the user disabled shaders
|
||||
*/
|
||||
if (stateblock->wineD3DDevice->vs_selected_mode != SHADER_NONE && stateblock->vertexShader &&
|
||||
((IWineD3DVertexShaderImpl *)stateblock->vertexShader)->baseShader.function != NULL)
|
||||
useVertexShaderFunction = TRUE;
|
||||
|
||||
if(stateblock->wineD3DDevice->up_strided) {
|
||||
|
||||
/* Note: this is a ddraw fixed-function code path */
|
||||
TRACE("================ Strided Input ===================\n");
|
||||
memcpy(&stateblock->wineD3DDevice->strided_streams, stateblock->wineD3DDevice->up_strided, sizeof(stateblock->wineD3DDevice->strided_streams));
|
||||
stateblock->wineD3DDevice->streamFixedUp = FALSE;
|
||||
}
|
||||
else if (stateblock->vertexDecl || stateblock->vertexShader) {
|
||||
/* Note: This is a fixed function or shader codepath.
|
||||
* This means it must handle both types of strided data.
|
||||
* Shaders must go through here to zero the strided data, even if they
|
||||
* don't set any declaration at all
|
||||
*/
|
||||
TRACE("================ Vertex Declaration ===================\n");
|
||||
memset(&stateblock->wineD3DDevice->strided_streams, 0, sizeof(stateblock->wineD3DDevice->strided_streams));
|
||||
|
||||
if (stateblock->vertexDecl != NULL ||
|
||||
((IWineD3DVertexShaderImpl *)stateblock->vertexShader)->vertexDeclaration != NULL) {
|
||||
|
||||
primitiveDeclarationConvertToStridedData((IWineD3DDevice *) stateblock->wineD3DDevice, useVertexShaderFunction,
|
||||
&stateblock->wineD3DDevice->strided_streams, &stateblock->wineD3DDevice->streamFixedUp);
|
||||
}
|
||||
} else {
|
||||
/* Note: This codepath is not reachable from d3d9 (see fvf->decl9 conversion)
|
||||
* It is reachable through d3d8, but only for fixed-function.
|
||||
* It will not work properly for shaders.
|
||||
*/
|
||||
TRACE("================ FVF ===================\n");
|
||||
memset(&stateblock->wineD3DDevice->strided_streams, 0, sizeof(stateblock->wineD3DDevice->strided_streams));
|
||||
primitiveConvertToStridedData((IWineD3DDevice *) stateblock->wineD3DDevice, &stateblock->wineD3DDevice->strided_streams,
|
||||
&stateblock->wineD3DDevice->streamFixedUp);
|
||||
}
|
||||
}
|
||||
|
||||
const struct StateEntry StateTable[] =
|
||||
|
|
|
@ -669,6 +669,7 @@ typedef struct IWineD3DDeviceImpl
|
|||
/* Stream source management */
|
||||
WineDirect3DVertexStridedData strided_streams;
|
||||
WineDirect3DVertexStridedData *up_strided;
|
||||
BOOL streamFixedUp;
|
||||
|
||||
} IWineD3DDeviceImpl;
|
||||
|
||||
|
|
Loading…
Reference in New Issue