We've had some trouble in the past with copying integers around via
float pointers, as the C compiler sometimes uses x87 floating point
registers to load values on 32-bit systems. Passing the
gl_constant_value union should be safer.
To avoid churn, this patch creates a "GLfloat *value" variable so
existing uses can stay the same.
Not observed to fix anything, but I was in the area adding more integer
state vars, and thought it'd be wise.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Cc: mesa-stable@lists.freedesktop.org
*/
static void
_mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
- GLfloat *value)
+ gl_constant_value *val)
{
+ GLfloat *value = &val->f;
+
switch (state[0]) {
case STATE_MATERIAL:
{
}
return;
case STATE_NUM_SAMPLES:
- ((int *)value)[0] = MAX2(1, _mesa_geometric_samples(ctx->DrawBuffer));
+ val[0].i = MAX2(1, _mesa_geometric_samples(ctx->DrawBuffer));
return;
case STATE_DEPTH_RANGE:
value[0] = ctx->ViewportArray[0].Near; /* near */
if (paramList->Parameters[i].Type == PROGRAM_STATE_VAR) {
_mesa_fetch_state(ctx,
paramList->Parameters[i].StateIndexes,
- ¶mList->ParameterValues[i][0].f);
+ ¶mList->ParameterValues[i][0]);
}
}
}