diff --git a/dlls/d3dx9_36/d3dx9_36.spec b/dlls/d3dx9_36/d3dx9_36.spec index b35e95d2f29..6cbc1a2a7ad 100644 --- a/dlls/d3dx9_36/d3dx9_36.spec +++ b/dlls/d3dx9_36/d3dx9_36.spec @@ -272,7 +272,7 @@ @ stub D3DXSaveVolumeToFileA(ptr long ptr ptr ptr) @ stub D3DXSaveVolumeToFileInMemory(ptr long ptr ptr ptr) @ stub D3DXSaveVolumeToFileW(ptr long ptr ptr ptr) -@ stub D3DXSHAdd(ptr long ptr ptr) +@ stdcall D3DXSHAdd(ptr long ptr ptr) @ stub D3DXSHDot(long ptr ptr) @ stub D3DXSHEvalConeLight(long ptr long long long long ptr ptr ptr) @ stub D3DXSHEvalDirection(ptr long ptr) diff --git a/dlls/d3dx9_36/math.c b/dlls/d3dx9_36/math.c index 481278e1a2f..9289abc851e 100644 --- a/dlls/d3dx9_36/math.c +++ b/dlls/d3dx9_36/math.c @@ -1900,3 +1900,15 @@ FLOAT *WINAPI D3DXFloat16To32Array(FLOAT *pout, CONST D3DXFLOAT16 *pin, UINT n) return pout; } + +FLOAT* WINAPI D3DXSHAdd(FLOAT *out, UINT order, const FLOAT *a, const FLOAT *b) +{ + UINT i; + + TRACE("out %p, order %u, a %p, b %p\n", out, order, a, b); + + for (i = 0; i < order * order; i++) + out[i] = a[i] + b[i]; + + return out; +} diff --git a/dlls/d3dx9_36/tests/math.c b/dlls/d3dx9_36/tests/math.c index fcf0a99a5e5..83e2ef61d4e 100644 --- a/dlls/d3dx9_36/tests/math.c +++ b/dlls/d3dx9_36/tests/math.c @@ -27,7 +27,7 @@ #define admitted_error 0.0001f -#define relative_error(exp, out) ((exp == 0.0f) ? fabs(exp - out) : (fabs(1.0f - out/ exp) )) +#define relative_error(exp, out) ((exp == 0.0f) ? fabs(exp - out) : (fabs(1.0f - (out) / (exp)))) #define expect_color(expectedcolor,gotcolor) ok((relative_error(expectedcolor.r, gotcolor.r)