[PATCH 5/5] d3dx9: Copy the entire matrix at once if there is no need of type conversions.

Matteo Bruni mbruni at codeweavers.com
Mon Mar 17 14:22:56 CDT 2014


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

diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c
index f505736..f136fb7 100644
--- a/dlls/d3dx9_36/effect.c
+++ b/dlls/d3dx9_36/effect.c
@@ -768,6 +768,16 @@ static void set_matrix(struct d3dx_parameter *param, const D3DXMATRIX *matrix)
 {
     UINT i, k;
 
+    if (param->type == D3DXPT_FLOAT)
+    {
+        if (param->columns == 4)
+            memcpy(param->data, matrix->u.m, param->rows * 4 * sizeof(float));
+        else
+            for (i = 0; i < param->rows; ++i)
+                memcpy((float *)param->data + i * param->columns, matrix->u.m + i, param->columns * sizeof(float));
+        return;
+    }
+
     for (i = 0; i < param->rows; ++i)
     {
         for (k = 0; k < param->columns; ++k)
-- 
1.8.3.2




More information about the wine-patches mailing list