From 1276b090b409f1a5c24ad5ed4b9ef889314d8a85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Fri, 29 May 2009 01:09:22 +0200 Subject: [PATCH] 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. --- dlls/wined3d/state.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 8f7ead3282b..143b508ed60 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -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); + } } }