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

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2016-04-26 17:55:57 +02:00 committed by Alexandre Julliard
parent b073e5c7b6
commit e6b647d121
5 changed files with 9 additions and 16 deletions

View File

@ -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)

View File

@ -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;
}

View File

@ -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)

View File

@ -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;

View File

@ -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];