https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e8b87e379902b934ace48c66fed37d9492bd770f

commit e8b87e379902b934ace48c66fed37d9492bd770f
Author:     winesync <[email protected]>
AuthorDate: Mon Sep 21 22:40:28 2020 +0200
Commit:     Jérôme Gardou <[email protected]>
CommitDate: Thu Feb 4 16:37:02 2021 +0100

    [WINESYNC] d3dx9: Merge the d3dx_effect_SetTexture() helper.
    
    Signed-off-by: Michael Stefaniuc <[email protected]>
    Signed-off-by: Matteo Bruni <[email protected]>
    Signed-off-by: Alexandre Julliard <[email protected]>
    
    wine commit id 918c13f48cab2fe9391148ae4281015c0e169378 by Michael 
Stefaniuc <[email protected]>
---
 dll/directx/wine/d3dx9_36/effect.c | 59 +++++++++++++++++---------------------
 sdk/tools/winesync/d3dx9.cfg       |  2 +-
 2 files changed, 28 insertions(+), 33 deletions(-)

diff --git a/dll/directx/wine/d3dx9_36/effect.c 
b/dll/directx/wine/d3dx9_36/effect.c
index ed7fedffb0c..659ee6d897d 100644
--- a/dll/directx/wine/d3dx9_36/effect.c
+++ b/dll/directx/wine/d3dx9_36/effect.c
@@ -1503,35 +1503,6 @@ static HRESULT d3dx9_base_effect_get_vector_array(struct 
d3dx9_base_effect *base
     return D3DERR_INVALIDCALL;
 }
 
-static HRESULT d3dx9_base_effect_set_texture(struct d3dx9_base_effect *base,
-        D3DXHANDLE parameter, struct IDirect3DBaseTexture9 *texture)
-{
-    struct d3dx_parameter *param = get_valid_parameter(base, parameter);
-
-    if (param && !param->element_count &&
-            (param->type == D3DXPT_TEXTURE || param->type == D3DXPT_TEXTURE1D
-            || param->type == D3DXPT_TEXTURE2D || param->type ==  
D3DXPT_TEXTURE3D
-            || param->type == D3DXPT_TEXTURECUBE))
-    {
-        struct IDirect3DBaseTexture9 *oltexture = *(struct 
IDirect3DBaseTexture9 **)param->data;
-
-        if (texture == oltexture)
-            return D3D_OK;
-
-        if (texture) IDirect3DBaseTexture9_AddRef(texture);
-        if (oltexture) IDirect3DBaseTexture9_Release(oltexture);
-
-        *(struct IDirect3DBaseTexture9 **)param->data = texture;
-        set_dirty(param);
-
-        return D3D_OK;
-    }
-
-    WARN("Parameter not found.\n");
-
-    return D3DERR_INVALIDCALL;
-}
-
 static HRESULT d3dx9_base_effect_get_vertex_shader(struct d3dx9_base_effect 
*base,
         D3DXHANDLE parameter, struct IDirect3DVertexShader9 **shader)
 {
@@ -3536,14 +3507,38 @@ static HRESULT WINAPI d3dx_effect_GetString(ID3DXEffect 
*iface, D3DXHANDLE param
     return D3DERR_INVALIDCALL;
 }
 
-static HRESULT WINAPI d3dx_effect_SetTexture(struct ID3DXEffect *iface, 
D3DXHANDLE parameter,
-        struct IDirect3DBaseTexture9 *texture)
+static HRESULT WINAPI d3dx_effect_SetTexture(ID3DXEffect *iface, D3DXHANDLE 
parameter,
+        IDirect3DBaseTexture9 *texture)
 {
     struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
+    struct d3dx_parameter *param = get_valid_parameter(&effect->base_effect, 
parameter);
 
     TRACE("iface %p, parameter %p, texture %p.\n", iface, parameter, texture);
 
-    return d3dx9_base_effect_set_texture(&effect->base_effect, parameter, 
texture);
+    if (param && !param->element_count
+            && (param->type == D3DXPT_TEXTURE || param->type == 
D3DXPT_TEXTURE1D
+            || param->type == D3DXPT_TEXTURE2D || param->type ==  
D3DXPT_TEXTURE3D
+            || param->type == D3DXPT_TEXTURECUBE))
+    {
+        IDirect3DBaseTexture9 *old_texture = *(IDirect3DBaseTexture9 
**)param->data;
+
+        if (texture == old_texture)
+            return D3D_OK;
+
+        if (texture)
+            IDirect3DBaseTexture9_AddRef(texture);
+        if (old_texture)
+            IDirect3DBaseTexture9_Release(old_texture);
+
+        *(IDirect3DBaseTexture9 **)param->data = texture;
+        set_dirty(param);
+
+        return D3D_OK;
+    }
+
+    WARN("Parameter not found.\n");
+
+    return D3DERR_INVALIDCALL;
 }
 
 static HRESULT WINAPI d3dx_effect_GetTexture(ID3DXEffect *iface, D3DXHANDLE 
parameter,
diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg
index 8127b808afc..44914e67fbf 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: f06d6ab0858db398576e36bf295be581952d6209}
+tags: {wine: 918c13f48cab2fe9391148ae4281015c0e169378}

Reply via email to