https://git.reactos.org/?p=reactos.git;a=commitdiff;h=fce46567f7727d9f16a75…
commit fce46567f7727d9f16a7567eeebb0107ff821f97
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:02 2021 +0100
[WINESYNC] d3dx9: Merge the d3dx_effect_GetValue() 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 d4e39ee1d8a263d91bc291cacfe8938f81d447fc by Michael Stefaniuc
<mstefani(a)winehq.org>
---
dll/directx/wine/d3dx9_36/effect.c | 122 +++++++++++++++++--------------------
sdk/tools/winesync/d3dx9.cfg | 2 +-
2 files changed, 58 insertions(+), 66 deletions(-)
diff --git a/dll/directx/wine/d3dx9_36/effect.c b/dll/directx/wine/d3dx9_36/effect.c
index 659ee6d897d..2bae2567624 100644
--- a/dll/directx/wine/d3dx9_36/effect.c
+++ b/dll/directx/wine/d3dx9_36/effect.c
@@ -1258,70 +1258,6 @@ static HRESULT d3dx9_base_effect_set_value(struct d3dx9_base_effect
*base,
return D3DERR_INVALIDCALL;
}
-static HRESULT d3dx9_base_effect_get_value(struct d3dx9_base_effect *base,
- D3DXHANDLE parameter, void *data, UINT bytes)
-{
- struct d3dx_parameter *param = get_valid_parameter(base, parameter);
-
- if (!param)
- {
- WARN("Invalid parameter %p specified\n", parameter);
- return D3DERR_INVALIDCALL;
- }
-
- /* samplers don't touch data */
- if (param->class == D3DXPC_OBJECT &&
is_param_type_sampler(param->type))
- {
- TRACE("Sampler: returning E_FAIL\n");
- return E_FAIL;
- }
-
- if (data && param->bytes <= bytes)
- {
- TRACE("Type %s\n", debug_d3dxparameter_type(param->type));
-
- switch (param->type)
- {
- case D3DXPT_VOID:
- case D3DXPT_BOOL:
- case D3DXPT_INT:
- case D3DXPT_FLOAT:
- case D3DXPT_STRING:
- break;
-
- case D3DXPT_VERTEXSHADER:
- case D3DXPT_PIXELSHADER:
- case D3DXPT_TEXTURE:
- case D3DXPT_TEXTURE1D:
- case D3DXPT_TEXTURE2D:
- case D3DXPT_TEXTURE3D:
- case D3DXPT_TEXTURECUBE:
- {
- UINT i;
-
- for (i = 0; i < (param->element_count ? param->element_count :
1); ++i)
- {
- IUnknown *unk = ((IUnknown **)param->data)[i];
- if (unk) IUnknown_AddRef(unk);
- }
- break;
- }
-
- default:
- FIXME("Unhandled type %s\n",
debug_d3dxparameter_type(param->type));
- break;
- }
-
- TRACE("Copy %u bytes\n", param->bytes);
- memcpy(data, param->data, param->bytes);
- return D3D_OK;
- }
-
- WARN("Parameter not found.\n");
-
- return D3DERR_INVALIDCALL;
-}
-
static HRESULT d3dx9_base_effect_set_vector(struct d3dx9_base_effect *base,
D3DXHANDLE parameter, const D3DXVECTOR4 *vector)
{
@@ -2619,10 +2555,66 @@ static HRESULT WINAPI d3dx_effect_SetValue(ID3DXEffect *iface,
D3DXHANDLE parame
static HRESULT WINAPI d3dx_effect_GetValue(ID3DXEffect *iface, D3DXHANDLE parameter, void
*data, UINT bytes)
{
struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
+ struct d3dx_parameter *param = get_valid_parameter(&effect->base_effect,
parameter);
TRACE("iface %p, parameter %p, data %p, bytes %u.\n", iface, parameter,
data, bytes);
- return d3dx9_base_effect_get_value(&effect->base_effect, parameter, data,
bytes);
+ if (!param)
+ {
+ WARN("Invalid parameter %p specified.\n", parameter);
+ return D3DERR_INVALIDCALL;
+ }
+ if (param->class == D3DXPC_OBJECT &&
is_param_type_sampler(param->type))
+ {
+ WARN("Parameter is a sampler, returning E_FAIL.\n");
+ return E_FAIL;
+ }
+
+ if (data && param->bytes <= bytes)
+ {
+ TRACE("Type %s.\n", debug_d3dxparameter_type(param->type));
+
+ switch (param->type)
+ {
+ case D3DXPT_VOID:
+ case D3DXPT_BOOL:
+ case D3DXPT_INT:
+ case D3DXPT_FLOAT:
+ case D3DXPT_STRING:
+ break;
+
+ case D3DXPT_VERTEXSHADER:
+ case D3DXPT_PIXELSHADER:
+ case D3DXPT_TEXTURE:
+ case D3DXPT_TEXTURE1D:
+ case D3DXPT_TEXTURE2D:
+ case D3DXPT_TEXTURE3D:
+ case D3DXPT_TEXTURECUBE:
+ {
+ unsigned int i;
+
+ for (i = 0; i < (param->element_count ? param->element_count :
1); ++i)
+ {
+ IUnknown *unk = ((IUnknown **)param->data)[i];
+ if (unk)
+ IUnknown_AddRef(unk);
+ }
+ break;
+ }
+
+ default:
+ FIXME("Unhandled type %s.\n",
debug_d3dxparameter_type(param->type));
+ break;
+ }
+
+ TRACE("Copy %u bytes.\n", param->bytes);
+ memcpy(data, param->data, param->bytes);
+ return D3D_OK;
+ }
+
+ WARN("Parameter not found.\n");
+
+ return D3DERR_INVALIDCALL;
}
static HRESULT WINAPI d3dx_effect_SetBool(ID3DXEffect *iface, D3DXHANDLE parameter, BOOL
b)
diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg
index 44914e67fbf..a0dd3358da4 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: 918c13f48cab2fe9391148ae4281015c0e169378}
+tags: {wine: d4e39ee1d8a263d91bc291cacfe8938f81d447fc}