d3dx9_36: Implementation of D3DXSHDot.
This commit is contained in:
parent
d0977a2b8b
commit
b56227cbf1
|
@ -273,7 +273,7 @@
|
||||||
@ stub D3DXSaveVolumeToFileInMemory(ptr long ptr ptr ptr)
|
@ stub D3DXSaveVolumeToFileInMemory(ptr long ptr ptr ptr)
|
||||||
@ stub D3DXSaveVolumeToFileW(ptr long ptr ptr ptr)
|
@ stub D3DXSaveVolumeToFileW(ptr long ptr ptr ptr)
|
||||||
@ stdcall D3DXSHAdd(ptr long ptr ptr)
|
@ stdcall D3DXSHAdd(ptr long ptr ptr)
|
||||||
@ stub D3DXSHDot(long ptr ptr)
|
@ stdcall D3DXSHDot(long ptr ptr)
|
||||||
@ stub D3DXSHEvalConeLight(long ptr long long long long ptr ptr ptr)
|
@ stub D3DXSHEvalConeLight(long ptr long long long long ptr ptr ptr)
|
||||||
@ stub D3DXSHEvalDirection(ptr long ptr)
|
@ stub D3DXSHEvalDirection(ptr long ptr)
|
||||||
@ stub D3DXSHEvalDirectionalLight(long ptr long long long long ptr ptr ptr)
|
@ stub D3DXSHEvalDirectionalLight(long ptr long long long long ptr ptr ptr)
|
||||||
|
|
|
@ -1981,6 +1981,20 @@ FLOAT* WINAPI D3DXSHAdd(FLOAT *out, UINT order, const FLOAT *a, const FLOAT *b)
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FLOAT WINAPI D3DXSHDot(UINT order, CONST FLOAT *a, CONST FLOAT *b)
|
||||||
|
{
|
||||||
|
FLOAT s;
|
||||||
|
UINT i;
|
||||||
|
|
||||||
|
TRACE("order %u, a %p, b %p\n", order, a, b);
|
||||||
|
|
||||||
|
s = a[0] * b[0];
|
||||||
|
for (i = 1; i < order * order; i++)
|
||||||
|
s += a[i] * b[i];
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
FLOAT* WINAPI D3DXSHMultiply3(FLOAT *out, CONST FLOAT *a, CONST FLOAT *b)
|
FLOAT* WINAPI D3DXSHMultiply3(FLOAT *out, CONST FLOAT *a, CONST FLOAT *b)
|
||||||
{
|
{
|
||||||
FLOAT t, ta, tb;
|
FLOAT t, ta, tb;
|
||||||
|
|
|
@ -2399,6 +2399,29 @@ static void test_D3DXSHAdd(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_D3DXSHDot(void)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
FLOAT a[64], b[64], got;
|
||||||
|
CONST FLOAT expected[] =
|
||||||
|
{ 0.5f, 0.5f, 25.0f, 262.5f, 1428.0f, 5362.0f, 15873.0f, 39812.0f, 88400.0f, };
|
||||||
|
|
||||||
|
for (i = 0; i < 64; i++)
|
||||||
|
{
|
||||||
|
a[i] = (FLOAT)i + 1.0f;
|
||||||
|
b[i] = (FLOAT)i + 0.5f;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* D3DXSHDot computes by using order * order elements */
|
||||||
|
for (i = 0; i < 9; i++)
|
||||||
|
{
|
||||||
|
got = D3DXSHDot(i, a, b);
|
||||||
|
ok(relative_error(got, expected[i]) < admitted_error, "order %d: expected %f, received %f\n", i, expected[i], got);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
static void test_D3DXSHMultiply3(void)
|
static void test_D3DXSHMultiply3(void)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -2438,5 +2461,6 @@ START_TEST(math)
|
||||||
test_D3DXVec_Array();
|
test_D3DXVec_Array();
|
||||||
test_D3DXFloat_Array();
|
test_D3DXFloat_Array();
|
||||||
test_D3DXSHAdd();
|
test_D3DXSHAdd();
|
||||||
|
test_D3DXSHDot();
|
||||||
test_D3DXSHMultiply3();
|
test_D3DXSHMultiply3();
|
||||||
}
|
}
|
||||||
|
|
|
@ -378,6 +378,7 @@ D3DXFLOAT16 *WINAPI D3DXFloat32To16Array(D3DXFLOAT16 *pout, CONST FLOAT *pin, UI
|
||||||
FLOAT *WINAPI D3DXFloat16To32Array(FLOAT *pout, CONST D3DXFLOAT16 *pin, UINT n);
|
FLOAT *WINAPI D3DXFloat16To32Array(FLOAT *pout, CONST D3DXFLOAT16 *pin, UINT n);
|
||||||
|
|
||||||
FLOAT* WINAPI D3DXSHAdd(FLOAT *out, UINT order, CONST FLOAT *a, CONST FLOAT *b);
|
FLOAT* WINAPI D3DXSHAdd(FLOAT *out, UINT order, CONST FLOAT *a, CONST FLOAT *b);
|
||||||
|
FLOAT WINAPI D3DXSHDot(UINT order, CONST FLOAT *a, CONST FLOAT *b);
|
||||||
FLOAT* WINAPI D3DXSHMultiply3(FLOAT *out, CONST FLOAT *a, CONST FLOAT *b);
|
FLOAT* WINAPI D3DXSHMultiply3(FLOAT *out, CONST FLOAT *a, CONST FLOAT *b);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
Loading…
Reference in New Issue