Module: wine Branch: master Commit: 953a45303c28d23d2edb9c3e96ce549d72590919 URL: http://source.winehq.org/git/wine.git/?a=commit;h=953a45303c28d23d2edb9c3e96...
Author: Matteo Bruni mbruni@codeweavers.com Date: Thu May 28 23:23:04 2015 +0200
wined3d: Introduce a get_pointsize() function.
---
dlls/wined3d/state.c | 31 ++++--------------------------- dlls/wined3d/utils.c | 32 ++++++++++++++++++++++++++++++++ dlls/wined3d/wined3d_private.h | 2 ++ 3 files changed, 38 insertions(+), 27 deletions(-)
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index c0a87d3..37f4498 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -1458,33 +1458,10 @@ void state_psizemin_arb(struct wined3d_context *context, const struct wined3d_st void state_pscale(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { const struct wined3d_gl_info *gl_info = context->gl_info; - /* TODO: Group this with the viewport */ - /* - * POINTSCALEENABLE controls how point size value is treated. If set to - * true, the point size is scaled with respect to height of viewport. - * When set to false point size is in pixels. - */ - - /* Default values */ - GLfloat att[3] = {1.0f, 0.0f, 0.0f}; - union { - DWORD d; - float f; - } pointSize, A, B, C; + float att[3]; + float pointsize;
- pointSize.d = state->render_states[WINED3D_RS_POINTSIZE]; - A.d = state->render_states[WINED3D_RS_POINTSCALE_A]; - B.d = state->render_states[WINED3D_RS_POINTSCALE_B]; - C.d = state->render_states[WINED3D_RS_POINTSCALE_C]; - - if (state->render_states[WINED3D_RS_POINTSCALEENABLE]) - { - float scale_factor = state->viewport.height * state->viewport.height; - - att[0] = A.f / scale_factor; - att[1] = B.f / scale_factor; - att[2] = C.f / scale_factor; - } + get_pointsize(context, state, &pointsize, att);
if (gl_info->supported[ARB_POINT_PARAMETERS]) { @@ -1501,7 +1478,7 @@ void state_pscale(struct wined3d_context *context, const struct wined3d_state *s WARN("POINT_PARAMETERS not supported in this version of opengl\n"); }
- gl_info->gl_ops.gl.p_glPointSize(max(pointSize.f, FLT_MIN)); + gl_info->gl_ops.gl.p_glPointSize(max(pointsize, FLT_MIN)); checkGLcall("glPointSize(...);"); }
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 9084626..5ad82bd 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -3622,6 +3622,38 @@ void get_pointsize_minmax(const struct wined3d_context *context, const struct wi *out_max = max.f; }
+void get_pointsize(const struct wined3d_context *context, const struct wined3d_state *state, + float *out_pointsize, float *out_att) +{ + /* POINTSCALEENABLE controls how point size value is treated. If set to + * true, the point size is scaled with respect to height of viewport. + * When set to false point size is in pixels. */ + union + { + DWORD d; + float f; + } pointsize, a, b, c; + + out_att[0] = 1.0f; + out_att[1] = 0.0f; + out_att[2] = 0.0f; + + pointsize.d = state->render_states[WINED3D_RS_POINTSIZE]; + a.d = state->render_states[WINED3D_RS_POINTSCALE_A]; + b.d = state->render_states[WINED3D_RS_POINTSCALE_B]; + c.d = state->render_states[WINED3D_RS_POINTSCALE_C]; + + if (state->render_states[WINED3D_RS_POINTSCALEENABLE]) + { + float scale_factor = state->viewport.height * state->viewport.height; + + out_att[0] = a.f / scale_factor; + out_att[1] = b.f / scale_factor; + out_att[2] = c.f / scale_factor; + } + *out_pointsize = pointsize.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 a79d8b0..7f85317 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -3072,6 +3072,8 @@ void get_texture_matrix(const struct wined3d_context *context, const struct wine 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; +void get_pointsize(const struct wined3d_context *context, const struct wined3d_state *state, + float *out_pointsize, float *out_att) DECLSPEC_HIDDEN;
/* Using additional shader constants (uniforms in GLSL / program environment * or local parameters in ARB) is costly: