From d701a76ca1d184a620d4d42e39693e68a3fc4ecc Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Tue, 17 May 2016 19:42:00 +0200 Subject: [PATCH] wined3d: Make wined3d_device_get_ps_consts_b() consistent with wined3d_device_get_ps_consts_f(). Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/d3d9/device.c | 2 +- dlls/wined3d/device.c | 14 +++++++------- dlls/wined3d/wined3d.spec | 2 +- include/wine/wined3d.h | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 9fc49ea3786..dd7f46ada2b 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -3189,7 +3189,7 @@ static HRESULT WINAPI d3d9_device_GetPixelShaderConstantB(IDirect3DDevice9Ex *if TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count); wined3d_mutex_lock(); - hr = wined3d_device_get_ps_consts_b(device->wined3d_device, reg_idx, data, count); + hr = wined3d_device_get_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 43ae2eb9e28..da83b56f140 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -2640,17 +2640,17 @@ HRESULT CDECL wined3d_device_set_ps_consts_b(struct wined3d_device *device, } HRESULT CDECL wined3d_device_get_ps_consts_b(const struct wined3d_device *device, - UINT start_register, BOOL *constants, UINT bool_count) + unsigned int start_idx, unsigned int count, BOOL *constants) { - UINT count = min(bool_count, WINED3D_MAX_CONSTS_B - start_register); + TRACE("device %p, start_idx %u, count %u,constants %p.\n", + device, start_idx, count, constants); - TRACE("device %p, start_register %u, constants %p, bool_count %u.\n", - device, start_register, constants, bool_count); - - if (!constants || start_register >= WINED3D_MAX_CONSTS_B) + if (!constants || start_idx >= WINED3D_MAX_CONSTS_B) return WINED3DERR_INVALIDCALL; - memcpy(constants, &device->state.ps_consts_b[start_register], count * sizeof(BOOL)); + if (count > WINED3D_MAX_CONSTS_B - start_idx) + count = WINED3D_MAX_CONSTS_B - start_idx; + memcpy(constants, &device->state.ps_consts_b[start_idx], count * sizeof(*constants)); return WINED3D_OK; } diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index 3d6a641514b..01699dfc4b6 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -70,7 +70,7 @@ @ cdecl wined3d_device_get_predication(ptr ptr) @ cdecl wined3d_device_get_primitive_type(ptr ptr) @ cdecl wined3d_device_get_ps_cb(ptr long) -@ cdecl wined3d_device_get_ps_consts_b(ptr long ptr long) +@ cdecl wined3d_device_get_ps_consts_b(ptr long long ptr) @ cdecl wined3d_device_get_ps_consts_f(ptr long long ptr) @ cdecl wined3d_device_get_ps_consts_i(ptr long long ptr) @ cdecl wined3d_device_get_ps_resource_view(ptr long) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 63550a1c807..a770d7fe95e 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2123,7 +2123,7 @@ void __cdecl wined3d_device_get_primitive_type(const struct wined3d_device *devi enum wined3d_primitive_type *primitive_topology); struct wined3d_buffer * __cdecl wined3d_device_get_ps_cb(const struct wined3d_device *device, UINT idx); HRESULT __cdecl wined3d_device_get_ps_consts_b(const struct wined3d_device *device, - UINT start_register, BOOL *constants, UINT bool_count); + unsigned int start_idx, unsigned int count, BOOL *constants); HRESULT __cdecl wined3d_device_get_ps_consts_f(const struct wined3d_device *device, unsigned int start_idx, unsigned int count, struct wined3d_vec4 *constants); HRESULT __cdecl wined3d_device_get_ps_consts_i(const struct wined3d_device *device,