Module: wine
Branch: master
Commit: 5afbfd0359abb3b36648bad1bb7c9ef803a7a46e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5afbfd0359abb3b36648bad1b…
Author: Stefan Dösinger <stefan(a)codeweavers.com>
Date: Tue Feb 27 23:11:15 2007 +0100
wined3d: Clip planes with vertex shaders.
---
dlls/wined3d/state.c | 37 +++++++++++++++++++++++++++++++++++++
1 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 2fd2804..0f107c3 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -388,6 +388,22 @@ static void state_clipping(DWORD state, IWineD3DStateBlockImpl *stateblock, Wine
DWORD enable = 0xFFFFFFFF;
DWORD disable = 0x00000000;
+ if(stateblock->vertexShader) {
+ /* The spec says that opengl clipping planes are disabled when using shaders. Direct3D planes aren't,
+ * so that is an issue. The MacOS ATI driver keeps clipping planes activated with shaders in some
+ * contitions I got sick of tracking down. The shader state handler disables all clip planes because
+ * of that - don't do anything here and keep them disabled
+ */
+ if(stateblock->renderState[WINED3DRS_CLIPPLANEENABLE]) {
+ static BOOL warned = FALSE;
+ if(!warned) {
+ FIXME("Clipping not supported with vertex shaders\n");
+ warned = TRUE;
+ }
+ }
+ return;
+ }
+
/* TODO: Keep track of previously enabled clipplanes to avoid unneccessary resetting
* of already set values
*/
@@ -2924,11 +2940,32 @@ static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, W
if(!isStateDirty(context, STATE_RENDER(WINED3DRS_COLORVERTEX))) {
state_colormat(STATE_RENDER(WINED3DRS_COLORVERTEX), stateblock, context);
}
+
+ if(context->last_was_vshader && !isStateDirty(context, STATE_RENDER(WINED3DRS_CLIPPLANEENABLE))) {
+ state_clipping(STATE_RENDER(WINED3DRS_CLIPPLANEENABLE), stateblock, context);
+ }
} else {
/* We compile the shader here because we need the vertex declaration
* in order to determine if we need to do any swizzling for D3DCOLOR
* registers. If the shader is already compiled this call will do nothing. */
IWineD3DVertexShader_CompileShader(stateblock->vertexShader);
+
+ if(!context->last_was_vshader) {
+ int i;
+ static BOOL warned = FALSE;
+ /* Disable all clip planes to get defined results on all drivers. See comment in the
+ * state_clipping state handler
+ */
+ for(i = 0; i < GL_LIMITS(clipplanes); i++) {
+ glDisable(GL_CLIP_PLANE0 + i);
+ checkGLcall("glDisable(GL_CLIP_PLANE0 + i)");
+ }
+
+ if(!warned && stateblock->renderState[WINED3DRS_CLIPPLANEENABLE]) {
+ FIXME("Clipping not supported with vertex shaders\n");
+ warned = TRUE;
+ }
+ }
}
/* Vertex and pixel shaders are applied together for now, so let the last dirty state do the