Module: wine Branch: master Commit: e6b647d121b0793f3bb59baa37e3d27401cffe62 URL: http://source.winehq.org/git/wine.git/?a=commit;h=e6b647d121b0793f3bb59baa37...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Tue Apr 26 17:55:57 2016 +0200
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
---
dlls/wined3d/arb_program_shader.c | 2 +- dlls/wined3d/device.c | 4 ++-- dlls/wined3d/glsl_shader.c | 2 +- dlls/wined3d/stateblock.c | 15 ++++----------- dlls/wined3d/wined3d_private.h | 2 +- 5 files changed, 9 insertions(+), 16 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index 51df0ef..266f5f5 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -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) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index df5565f..6342ee3 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -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; } diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 5096b75..f8c4a99 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -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) diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index b7fd1a6..3f9cb34 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -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; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 595af5d..274f620 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -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];