Commit 0a8951d9 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Make wined3d_device_set_ps_consts_b() consistent with wined3d_device_set_ps_consts_f().

parent 9c8c3911
......@@ -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;
......
......@@ -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
......
......@@ -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. */
......
......@@ -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)
......
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment