Stefan Dösinger : wined3d: Honor the driver' s min point size.

Alexandre Julliard julliard at winehq.org
Thu Nov 8 07:07:35 CST 2007


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

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Sat Nov  3 15:39:22 2007 +0100

wined3d: Honor the driver's min point size.

---

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

diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 9ccc47b..cff6550 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -641,6 +641,7 @@ BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info) {
     TRACE_(d3d_caps)("Maximum texture size support - max texture size=%d\n", gl_max);
 
     glGetFloatv(GL_POINT_SIZE_RANGE, gl_floatv);
+    gl_info->max_pointsizemin = gl_floatv[0];
     gl_info->max_pointsize = gl_floatv[1];
     TRACE_(d3d_caps)("Maximum point size support - max point size=%f\n", gl_floatv[1]);
 
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 7e847c9..251e77f 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -1312,14 +1312,18 @@ static void state_pscale(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3
         GLfloat scaleFactor;
         float h = stateblock->viewport.Height;
 
-        if(pointSize.f < 1.0f) {
+        if(pointSize.f < GL_LIMITS(pointsizemin)) {
             /*
-             * Minimum valid point size for OpenGL is 1.0f. For Direct3D it is 0.0f.
-             * This means that OpenGL will clamp really small point sizes to 1.0f.
-             * To correct for this we need to multiply by the scale factor when sizes
+             * Minimum valid point size for OpenGL is driver specific. For Direct3D it is
+             * 0.0f. This means that OpenGL will clamp really small point sizes to the
+             * driver minimum. To correct for this we need to multiply by the scale factor when sizes
              * are less than 1.0f. scale_factor =  1.0f / point_size.
              */
-            scaleFactor = pointSize.f;
+            scaleFactor = pointSize.f / GL_LIMITS(pointsizemin);
+            /* Clamp the point size, don't rely on the driver to do it. MacOS says min point size
+             * is 1.0, but then accepts points below that and draws too small points
+             */
+            pointSize.f = GL_LIMITS(pointsizemin);
         } else if(pointSize.f > GL_LIMITS(pointsize)) {
             /* gl already scales the input to glPointSize,
              * d3d scales the result after the point size scale.
diff --git a/include/wine/wined3d_gl.h b/include/wine/wined3d_gl.h
index 7fbe25c..1c316e9 100644
--- a/include/wine/wined3d_gl.h
+++ b/include/wine/wined3d_gl.h
@@ -1137,6 +1137,7 @@ void (WINE_GLAPI *glVertex4s) (GLshort x, GLshort y, GLshort z, GLshort w);
 void (WINE_GLAPI *glVertex4sv) (const GLshort* v);
 void (WINE_GLAPI *glVertexPointer) (GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
 void (WINE_GLAPI *glViewport) (GLint x, GLint y, GLsizei width, GLsizei height);
+void (WINE_GLAPI *glPointParameterfv) (GLenum pname, const GLfloat *params);
 
 /* WGL functions */
 HGLRC   (WINAPI *pwglCreateContext)(HDC);
@@ -1483,7 +1484,8 @@ BOOL    (WINAPI *pwglShareLists)(HGLRC,HGLRC);
     USE_GL_FUNC(glVertex4s) \
     USE_GL_FUNC(glVertex4sv) \
     USE_GL_FUNC(glVertexPointer) \
-    USE_GL_FUNC(glViewport)
+    USE_GL_FUNC(glViewport) \
+    USE_GL_FUNC(glPointParameterfv) \
 
 #define WGL_FUNCS_GEN \
     USE_WGL_FUNC(wglCreateContext) \
@@ -3719,7 +3721,7 @@ typedef struct _WineD3D_GL_Info {
   UINT   max_clipplanes;
   UINT   max_texture_size;
   UINT   max_texture3d_size;
-  float  max_pointsize;
+  float  max_pointsize, max_pointsizemin;
   UINT   max_blends;
   UINT   max_anisotropy;
   UINT   max_aux_buffers;




More information about the wine-cvs mailing list