From 14b7b784bc134b1b3c4c2fe1c184c23d07aa2431 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Thu, 30 Jul 2009 21:16:46 +0200
Subject: [PATCH 3/7] WineD3D: ARB clipplane init needs the helper constant

I stumbled uppon this while testing the clip plane emulation. The problem
isn't visible on most cards because GL_SUPPORT(NV_VERTEX_PROGRAM2_OPTION) and
GL_SUPPORT(NV_VERTEX_PROGRAM) are equal on anything post-geforce 4. Still on a
geforce 4 or 3 things might break.
---
 dlls/wined3d/arb_program_shader.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index 682624b..f6b5b5f 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -49,11 +49,18 @@ static BOOL need_mova_const(IWineD3DBaseShader *shader, const struct wined3d_gl_
     return !GL_SUPPORT(NV_VERTEX_PROGRAM2_OPTION);
 }
 
+/* Returns TRUE if result.clip from GL_NV_vertex_program2 should be used and FALSE otherwise */
+static inline BOOL use_nv_clip(const struct wined3d_gl_info *gl_info)
+{
+    return GL_SUPPORT(NV_VERTEX_PROGRAM2_OPTION);
+}
+
 static BOOL need_helper_const(const struct wined3d_gl_info *gl_info)
 {
     if (!GL_SUPPORT(NV_VERTEX_PROGRAM) /* Need to init colors. */
-            || gl_info->quirks & WINED3D_QUIRK_ARB_VS_OFFSET_LIMIT /* Load the immval offset. */
-            || gl_info->quirks & WINED3D_QUIRK_SET_TEXCOORD_W) /* Have to init texcoords. */
+        || gl_info->quirks & WINED3D_QUIRK_ARB_VS_OFFSET_LIMIT /* Load the immval offset. */
+        || gl_info->quirks & WINED3D_QUIRK_SET_TEXCOORD_W /* Have to init texcoords. */
+        || (!use_nv_clip(gl_info)) /* Init the clip texcoord */)
     {
         return TRUE;
     }
@@ -76,12 +83,6 @@ static inline BOOL ffp_clip_emul(IWineD3DStateBlockImpl *stateblock)
     return stateblock->lowest_disabled_stage < 7;
 }
 
-/* Returns TRUE if result.clip from GL_NV_vertex_program2 should be used and FALSE otherwise */
-static inline BOOL use_nv_clip(const struct wined3d_gl_info *gl_info)
-{
-    return GL_SUPPORT(NV_VERTEX_PROGRAM2_OPTION);
-}
-
 /* Internally used shader constants. Applications can use constants 0 to GL_LIMITS(vshader_constantsF) - 1,
  * so upload them above that
  */
-- 
1.6.3.3


