Matteo Bruni : d3dx9: Copy the entire vector at once if there is no need of type conversions.

Alexandre Julliard julliard at winehq.org
Thu Apr 17 13:43:25 CDT 2014


Module: wine
Branch: master
Commit: 96b0b917524ff90c21669be498f3abd0a61f87a2
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=96b0b917524ff90c21669be498f3abd0a61f87a2

Author: Matteo Bruni <mbruni at codeweavers.com>
Date:   Wed Apr 16 18:14:49 2014 +0200

d3dx9: Copy the entire vector at once if there is no need of type conversions.

---

 dlls/d3dx9_36/effect.c |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c
index f136fb7..a2a8e9f 100644
--- a/dlls/d3dx9_36/effect.c
+++ b/dlls/d3dx9_36/effect.c
@@ -1792,6 +1792,12 @@ static HRESULT d3dx9_base_effect_set_vector(struct d3dx9_base_effect *base,
                     *(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;
 
@@ -1866,6 +1872,17 @@ static HRESULT d3dx9_base_effect_set_vector_array(struct d3dx9_base_effect *base
         switch (param->class)
         {
             case D3DXPC_VECTOR:
+                if (param->type == D3DXPT_FLOAT)
+                {
+                    if (param->columns == 4)
+                        memcpy(param->data, vector, count * 4 * sizeof(float));
+                    else
+                        for (i = 0; i < count; ++i)
+                            memcpy((float *)param->data + param->columns * i, vector + i,
+                                    param->columns * sizeof(float));
+                    return D3D_OK;
+                }
+
                 for (i = 0; i < count; ++i)
                 {
                     set_vector(&param->members[i], &vector[i]);




More information about the wine-cvs mailing list