From 5cfca92c5329bb795f5b619a7687a9602ab3f45f Mon Sep 17 00:00:00 2001 From: Matteo Bruni Date: Mon, 17 Mar 2014 20:22:56 +0100 Subject: [PATCH] d3dx9: Copy the entire matrix at once if there is no need of type conversions. --- 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 f5057368ac5..f136fb7484e 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)