Matteo Bruni : wined3d: Introduce a get_pointsize_minmax() function.

Alexandre Julliard julliard at wine.codeweavers.com
Fri May 29 05:29:49 CDT 2015


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

Author: Matteo Bruni <mbruni at codeweavers.com>
Date:   Thu May 28 23:23:03 2015 +0200

wined3d: Introduce a get_pointsize_minmax() function.

---

 dlls/wined3d/state.c           | 56 +++++++++++-------------------------------
 dlls/wined3d/utils.c           | 19 ++++++++++++++
 dlls/wined3d/wined3d_private.h |  2 ++
 3 files changed, 35 insertions(+), 42 deletions(-)

diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 40b04e7..c0a87d3 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -1419,67 +1419,39 @@ static void state_normalize(struct wined3d_context *context, const struct wined3
 
 void state_psizemin_w(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 {
-    union {
-        DWORD d;
-        float f;
-    } tmpvalue;
+    float min, max;
 
-    tmpvalue.d = state->render_states[WINED3D_RS_POINTSIZE_MIN];
-    if (tmpvalue.f != 1.0f)
-    {
-        FIXME("WINED3D_RS_POINTSIZE_MIN not supported on this opengl, value is %f\n", tmpvalue.f);
-    }
-    tmpvalue.d = state->render_states[WINED3D_RS_POINTSIZE_MAX];
-    if (tmpvalue.f != 64.0f)
-    {
-        FIXME("WINED3D_RS_POINTSIZE_MAX not supported on this opengl, value is %f\n", tmpvalue.f);
-    }
+    get_pointsize_minmax(context, state, &min, &max);
 
+    if (min != 1.0f)
+        FIXME("WINED3D_RS_POINTSIZE_MIN value %.8e not supported on this OpenGL implementation.\n", min);
+    if (max != 64.0f)
+        FIXME("WINED3D_RS_POINTSIZE_MAX value %.8e not supported on this OpenGL implementation.\n", max);
 }
 
 void state_psizemin_ext(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 {
     const struct wined3d_gl_info *gl_info = context->gl_info;
-    union
-    {
-        DWORD d;
-        float f;
-    } min, max;
+    float min, max;
 
-    min.d = state->render_states[WINED3D_RS_POINTSIZE_MIN];
-    max.d = state->render_states[WINED3D_RS_POINTSIZE_MAX];
+    get_pointsize_minmax(context, state, &min, &max);
 
-    /* Max point size trumps min point size */
-    if(min.f > max.f) {
-        min.f = max.f;
-    }
-
-    GL_EXTCALL(glPointParameterfEXT)(GL_POINT_SIZE_MIN_EXT, min.f);
+    GL_EXTCALL(glPointParameterfEXT)(GL_POINT_SIZE_MIN_EXT, min);
     checkGLcall("glPointParameterfEXT(...)");
-    GL_EXTCALL(glPointParameterfEXT)(GL_POINT_SIZE_MAX_EXT, max.f);
+    GL_EXTCALL(glPointParameterfEXT)(GL_POINT_SIZE_MAX_EXT, max);
     checkGLcall("glPointParameterfEXT(...)");
 }
 
 void state_psizemin_arb(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 {
     const struct wined3d_gl_info *gl_info = context->gl_info;
-    union
-    {
-        DWORD d;
-        float f;
-    } min, max;
+    float min, max;
 
-    min.d = state->render_states[WINED3D_RS_POINTSIZE_MIN];
-    max.d = state->render_states[WINED3D_RS_POINTSIZE_MAX];
-
-    /* Max point size trumps min point size */
-    if(min.f > max.f) {
-        min.f = max.f;
-    }
+    get_pointsize_minmax(context, state, &min, &max);
 
-    GL_EXTCALL(glPointParameterfARB)(GL_POINT_SIZE_MIN_ARB, min.f);
+    GL_EXTCALL(glPointParameterfARB)(GL_POINT_SIZE_MIN_ARB, min);
     checkGLcall("glPointParameterfARB(...)");
-    GL_EXTCALL(glPointParameterfARB)(GL_POINT_SIZE_MAX_ARB, max.f);
+    GL_EXTCALL(glPointParameterfARB)(GL_POINT_SIZE_MAX_ARB, max);
     checkGLcall("glPointParameterfARB(...)");
 }
 
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index bd9b710..9084626 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -3603,6 +3603,25 @@ void get_texture_matrix(const struct wined3d_context *context, const struct wine
     }
 }
 
+void get_pointsize_minmax(const struct wined3d_context *context, const struct wined3d_state *state,
+        float *out_min, float *out_max)
+{
+    union
+    {
+        DWORD d;
+        float f;
+    } min, max;
+
+    min.d = state->render_states[WINED3D_RS_POINTSIZE_MIN];
+    max.d = state->render_states[WINED3D_RS_POINTSIZE_MAX];
+
+    if (min.f > max.f)
+        min.f = max.f;
+
+    *out_min = min.f;
+    *out_max = max.f;
+}
+
 /* This small helper function is used to convert a bitmask into the number of masked bits */
 unsigned int count_bits(unsigned int mask)
 {
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 8215eac..a79d8b0 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3070,6 +3070,8 @@ void get_projection_matrix(const struct wined3d_context *context, const struct w
         struct wined3d_matrix *mat) DECLSPEC_HIDDEN;
 void get_texture_matrix(const struct wined3d_context *context, const struct wined3d_state *state,
         unsigned int tex, struct wined3d_matrix *mat) DECLSPEC_HIDDEN;
+void get_pointsize_minmax(const struct wined3d_context *context, const struct wined3d_state *state,
+        float *out_min, float *out_max) DECLSPEC_HIDDEN;
 
 /* Using additional shader constants (uniforms in GLSL / program environment
  * or local parameters in ARB) is costly:




More information about the wine-cvs mailing list