Module: wine Branch: master Commit: 0a8951d99b2691f733188f01e2a7608cb1a76409 URL: http://source.winehq.org/git/wine.git/?a=commit;h=0a8951d99b2691f733188f01e2...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Tue May 17 19:41:59 2016 +0200
wined3d: Make wined3d_device_set_ps_consts_b() consistent with wined3d_device_set_ps_consts_f().
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/d3d9/device.c | 2 +- dlls/wined3d/device.c | 24 ++++++++++++++---------- dlls/wined3d/stateblock.c | 2 +- dlls/wined3d/wined3d.spec | 2 +- include/wine/wined3d.h | 2 +- 5 files changed, 18 insertions(+), 14 deletions(-)
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 25ed842..9fc49ea 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -3174,7 +3174,7 @@ static HRESULT WINAPI d3d9_device_SetPixelShaderConstantB(IDirect3DDevice9Ex *if TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count);
wined3d_mutex_lock(); - hr = wined3d_device_set_ps_consts_b(device->wined3d_device, reg_idx, data, count); + hr = wined3d_device_set_ps_consts_b(device->wined3d_device, reg_idx, count, data); wined3d_mutex_unlock();
return hr; diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 1761829..43ae2eb 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -2607,24 +2607,28 @@ struct wined3d_sampler * CDECL wined3d_device_get_ps_sampler(const struct wined3 }
HRESULT CDECL wined3d_device_set_ps_consts_b(struct wined3d_device *device, - UINT start_register, const BOOL *constants, UINT bool_count) + unsigned int start_idx, unsigned int count, const BOOL *constants) { - UINT count = min(bool_count, WINED3D_MAX_CONSTS_B - start_register); - UINT i; + unsigned int i;
- TRACE("device %p, start_register %u, constants %p, bool_count %u.\n", - device, start_register, constants, bool_count); + TRACE("device %p, start_idx %u, count %u, constants %p.\n", + device, start_idx, count, constants);
- if (!constants || start_register >= WINED3D_MAX_CONSTS_B) + if (!constants || start_idx >= WINED3D_MAX_CONSTS_B) return WINED3DERR_INVALIDCALL;
- memcpy(&device->update_state->ps_consts_b[start_register], constants, count * sizeof(BOOL)); - for (i = 0; i < count; ++i) - TRACE("Set BOOL constant %u to %s.\n", start_register + i, constants[i] ? "true" : "false"); + if (count > WINED3D_MAX_CONSTS_B - start_idx) + count = WINED3D_MAX_CONSTS_B - start_idx; + memcpy(&device->update_state->ps_consts_b[start_idx], constants, count * sizeof(*constants)); + if (TRACE_ON(d3d)) + { + for (i = 0; i < count; ++i) + TRACE("Set BOOL constant %u to %#x.\n", start_idx + i, constants[i]); + }
if (device->recording) { - for (i = start_register; i < count + start_register; ++i) + for (i = start_idx; i < count + start_idx; ++i) device->recording->changed.pixelShaderConstantsB |= (1u << i); } else diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index d5a7c61..cb5a141 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -933,7 +933,7 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock) for (i = 0; i < stateblock->num_contained_ps_consts_b; ++i) { wined3d_device_set_ps_consts_b(device, stateblock->contained_ps_consts_b[i], - stateblock->state.ps_consts_b + stateblock->contained_ps_consts_b[i], 1); + 1, &stateblock->state.ps_consts_b[stateblock->contained_ps_consts_b[i]]); }
/* Render states. */ diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index e7f7ca2..3d6a641 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -129,7 +129,7 @@ @ cdecl wined3d_device_set_predication(ptr ptr long) @ cdecl wined3d_device_set_primitive_type(ptr long) @ cdecl wined3d_device_set_ps_cb(ptr long ptr) -@ cdecl wined3d_device_set_ps_consts_b(ptr long ptr long) +@ cdecl wined3d_device_set_ps_consts_b(ptr long long ptr) @ cdecl wined3d_device_set_ps_consts_f(ptr long long ptr) @ cdecl wined3d_device_set_ps_consts_i(ptr long long ptr) @ cdecl wined3d_device_set_ps_resource_view(ptr long ptr) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 9eb0f46..63550a1 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2215,7 +2215,7 @@ void __cdecl wined3d_device_set_primitive_type(struct wined3d_device *device, enum wined3d_primitive_type primitive_topology); void __cdecl wined3d_device_set_ps_cb(struct wined3d_device *device, UINT idx, struct wined3d_buffer *buffer); HRESULT __cdecl wined3d_device_set_ps_consts_b(struct wined3d_device *device, - UINT start_register, const BOOL *constants, UINT bool_count); + unsigned int start_idx, unsigned int count, const BOOL *constants); HRESULT __cdecl wined3d_device_set_ps_consts_f(struct wined3d_device *device, unsigned int start_idx, unsigned int count, const struct wined3d_vec4 *constants); HRESULT __cdecl wined3d_device_set_ps_consts_i(struct wined3d_device *device,