https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4e1377665e281e625de01…
commit 4e1377665e281e625de017d8fc3a72ff24f72f69
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Sat Feb 1 18:00:27 2020 +0100
Commit: Jérôme Gardou <zefklop(a)users.noreply.github.com>
CommitDate: Wed Feb 26 18:19:18 2020 +0100
[WINESYNC] d3dx9: Use parameter data for the first constant only in
d3dx_set_shader_const_state().
Signed-off-by: Paul Gofman <gofmanp(a)gmail.com>
Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id f72204abd6037e59ba1bf500a3a9d0316e65a024 by Paul Gofman
<gofmanp(a)gmail.com>
---
dll/directx/wine/d3dx9_36/effect.c | 15 ++++++++++-----
modules/rostests/winetests/d3dx9_36/effect.c | 4 ++--
sdk/tools/winesync/d3dx9.cfg | 2 +-
3 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/dll/directx/wine/d3dx9_36/effect.c b/dll/directx/wine/d3dx9_36/effect.c
index 497c9c99f07..e8ae7b54c22 100644
--- a/dll/directx/wine/d3dx9_36/effect.c
+++ b/dll/directx/wine/d3dx9_36/effect.c
@@ -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)
diff --git a/modules/rostests/winetests/d3dx9_36/effect.c
b/modules/rostests/winetests/d3dx9_36/effect.c
index 7cfa8350be3..aedbdd10efe 100644
--- a/modules/rostests/winetests/d3dx9_36/effect.c
+++ b/modules/rostests/winetests/d3dx9_36/effect.c
@@ -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);
diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg
index d190e6568a0..f57b44aa447 100644
--- a/sdk/tools/winesync/d3dx9.cfg
+++ b/sdk/tools/winesync/d3dx9.cfg
@@ -33,4 +33,4 @@ files:
include/d3dx9shape.h: sdk/include/dxsdk/d3dx9shape.h
include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h
tags:
- wine: b3e91c3408797da72fdd5066e983d8861d9271ea
+ wine: f72204abd6037e59ba1bf500a3a9d0316e65a024