https://git.reactos.org/?p=reactos.git;a=commitdiff;h=492a1837b711b9ed03940…
commit 492a1837b711b9ed039407a8deb72e8026b0bb68
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Mon Sep 21 22:40:28 2020 +0200
Commit: Jérôme Gardou <jerome.gardou(a)reactos.org>
CommitDate: Thu Feb 4 16:37:03 2021 +0100
[WINESYNC] d3dx9: Merge the d3dx_effect_SetVector() helper.
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id 6eb69d2cf6a9049a3fedc3ec71146b3745f17e2b by Michael Stefaniuc
<mstefani(a)winehq.org>
---
dll/directx/wine/d3dx9_36/effect.c | 99 ++++++++++++++++++--------------------
sdk/tools/winesync/d3dx9.cfg | 2 +-
2 files changed, 47 insertions(+), 54 deletions(-)
diff --git a/dll/directx/wine/d3dx9_36/effect.c b/dll/directx/wine/d3dx9_36/effect.c
index b041181bbe2..bd809637d08 100644
--- a/dll/directx/wine/d3dx9_36/effect.c
+++ b/dll/directx/wine/d3dx9_36/effect.c
@@ -1181,58 +1181,6 @@ static HRESULT set_string(char **param_data, const char *string)
return D3D_OK;
}
-static HRESULT d3dx9_base_effect_set_vector(struct d3dx9_base_effect *base,
- D3DXHANDLE parameter, const D3DXVECTOR4 *vector)
-{
- struct d3dx_parameter *param = get_valid_parameter(base, parameter);
-
- if (param && !param->element_count)
- {
- TRACE("Class %s\n", debug_d3dxparameter_class(param->class));
-
- switch (param->class)
- {
- case D3DXPC_SCALAR:
- case D3DXPC_VECTOR:
- set_dirty(param);
- if (param->type == D3DXPT_INT && param->bytes == 4)
- {
- DWORD tmp;
-
- TRACE("INT fixup\n");
- tmp = (DWORD)(max(min(vector->z, 1.0f), 0.0f) * INT_FLOAT_MULTI);
- tmp += ((DWORD)(max(min(vector->y, 1.0f), 0.0f) *
INT_FLOAT_MULTI)) << 8;
- tmp += ((DWORD)(max(min(vector->x, 1.0f), 0.0f) *
INT_FLOAT_MULTI)) << 16;
- tmp += ((DWORD)(max(min(vector->w, 1.0f), 0.0f) *
INT_FLOAT_MULTI)) << 24;
-
- *(INT *)param->data = tmp;
- return D3D_OK;
- }
- if (param->type == D3DXPT_FLOAT)
- {
- memcpy(param->data, vector, param->columns * sizeof(float));
- return D3D_OK;
- }
-
- set_vector(param, vector);
- return D3D_OK;
-
- case D3DXPC_MATRIX_ROWS:
- case D3DXPC_OBJECT:
- case D3DXPC_STRUCT:
- break;
-
- default:
- FIXME("Unhandled class %s\n",
debug_d3dxparameter_class(param->class));
- break;
- }
- }
-
- WARN("Parameter not found.\n");
-
- return D3DERR_INVALIDCALL;
-}
-
static HRESULT d3dx9_base_effect_set_vector_array(struct d3dx9_base_effect *base,
D3DXHANDLE parameter, const D3DXVECTOR4 *vector, UINT count)
{
@@ -2881,10 +2829,55 @@ static HRESULT WINAPI d3dx_effect_GetFloatArray(ID3DXEffect
*iface, D3DXHANDLE p
static HRESULT WINAPI d3dx_effect_SetVector(ID3DXEffect *iface, D3DXHANDLE parameter,
const D3DXVECTOR4 *vector)
{
struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
+ struct d3dx_parameter *param = get_valid_parameter(&effect->base_effect,
parameter);
TRACE("iface %p, parameter %p, vector %p.\n", iface, parameter, vector);
- return d3dx9_base_effect_set_vector(&effect->base_effect, parameter, vector);
+ if (param && !param->element_count)
+ {
+ TRACE("Class %s.\n", debug_d3dxparameter_class(param->class));
+
+ switch (param->class)
+ {
+ case D3DXPC_SCALAR:
+ case D3DXPC_VECTOR:
+ set_dirty(param);
+ if (param->type == D3DXPT_INT && param->bytes == 4)
+ {
+ DWORD tmp;
+
+ TRACE("INT fixup.\n");
+ tmp = max(min(vector->z, 1.0f), 0.0f) * INT_FLOAT_MULTI;
+ tmp += ((DWORD)(max(min(vector->y, 1.0f), 0.0f) *
INT_FLOAT_MULTI)) << 8;
+ tmp += ((DWORD)(max(min(vector->x, 1.0f), 0.0f) *
INT_FLOAT_MULTI)) << 16;
+ tmp += ((DWORD)(max(min(vector->w, 1.0f), 0.0f) *
INT_FLOAT_MULTI)) << 24;
+
+ *(int *)param->data = tmp;
+ return D3D_OK;
+ }
+ if (param->type == D3DXPT_FLOAT)
+ {
+ memcpy(param->data, vector, param->columns * sizeof(float));
+ return D3D_OK;
+ }
+
+ set_vector(param, vector);
+ return D3D_OK;
+
+ case D3DXPC_MATRIX_ROWS:
+ case D3DXPC_OBJECT:
+ case D3DXPC_STRUCT:
+ break;
+
+ default:
+ FIXME("Unhandled class %s.\n",
debug_d3dxparameter_class(param->class));
+ break;
+ }
+ }
+
+ WARN("Parameter not found.\n");
+
+ return D3DERR_INVALIDCALL;
}
static HRESULT WINAPI d3dx_effect_GetVector(ID3DXEffect *iface, D3DXHANDLE parameter,
D3DXVECTOR4 *vector)
diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg
index 8123432039d..64fa8a9ef45 100644
--- a/sdk/tools/winesync/d3dx9.cfg
+++ b/sdk/tools/winesync/d3dx9.cfg
@@ -15,4 +15,4 @@ files: {include/d3dx9.h: sdk/include/dxsdk/d3dx9.h, include/d3dx9anim.h:
sdk/inc
include/d3dx9mesh.h: sdk/include/dxsdk/d3dx9mesh.h, include/d3dx9of.h:
sdk/include/dxsdk/d3dx9of.h,
include/d3dx9shader.h: sdk/include/dxsdk/d3dx9shader.h, include/d3dx9shape.h:
sdk/include/dxsdk/d3dx9shape.h,
include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h, include/d3dx9xof.h:
sdk/include/dxsdk/d3dx9xof.h}
-tags: {wine: 4d978ec0812cd18960337d5709853d93d98a1f2e}
+tags: {wine: 6eb69d2cf6a9049a3fedc3ec71146b3745f17e2b}