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

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

    [WINESYNC] d3dx9: Merge the d3dx_effect_GetInt() 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 5015e2a7cf5fa3779fd651817058e03c94807088 by Michael 
Stefaniuc <[email protected]>
---
 dll/directx/wine/d3dx9_36/effect.c | 69 +++++++++++++++++---------------------
 sdk/tools/winesync/d3dx9.cfg       |  2 +-
 2 files changed, 31 insertions(+), 40 deletions(-)

diff --git a/dll/directx/wine/d3dx9_36/effect.c 
b/dll/directx/wine/d3dx9_36/effect.c
index 9e059dae34b..3f95dcc00be 100644
--- a/dll/directx/wine/d3dx9_36/effect.c
+++ b/dll/directx/wine/d3dx9_36/effect.c
@@ -1392,44 +1392,6 @@ static HRESULT d3dx9_base_effect_set_int(struct 
d3dx9_base_effect *base, D3DXHAN
     return D3DERR_INVALIDCALL;
 }
 
-static HRESULT d3dx9_base_effect_get_int(struct d3dx9_base_effect *base, 
D3DXHANDLE parameter, INT *n)
-{
-    struct d3dx_parameter *param = get_valid_parameter(base, parameter);
-
-    if (n && param && !param->element_count)
-    {
-        if (param->columns == 1 && param->rows == 1)
-        {
-            set_number(n, D3DXPT_INT, param->data, param->type);
-            TRACE("Returning %i\n", *n);
-            return D3D_OK;
-        }
-
-        if (param->type == D3DXPT_FLOAT &&
-                ((param->class == D3DXPC_VECTOR && param->columns != 2)
-                || (param->class == D3DXPC_MATRIX_ROWS && param->rows != 2 && 
param->columns == 1)))
-        {
-            TRACE("Vector fixup\n");
-
-            /* all components (3,4) are clamped (0,255) and put in the INT */
-            *n = (INT)(min(max(0.0f, *((FLOAT *)param->data + 2)), 1.0f) * 
INT_FLOAT_MULTI);
-            *n += ((INT)(min(max(0.0f, *((FLOAT *)param->data + 1)), 1.0f) * 
INT_FLOAT_MULTI)) << 8;
-            *n += ((INT)(min(max(0.0f, *((FLOAT *)param->data + 0)), 1.0f) * 
INT_FLOAT_MULTI)) << 16;
-            if (param->columns * param->rows > 3)
-            {
-                *n += ((INT)(min(max(0.0f, *((FLOAT *)param->data + 3)), 1.0f) 
* INT_FLOAT_MULTI)) << 24;
-            }
-
-            TRACE("Returning %i\n", *n);
-            return D3D_OK;
-        }
-    }
-
-    WARN("Parameter not found.\n");
-
-    return D3DERR_INVALIDCALL;
-}
-
 static HRESULT d3dx9_base_effect_set_int_array(struct d3dx9_base_effect *base,
         D3DXHANDLE parameter, const INT *n, UINT count)
 {
@@ -3426,10 +3388,39 @@ static HRESULT WINAPI d3dx_effect_SetInt(ID3DXEffect 
*iface, D3DXHANDLE paramete
 static HRESULT WINAPI d3dx_effect_GetInt(ID3DXEffect *iface, D3DXHANDLE 
parameter, INT *n)
 {
     struct d3dx_effect *effect = impl_from_ID3DXEffect(iface);
+    struct d3dx_parameter *param = get_valid_parameter(&effect->base_effect, 
parameter);
 
     TRACE("iface %p, parameter %p, n %p.\n", iface, parameter, n);
 
-    return d3dx9_base_effect_get_int(&effect->base_effect, parameter, n);
+    if (n && param && !param->element_count)
+    {
+        if (param->columns == 1 && param->rows == 1)
+        {
+            set_number(n, D3DXPT_INT, param->data, param->type);
+            TRACE("Returning %d.\n", *n);
+            return D3D_OK;
+        }
+
+        if (param->type == D3DXPT_FLOAT &&
+                ((param->class == D3DXPC_VECTOR && param->columns != 2)
+                || (param->class == D3DXPC_MATRIX_ROWS && param->rows != 2 && 
param->columns == 1)))
+        {
+            TRACE("Vector fixup.\n");
+
+            *n = min(max(0.0f, *((float *)param->data + 2)), 1.0f) * 
INT_FLOAT_MULTI;
+            *n += ((int)(min(max(0.0f, *((float *)param->data + 1)), 1.0f) * 
INT_FLOAT_MULTI)) << 8;
+            *n += ((int)(min(max(0.0f, *((float *)param->data + 0)), 1.0f) * 
INT_FLOAT_MULTI)) << 16;
+            if (param->columns * param->rows > 3)
+                *n += ((int)(min(max(0.0f, *((float *)param->data + 3)), 1.0f) 
* INT_FLOAT_MULTI)) << 24;
+
+            TRACE("Returning %d.\n", *n);
+            return D3D_OK;
+        }
+    }
+
+    WARN("Parameter not found.\n");
+
+    return D3DERR_INVALIDCALL;
 }
 
 static HRESULT WINAPI d3dx_effect_SetIntArray(ID3DXEffect *iface, D3DXHANDLE 
parameter, const INT *n, UINT count)
diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg
index b764b546473..d5bc7239345 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: 86dff681fc6c36a77b84ec7ded4dfc3f889e2882}
+tags: {wine: 5015e2a7cf5fa3779fd651817058e03c94807088}

Reply via email to