Commit 96b0b917 authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

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

parent a1784d9e
...@@ -1792,6 +1792,12 @@ static HRESULT d3dx9_base_effect_set_vector(struct d3dx9_base_effect *base, ...@@ -1792,6 +1792,12 @@ static HRESULT d3dx9_base_effect_set_vector(struct d3dx9_base_effect *base,
*(INT *)param->data = tmp; *(INT *)param->data = tmp;
return D3D_OK; return D3D_OK;
} }
if (param->type == D3DXPT_FLOAT)
{
memcpy(param->data, vector, param->columns * sizeof(float));
return D3D_OK;
}
set_vector(param, vector); set_vector(param, vector);
return D3D_OK; return D3D_OK;
...@@ -1866,6 +1872,17 @@ static HRESULT d3dx9_base_effect_set_vector_array(struct d3dx9_base_effect *base ...@@ -1866,6 +1872,17 @@ static HRESULT d3dx9_base_effect_set_vector_array(struct d3dx9_base_effect *base
switch (param->class) switch (param->class)
{ {
case D3DXPC_VECTOR: 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) for (i = 0; i < count; ++i)
{ {
set_vector(&param->members[i], &vector[i]); set_vector(&param->members[i], &vector[i]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment