Commit 1276b090 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

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.
parent dfc91414
...@@ -4348,6 +4348,7 @@ static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, W ...@@ -4348,6 +4348,7 @@ static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, W
/* Some stuff is in the device until we have per context tracking */ /* Some stuff is in the device until we have per context tracking */
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice; IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
BOOL wasrhw = context->last_was_rhw; BOOL wasrhw = context->last_was_rhw;
unsigned int i;
transformed = device->strided_streams.position_transformed; transformed = device->strided_streams.position_transformed;
if(transformed != context->last_was_rhw && !useVertexShaderFunction) { if(transformed != context->last_was_rhw && !useVertexShaderFunction) {
...@@ -4419,13 +4420,15 @@ static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, W ...@@ -4419,13 +4420,15 @@ static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, W
if(!device->vs_clipping && !isStateDirty(context, STATE_RENDER(WINED3DRS_CLIPPLANEENABLE))) { if(!device->vs_clipping && !isStateDirty(context, STATE_RENDER(WINED3DRS_CLIPPLANEENABLE))) {
state_clipping(STATE_RENDER(WINED3DRS_CLIPPLANEENABLE), stateblock, context); 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))) { if(!isStateDirty(context, STATE_RENDER(WINED3DRS_NORMALIZENORMALS))) {
state_normalize(STATE_RENDER(WINED3DRS_NORMALIZENORMALS), stateblock, context); state_normalize(STATE_RENDER(WINED3DRS_NORMALIZENORMALS), stateblock, context);
} }
} else { } else {
if(!context->last_was_vshader) { if(!context->last_was_vshader) {
unsigned int i;
static BOOL warned = FALSE; static BOOL warned = FALSE;
if(!device->vs_clipping) { if(!device->vs_clipping) {
/* Disable all clip planes to get defined results on all drivers. See comment in the /* 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 ...@@ -4455,6 +4458,14 @@ static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, W
} }
} }
updateFog = TRUE; 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);
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment