Commit b073e5c7 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Store vertex shader floating point constants as wined3d_vec4 structures.

parent a6e1adb8
......@@ -695,7 +695,7 @@ static void shader_arb_load_constants_internal(struct shader_arb_priv *priv,
/* Load DirectX 9 float constants for vertex shader */
priv->highest_dirty_vs_const = shader_arb_load_constants_f(vshader, gl_info, GL_VERTEX_PROGRAM_ARB,
priv->highest_dirty_vs_const, (struct wined3d_vec4 *)state->vs_consts_f, priv->vshader_const_dirty);
priv->highest_dirty_vs_const, state->vs_consts_f, priv->vshader_const_dirty);
shader_arb_vs_local_constants(gl_shader, context, state);
}
......
......@@ -2480,7 +2480,7 @@ HRESULT CDECL wined3d_device_set_vs_consts_f(struct wined3d_device *device,
|| start_register > d3d_info->limits.vs_uniform_count)
return WINED3DERR_INVALIDCALL;
memcpy(&device->update_state->vs_consts_f[start_register * 4],
memcpy(&device->update_state->vs_consts_f[start_register],
constants, vector4f_count * sizeof(float) * 4);
if (TRACE_ON(d3d))
{
......@@ -2512,7 +2512,7 @@ HRESULT CDECL wined3d_device_get_vs_consts_f(const struct wined3d_device *device
if (!constants || count < 0)
return WINED3DERR_INVALIDCALL;
memcpy(constants, &device->state.vs_consts_f[start_register * 4], count * sizeof(float) * 4);
memcpy(constants, &device->state.vs_consts_f[start_register], count * sizeof(float) * 4);
return WINED3D_OK;
}
......
......@@ -1331,7 +1331,7 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
update_mask = context->constant_update_mask & prog->constant_update_mask;
if (update_mask & WINED3D_SHADER_CONST_VS_F)
shader_glsl_load_constants_f(vshader, gl_info, (const struct wined3d_vec4 *)state->vs_consts_f,
shader_glsl_load_constants_f(vshader, gl_info, state->vs_consts_f,
prog->vs.uniform_f_locations, &priv->vconst_heap, priv->stack, constant_version);
if (update_mask & WINED3D_SHADER_CONST_VS_I)
......
......@@ -675,16 +675,9 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock)
{
unsigned int idx = stateblock->contained_vs_consts_f[i];
TRACE("Setting vs_consts_f[%u] to {%.8e, %.8e, %.8e, %.8e}.\n", idx,
src_state->vs_consts_f[idx * 4 + 0],
src_state->vs_consts_f[idx * 4 + 1],
src_state->vs_consts_f[idx * 4 + 2],
src_state->vs_consts_f[idx * 4 + 3]);
TRACE("Setting vs_consts_f[%u] to %s.\n", idx, debug_vec4(&src_state->vs_consts_f[idx]));
stateblock->state.vs_consts_f[idx * 4 + 0] = src_state->vs_consts_f[idx * 4 + 0];
stateblock->state.vs_consts_f[idx * 4 + 1] = src_state->vs_consts_f[idx * 4 + 1];
stateblock->state.vs_consts_f[idx * 4 + 2] = src_state->vs_consts_f[idx * 4 + 2];
stateblock->state.vs_consts_f[idx * 4 + 3] = src_state->vs_consts_f[idx * 4 + 3];
stateblock->state.vs_consts_f[idx] = src_state->vs_consts_f[idx];
}
/* Vertex shader integer constants. */
......@@ -970,7 +963,7 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock)
for (i = 0; i < stateblock->num_contained_vs_consts_f; ++i)
{
wined3d_device_set_vs_consts_f(device, stateblock->contained_vs_consts_f[i],
stateblock->state.vs_consts_f + stateblock->contained_vs_consts_f[i] * 4, 1);
&stateblock->state.vs_consts_f[stateblock->contained_vs_consts_f[i]].x, 1);
}
for (i = 0; i < stateblock->num_contained_vs_consts_i; ++i)
{
......@@ -1325,7 +1318,7 @@ HRESULT state_init(struct wined3d_state *state, struct wined3d_fb_state *fb,
}
if (!(state->vs_consts_f = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
4 * sizeof(float) * d3d_info->limits.vs_uniform_count)))
sizeof(*state->vs_consts_f) * d3d_info->limits.vs_uniform_count)))
return E_OUTOFMEMORY;
if (!(state->ps_consts_f = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
......
......@@ -2211,7 +2211,7 @@ struct wined3d_state
BOOL vs_consts_b[MAX_CONST_B];
INT vs_consts_i[MAX_CONST_I * 4];
float *vs_consts_f;
struct wined3d_vec4 *vs_consts_f;
BOOL ps_consts_b[MAX_CONST_B];
INT ps_consts_i[MAX_CONST_I * 4];
......
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