[7/8] WineD3D: CLip planes with vertex shaders
Stefan Dösinger
stefan at codeweavers.com
Wed Feb 28 10:23:44 CST 2007
Ok, I agree that this is not the optimal way to deal with the strangeness of
the macos ati driver. But I am fed up with tracking down obscure driver
bugs :-|
-------------- next part --------------
From 9153283d7a89dfcd7e1b568e7bb20cdceb4933ad Mon Sep 17 00:00:00 2001
From: Stefan Doesinger <stefan at codeweavers.com>
Date: Tue, 27 Feb 2007 23:11:15 +0100
Subject: [PATCH] WineD3D: CLip planes with vertex shaders
Clip planes with vertex shaders are supposed to be disabled according to the opengl
extension - so write a fixme. The macos ati driver sometimes(not always) keeps clip planes
enabled. To get a proper result on all drivers disable all clip planes when vertex shaders
are used.
---
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
--
1.4.4.3
More information about the wine-patches
mailing list