diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index b0ef7240620..0c099e083c5 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -2852,7 +2852,8 @@ static HRESULT WINAPI d3d9_device_SetVertexShaderConstantI(IDirect3DDevice9Ex *i TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count); wined3d_mutex_lock(); - hr = wined3d_device_set_vs_consts_i(device->wined3d_device, reg_idx, data, count); + hr = wined3d_device_set_vs_consts_i(device->wined3d_device, + reg_idx, count, (const struct wined3d_ivec4 *)data); wined3d_mutex_unlock(); return hr; diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index a61e1f56ba8..59a5c8cc3c4 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -2419,26 +2419,28 @@ HRESULT CDECL wined3d_device_get_vs_consts_b(const struct wined3d_device *device } HRESULT CDECL wined3d_device_set_vs_consts_i(struct wined3d_device *device, - UINT start_register, const int *constants, UINT vector4i_count) + unsigned int start_idx, unsigned int count, const struct wined3d_ivec4 *constants) { - UINT count = min(vector4i_count, WINED3D_MAX_CONSTS_I - start_register); - UINT i; + unsigned int i; - TRACE("device %p, start_register %u, constants %p, vector4i_count %u.\n", - device, start_register, constants, vector4i_count); + TRACE("device %p, start_idx %u, count %u, constants %p.\n", + device, start_idx, count, constants); - if (!constants || start_register >= WINED3D_MAX_CONSTS_I) + if (!constants || start_idx >= WINED3D_MAX_CONSTS_I) return WINED3DERR_INVALIDCALL; - memcpy(&device->update_state->vs_consts_i[start_register], constants, count * sizeof(int) * 4); - for (i = 0; i < count; ++i) - TRACE("Set INT constant %u to {%d, %d, %d, %d}.\n", start_register + i, - constants[i * 4], constants[i * 4 + 1], - constants[i * 4 + 2], constants[i * 4 + 3]); + if (count > WINED3D_MAX_CONSTS_I - start_idx) + count = WINED3D_MAX_CONSTS_I - start_idx; + memcpy(&device->update_state->vs_consts_i[start_idx], constants, count * sizeof(*constants)); + if (TRACE_ON(d3d)) + { + for (i = 0; i < count; ++i) + TRACE("Set ivec4 constant %u to %s.\n", start_idx + i, debug_ivec4(&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.vertexShaderConstantsI |= (1u << i); } else diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 090faed0bb5..b6480341356 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -906,7 +906,7 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock) for (i = 0; i < stateblock->num_contained_vs_consts_i; ++i) { wined3d_device_set_vs_consts_i(device, stateblock->contained_vs_consts_i[i], - &stateblock->state.vs_consts_i[stateblock->contained_vs_consts_i[i]].x, 1); + 1, &stateblock->state.vs_consts_i[stateblock->contained_vs_consts_i[i]]); } for (i = 0; i < stateblock->num_contained_vs_consts_b; ++i) { diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index 4eb24702e90..3831a650516 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -151,7 +151,7 @@ @ cdecl wined3d_device_set_vs_cb(ptr long ptr) @ cdecl wined3d_device_set_vs_consts_b(ptr long ptr long) @ cdecl wined3d_device_set_vs_consts_f(ptr long long ptr) -@ cdecl wined3d_device_set_vs_consts_i(ptr long ptr long) +@ cdecl wined3d_device_set_vs_consts_i(ptr long long ptr) @ cdecl wined3d_device_set_vs_resource_view(ptr long ptr) @ cdecl wined3d_device_set_vs_sampler(ptr long ptr) @ cdecl wined3d_device_setup_fullscreen_window(ptr ptr long long) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index af5cd3805d5..31aba7a76a2 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2251,7 +2251,7 @@ HRESULT __cdecl wined3d_device_set_vs_consts_b(struct wined3d_device *device, HRESULT __cdecl wined3d_device_set_vs_consts_f(struct wined3d_device *device, unsigned int start_idx, unsigned int count, const struct wined3d_vec4 *constants); HRESULT __cdecl wined3d_device_set_vs_consts_i(struct wined3d_device *device, - UINT start_register, const int *constants, UINT vector4i_count); + unsigned int start_idx, unsigned int count, const struct wined3d_ivec4 *constants); void __cdecl wined3d_device_set_vs_resource_view(struct wined3d_device *device, UINT idx, struct wined3d_shader_resource_view *view); void __cdecl wined3d_device_set_vs_sampler(struct wined3d_device *device, UINT idx, struct wined3d_sampler *sampler);