Stefan Dösinger : wined3d: Use GL_NV_depth_clamp to implement clipping disable.

Alexandre Julliard julliard at winehq.org
Mon Sep 17 07:59:46 CDT 2007


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

Author: Stefan Dösinger <stefandoesinger at gmx.at>
Date:   Tue Sep 11 16:41:01 2007 +0200

wined3d: Use GL_NV_depth_clamp to implement clipping disable.

---

 dlls/wined3d/directx.c    |    1 +
 dlls/wined3d/state.c      |    8 ++++++++
 include/wine/wined3d_gl.h |    6 ++++++
 3 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index c6f4ed0..3eaff3d 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -117,6 +117,7 @@ static const struct {
     {"GL_NV_vertex_program1_1",             NV_VERTEX_PROGRAM1_1},
     {"GL_NV_vertex_program2",               NV_VERTEX_PROGRAM2},
     {"GL_NV_vertex_program3",               NV_VERTEX_PROGRAM3},
+    {"GL_NV_depth_clamp",                   NV_DEPTH_CLAMP},
 
     /* SGI */
     {"GL_SGIS_generate_mipmap",             SGIS_GENERATE_MIPMAP},
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 493be88..da2fb3c 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -439,9 +439,17 @@ static void state_clipping(DWORD state, IWineD3DStateBlockImpl *stateblock, Wine
     if (stateblock->renderState[WINED3DRS_CLIPPING]) {
         enable  = stateblock->renderState[WINED3DRS_CLIPPLANEENABLE];
         disable = ~stateblock->renderState[WINED3DRS_CLIPPLANEENABLE];
+        if(GL_SUPPORT(NV_DEPTH_CLAMP)) {
+            glDisable(GL_DEPTH_CLAMP_NV);
+            checkGLcall("glDisable(GL_DEPTH_CLAMP_NV)");
+        }
     } else {
         disable = 0xffffffff;
         enable  = 0x00;
+        if(GL_SUPPORT(NV_DEPTH_CLAMP)) {
+            glEnable(GL_DEPTH_CLAMP_NV);
+            checkGLcall("glEnable(GL_DEPTH_CLAMP_NV)");
+        }
     }
 
     if (enable & WINED3DCLIPPLANE0)  { glEnable(GL_CLIP_PLANE0);  checkGLcall("glEnable(clip plane 0)"); }
diff --git a/include/wine/wined3d_gl.h b/include/wine/wined3d_gl.h
index 4861262..18ddf6a 100644
--- a/include/wine/wined3d_gl.h
+++ b/include/wine/wined3d_gl.h
@@ -2847,6 +2847,11 @@ typedef int (WINE_GLAPI * PGLXFNWAITVIDEOSYNCSGIPROC) (int, int, unsigned int *)
 #define GLX_SGIS_generate_mipmap
 #endif
 
+/* GL_NV_depth_clamp */
+#ifndef GL_NV_depth_clamp
+#define GL_DEPTH_CLAMP_NV                   0x864F
+#endif
+
 /* GL_VERSION_2_0 */
 #ifndef GL_VERSION_2_0
 #define GL_VERSION_2_0 1
@@ -3184,6 +3189,7 @@ typedef enum _GL_SupportedExt {
   NV_VERTEX_PROGRAM2,
   NV_VERTEX_PROGRAM3,
   NV_FENCE,
+  NV_DEPTH_CLAMP,
   /* ATI */
   ATI_SEPARATE_STENCIL,
   ATI_TEXTURE_ENV_COMBINE3,




More information about the wine-cvs mailing list