d3dx9: Use parameter data for the first constant only in d3dx_set_shader_const_state().
Signed-off-by: Paul Gofman <gofmanp@gmail.com> Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
b3e91c3408
commit
f72204abd6
|
@ -2934,11 +2934,15 @@ static HRESULT d3dx_set_shader_const_state(struct ID3DXEffectImpl *effect, enum
|
|||
return D3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
if (param->bytes % const_tbl[op].elem_size)
|
||||
if (param->bytes % const_tbl[op].elem_size || element_count > 1)
|
||||
{
|
||||
unsigned int param_data_size;
|
||||
|
||||
TRACE("Parameter size %u, rows %u, cols %u.\n", param->bytes, param->rows, param->columns);
|
||||
|
||||
if (++element_count > 1)
|
||||
if (param->bytes % const_tbl[op].elem_size)
|
||||
++element_count;
|
||||
if (element_count > 1)
|
||||
{
|
||||
WARN("Setting %u elements.\n", element_count);
|
||||
buffer = HeapAlloc(GetProcessHeap(), 0, const_tbl[op].elem_size * element_count);
|
||||
|
@ -2954,9 +2958,10 @@ static HRESULT d3dx_set_shader_const_state(struct ID3DXEffectImpl *effect, enum
|
|||
assert(const_tbl[op].elem_size <= sizeof(value));
|
||||
buffer = &value;
|
||||
}
|
||||
memcpy(buffer, value_ptr, param->bytes);
|
||||
memset((unsigned char *)buffer + param->bytes, 0,
|
||||
const_tbl[op].elem_size * element_count - param->bytes);
|
||||
param_data_size = min(param->bytes, const_tbl[op].elem_size);
|
||||
memcpy(buffer, value_ptr, param_data_size);
|
||||
memset((unsigned char *)buffer + param_data_size, 0,
|
||||
const_tbl[op].elem_size * element_count - param_data_size);
|
||||
}
|
||||
|
||||
switch (op)
|
||||
|
|
|
@ -3178,12 +3178,12 @@ static void test_effect_states(IDirect3DDevice9 *device)
|
|||
fvect.x, fvect.y, fvect.z, fvect.w);
|
||||
hr = IDirect3DDevice9_GetVertexShaderConstantF(device, 5, &fvect.x, 1);
|
||||
ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
|
||||
todo_wine ok(fvect.x == 0.0f && fvect.y == 0.0f && fvect.z == 0.0f && fvect.w == 0.0f,
|
||||
ok(fvect.x == 0.0f && fvect.y == 0.0f && fvect.z == 0.0f && fvect.w == 0.0f,
|
||||
"Got unexpected vertex shader constant (%.8e, %.8e, %.8e, %.8e).\n",
|
||||
fvect.x, fvect.y, fvect.z, fvect.w);
|
||||
hr = IDirect3DDevice9_GetVertexShaderConstantF(device, 6, &fvect.x, 1);
|
||||
ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
|
||||
todo_wine ok(fvect.x == 0.0f && fvect.y == 0.0f && fvect.z == 0.0f && fvect.w == 0.0f,
|
||||
ok(fvect.x == 0.0f && fvect.y == 0.0f && fvect.z == 0.0f && fvect.w == 0.0f,
|
||||
"Got unexpected vertex shader constant (%.8e, %.8e, %.8e, %.8e).\n",
|
||||
fvect.x, fvect.y, fvect.z, fvect.w);
|
||||
hr = IDirect3DDevice9_GetVertexShaderConstantF(device, 7, &fvect.x, 1);
|
||||
|
|
Loading…
Reference in New Issue