Stefan Dösinger : wined3d: Update clipplanes on a shader-fixed function switch.

Alexandre Julliard julliard at winehq.org
Tue Jun 2 08:44:34 CDT 2009


Module: wine
Branch: master
Commit: 1276b090b409f1a5c24ad5ed4b9ef889314d8a85
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1276b090b409f1a5c24ad5ed4b9ef889314d8a85

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Fri May 29 01:09:22 2009 +0200

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 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 8f7ead3..143b508 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);
+            }
         }
     }
 




More information about the wine-cvs mailing list