wined3d: Update clipplanes on a shader-fixed function switch.

The view matrix that was set at the time the clipplane was applied is
hardcoded into the clipplane. With vertex shaders clip planes ignore
the view matrix in d3d. We implement that, but this also means that
the clip planes potentially change when we switch between vs and fixed
func.
This commit is contained in:
Stefan Dösinger 2009-05-29 01:09:22 +02:00 committed by Alexandre Julliard
parent dfc9141458
commit 1276b090b4
1 changed files with 12 additions and 1 deletions

View File

@ -4348,6 +4348,7 @@ static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, W
/* Some stuff is in the device until we have per context tracking */
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
BOOL wasrhw = context->last_was_rhw;
unsigned int i;
transformed = device->strided_streams.position_transformed;
if(transformed != context->last_was_rhw && !useVertexShaderFunction) {
@ -4419,13 +4420,15 @@ static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, W
if(!device->vs_clipping && !isStateDirty(context, STATE_RENDER(WINED3DRS_CLIPPLANEENABLE))) {
state_clipping(STATE_RENDER(WINED3DRS_CLIPPLANEENABLE), stateblock, context);
}
for(i = 0; i < GL_LIMITS(clipplanes); i++) {
clipplane(STATE_CLIPPLANE(i), stateblock, context);
}
}
if(!isStateDirty(context, STATE_RENDER(WINED3DRS_NORMALIZENORMALS))) {
state_normalize(STATE_RENDER(WINED3DRS_NORMALIZENORMALS), stateblock, context);
}
} else {
if(!context->last_was_vshader) {
unsigned int i;
static BOOL warned = FALSE;
if(!device->vs_clipping) {
/* Disable all clip planes to get defined results on all drivers. See comment in the
@ -4455,6 +4458,14 @@ static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, W
}
}
updateFog = TRUE;
/* Vertex shader clipping ignores the view matrix. Update all clipplanes
* (Note: ARB shaders can read the clip planes for clipping emulation even if
* device->vs_clipping is false.
*/
for(i = 0; i < GL_LIMITS(clipplanes); i++) {
clipplane(STATE_CLIPPLANE(i), stateblock, context);
}
}
}