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

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

parent b073e5c7
......@@ -707,7 +707,7 @@ static void shader_arb_load_constants_internal(struct shader_arb_priv *priv,
/* Load DirectX 9 float constants for pixel shader */
priv->highest_dirty_ps_const = shader_arb_load_constants_f(pshader, gl_info, GL_FRAGMENT_PROGRAM_ARB,
priv->highest_dirty_ps_const, (struct wined3d_vec4 *)state->ps_consts_f, priv->pshader_const_dirty);
priv->highest_dirty_ps_const, state->ps_consts_f, priv->pshader_const_dirty);
shader_arb_ps_local_constants(gl_shader, context, state, rt_height);
if (context->constant_update_mask & WINED3D_SHADER_CONST_PS_NP2_FIXUP)
......
......@@ -2715,7 +2715,7 @@ HRESULT CDECL wined3d_device_set_ps_consts_f(struct wined3d_device *device,
|| start_register > d3d_info->limits.ps_uniform_count)
return WINED3DERR_INVALIDCALL;
memcpy(&device->update_state->ps_consts_f[start_register * 4],
memcpy(&device->update_state->ps_consts_f[start_register],
constants, vector4f_count * sizeof(float) * 4);
if (TRACE_ON(d3d))
{
......@@ -2746,7 +2746,7 @@ HRESULT CDECL wined3d_device_get_ps_consts_f(const struct wined3d_device *device
if (!constants || count < 0)
return WINED3DERR_INVALIDCALL;
memcpy(constants, &device->state.ps_consts_f[start_register * 4], count * sizeof(float) * 4);
memcpy(constants, &device->state.ps_consts_f[start_register], count * sizeof(float) * 4);
return WINED3D_OK;
}
......
......@@ -1404,7 +1404,7 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
}
if (update_mask & WINED3D_SHADER_CONST_PS_F)
shader_glsl_load_constants_f(pshader, gl_info, (const struct wined3d_vec4 *)state->ps_consts_f,
shader_glsl_load_constants_f(pshader, gl_info, state->ps_consts_f,
prog->ps.uniform_f_locations, &priv->pconst_heap, priv->stack, constant_version);
if (update_mask & WINED3D_SHADER_CONST_PS_I)
......
......@@ -713,16 +713,9 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock)
{
unsigned int idx = stateblock->contained_ps_consts_f[i];
TRACE("Setting ps_consts_f[%u] to {%.8e, %.8e, %.8e, %.8e}.\n", idx,
src_state->ps_consts_f[idx * 4 + 0],
src_state->ps_consts_f[idx * 4 + 1],
src_state->ps_consts_f[idx * 4 + 2],
src_state->ps_consts_f[idx * 4 + 3]);
TRACE("Setting ps_consts_f[%u] to %s.\n", idx, debug_vec4(&src_state->ps_consts_f[idx]));
stateblock->state.ps_consts_f[idx * 4 + 0] = src_state->ps_consts_f[idx * 4 + 0];
stateblock->state.ps_consts_f[idx * 4 + 1] = src_state->ps_consts_f[idx * 4 + 1];
stateblock->state.ps_consts_f[idx * 4 + 2] = src_state->ps_consts_f[idx * 4 + 2];
stateblock->state.ps_consts_f[idx * 4 + 3] = src_state->ps_consts_f[idx * 4 + 3];
stateblock->state.ps_consts_f[idx] = src_state->ps_consts_f[idx];
}
/* Pixel shader integer constants. */
......@@ -985,7 +978,7 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock)
for (i = 0; i < stateblock->num_contained_ps_consts_f; ++i)
{
wined3d_device_set_ps_consts_f(device, stateblock->contained_ps_consts_f[i],
stateblock->state.ps_consts_f + stateblock->contained_ps_consts_f[i] * 4, 1);
&stateblock->state.ps_consts_f[stateblock->contained_ps_consts_f[i]].x, 1);
}
for (i = 0; i < stateblock->num_contained_ps_consts_i; ++i)
{
......@@ -1322,7 +1315,7 @@ HRESULT state_init(struct wined3d_state *state, struct wined3d_fb_state *fb,
return E_OUTOFMEMORY;
if (!(state->ps_consts_f = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
4 * sizeof(float) * d3d_info->limits.ps_uniform_count)))
sizeof(*state->ps_consts_f) * d3d_info->limits.ps_uniform_count)))
{
HeapFree(GetProcessHeap(), 0, state->vs_consts_f);
return E_OUTOFMEMORY;
......
......@@ -2215,7 +2215,7 @@ struct wined3d_state
BOOL ps_consts_b[MAX_CONST_B];
INT ps_consts_i[MAX_CONST_I * 4];
float *ps_consts_f;
struct wined3d_vec4 *ps_consts_f;
struct wined3d_texture *textures[MAX_COMBINED_SAMPLERS];
DWORD sampler_states[MAX_COMBINED_SAMPLERS][WINED3D_HIGHEST_SAMPLER_STATE + 1];
......
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