Commit 953a4530 authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

wined3d: Introduce a get_pointsize() function.

parent 36520c3e
......@@ -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(...);");
}
......
......@@ -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)
{
......
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment