Module: wine Branch: master Commit: b073e5c7b6e76b8295f13f8069031460a5161e86 URL: http://source.winehq.org/git/wine.git/?a=commit;h=b073e5c7b6e76b8295f13f8069...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Tue Apr 26 17:55:56 2016 +0200
wined3d: Store vertex 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 a48773f..51df0ef 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -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); }
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 5a30157..df5565f 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -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; } diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 4fd24ba..5096b75 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -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) diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index cb3d494..b7fd1a6 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -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, diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 9ce2281..595af5d 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -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];