From: David Adam Subject: ddraw [v3]: Move ComputeSphereVisibility tests to ddraw7 Message-Id: Date: Sun, 17 Apr 2016 21:02:07 -1000 Thos one with my valid email address. Best regards.
Thos one with my valid email address.

Best regards.
From 4b5fb7c3a8be9b4936d21d56481f5f884fb2c9bc Mon Sep 17 00:00:00 2001 From: David Adam Date: Sun, 17 Apr 2016 07:18:16 -1000 Subject: [PATCH] Move ComputeSphereVisibility tests to ddraw7 Signed-off-by: David Adam --- dlls/ddraw/tests/d3d.c | 189 ---------------------------------------------- dlls/ddraw/tests/ddraw7.c | 173 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 173 insertions(+), 189 deletions(-) diff --git a/dlls/ddraw/tests/d3d.c b/dlls/ddraw/tests/d3d.c index d877020..5c9f35d 100644 --- a/dlls/ddraw/tests/d3d.c +++ b/dlls/ddraw/tests/d3d.c @@ -2801,194 +2801,6 @@ static void SetMaterialTest(void) ok(rc == DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, got %x\n", rc); } -static void ComputeSphereVisibility(void) -{ - D3DMATRIX proj = - { - 1.810660f, 0.000000f, 0.000000f, 0.000000f, - 0.000000f, 2.414213f, 0.000000f, 0.000000f, - 0.000000f, 0.000000f, 1.020408f, 1.000000f, - 0.000000f, 0.000000f, -0.102041f, 0.000000f, - }; - D3DMATRIX view = - { - 1.000000f, 0.000000f, 0.000000f, 0.000000f, - 0.000000f, 0.768221f, -0.640185f, 0.000000f, - -0.000000f, 0.640185f, 0.768221f, 0.000000f, - -14.852037f, 9.857489f, 11.600972f, 1.000000f, - }; - D3DMATRIX world = - { - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f, - }; - D3DVALUE radius[3]; - D3DVECTOR center[3]; - DWORD result[3]; - HRESULT rc; - - IDirect3DDevice7_SetTransform(lpD3DDevice, D3DTRANSFORMSTATE_WORLD, &world); - IDirect3DDevice7_SetTransform(lpD3DDevice, D3DTRANSFORMSTATE_VIEW , &view); - IDirect3DDevice7_SetTransform(lpD3DDevice, D3DTRANSFORMSTATE_PROJECTION, &proj); - - U1(center[0]).x=11.461533; - U2(center[0]).y=-4.761727; - U3(center[0]).z=-1.171646; - - radius[0]=38.252632; - - rc = IDirect3DDevice7_ComputeSphereVisibility(lpD3DDevice, center, radius, 1, 0, result); - - ok(rc == D3D_OK, "Expected D3D_OK, received %x\n", rc); - ok(result[0] == 0x3f, "Expected 0x3f, got %x\n", result[0]); - - U1(center[0]).x=-3.515620; U2(center[0]).y=-1.560661; U3(center[0]).z=-12.464638; - radius[0]=4.354097; - U1(center[1]).x=14.290396; U2(center[1]).y=-2.981143; U3(center[1]).z=-24.311312; - radius[1]=12.500704; - U1(center[2]).x=1.461626; U2(center[2]).y=-6.093709; U3(center[2]).z=-13.901010; - radius[2]=17.251318; - - rc = IDirect3DDevice7_ComputeSphereVisibility(lpD3DDevice, center, radius, 3, 0, result); - - ok(rc == D3D_OK, "Expected D3D_OK, received %x\n", rc); - ok(result[0] == 0x103d, "Expected 0x103d, got %x\n", result[0]); - ok(result[1] == 0x3f, "Expected 0x3f, got %x\n", result[1]); - ok(result[2] == 0x3f, "Expected 0x3f, got %x\n", result[2]); - - view._11=1.0; view._12=0.0; view._13=0.0; view._14=0.0; - view._21=0.0; view._22=1.0; view._23=0.0; view._24=0.0; - view._31=0.0; view._32=0.0; view._33=1.0; view._34=0.0; - view._41=0.0; view._42=0.0; view._43=0.0; view._44=1.0; - - proj._11=10.0; proj._12=0.0; proj._13=0.0; proj._14=0.0; - proj._21=0.0; proj._22=10.0; proj._23=0.0, proj._24=0.0; - proj._31=0.0; proj._32=0.0; proj._33=10.0, proj._34=0.0; - proj._41=0.0; proj._42=0.0; proj._43=0.0; proj._44=1.0; - - U1(center[0]).x=0.0; - U2(center[0]).y=0.0; - U3(center[0]).z=0.05; - - radius[0]=0.04; - - IDirect3DDevice7_SetTransform(lpD3DDevice, D3DTRANSFORMSTATE_VIEW , &view); - IDirect3DDevice7_SetTransform(lpD3DDevice, D3DTRANSFORMSTATE_PROJECTION, &proj); - - rc = IDirect3DDevice7_ComputeSphereVisibility(lpD3DDevice, center, radius, 1, 0, result); - - ok(rc == D3D_OK, "Expected D3D_OK, received %x\n", rc); - ok(result[0] == 0x0, "Expected 0x0, got %x\n", result[0]); - - proj._11=1.0; proj._12=0.0; proj._13=0.0; proj._14=0.0; - proj._21=0.0; proj._22=1.0; proj._23=0.0, proj._24=0.0; - proj._31=0.0; proj._32=0.0; proj._33=1.0, proj._34=0.0; - proj._41=0.0; proj._42=0.0; proj._43=0.0; proj._44=1.0; - - IDirect3DDevice7_SetTransform(lpD3DDevice, D3DTRANSFORMSTATE_PROJECTION, &proj); - - U1(center[0]).x=0.0; - U2(center[0]).y=0.0; - U3(center[0]).z=0.5; - - radius[0]=0.5; - - rc = IDirect3DDevice7_ComputeSphereVisibility(lpD3DDevice, center, radius, 1, 0, result); - - ok(rc == D3D_OK, "Expected D3D_OK, received %x\n", rc); - ok(result[0] == 0x0, "Expected 0x0, got %x\n", result[0]); - - U1(center[0]).x=0.0; - U2(center[0]).y=0.0; - U3(center[0]).z=0.0; - - radius[0]=0.0; - - rc = IDirect3DDevice7_ComputeSphereVisibility(lpD3DDevice, center, radius, 1, 0, result); - - ok(rc == D3D_OK, "Expected D3D_OK, received %x\n", rc); - ok(result[0] == 0x0, "Expected 0x0, got %x\n", result[0]); - - U1(center[0]).x=-1.0; - U2(center[0]).y=-1.0; - U3(center[0]).z=0.50; - - radius[0]=0.25; - - rc = IDirect3DDevice7_ComputeSphereVisibility(lpD3DDevice, center, radius, 1, 0, result); - - ok(rc == D3D_OK, "Expected D3D_OK, received %x\n", rc); - ok(result[0] == 0x9, "Expected 0x9, got %x\n", result[0]); - - U1(center[0]).x=-20.0; - U2(center[0]).y=0.0; - U3(center[0]).z=0.50; - - radius[0]=3.0; - - rc = IDirect3DDevice7_ComputeSphereVisibility(lpD3DDevice, center, radius, 1, 0, result); - - ok(rc == D3D_OK, "Expected D3D_OK, received %x\n", rc); - ok(result[0] == 0x103d, "Expected 0x103d, got %x\n", result[0]); - - U1(center[0]).x=20.0; - U2(center[0]).y=0.0; - U3(center[0]).z=0.50; - - radius[0]=3.0f; - - rc = IDirect3DDevice7_ComputeSphereVisibility(lpD3DDevice, center, radius, 1, 0, result); - - ok(rc == D3D_OK, "Expected D3D_OK, received %x\n", rc); - ok(result[0] == 0x203e, "Expected 0x203e, got %x\n", result[0]); - - U1(center[0]).x=0.0; - U2(center[0]).y=-20.0; - U3(center[0]).z=0.50; - - radius[0]=3.0; - - rc = IDirect3DDevice7_ComputeSphereVisibility(lpD3DDevice, center, radius, 1, 0, result); - - ok(rc == D3D_OK, "Expected D3D_OK, received %x\n", rc); - ok(result[0] == 0x803b, "Expected 0x803b, got %x\n", result[0]); - - U1(center[0]).x=0.0; - U2(center[0]).y=20.0; - U3(center[0]).z=0.5; - - radius[0]=3.0; - - rc = IDirect3DDevice7_ComputeSphereVisibility(lpD3DDevice, center, radius, 1, 0, result); - - ok(rc == D3D_OK, "Expected D3D_OK, received %x\n", rc); - ok(result[0] == 0x4037, "Expected 0x4037, got %x\n", result[0]); - - U1(center[0]).x=0.0; - U2(center[0]).y=0.0; - U3(center[0]).z=-20; - - radius[0]=3.0; - - rc = IDirect3DDevice7_ComputeSphereVisibility(lpD3DDevice, center, radius, 1, 0, result); - - ok(rc == D3D_OK, "Expected D3D_OK, received %x\n", rc); - ok(result[0] == 0x1001f, "Expected 0x1001f, got %x\n", result[0]); - - U1(center[0]).x=0.0; - U2(center[0]).y=0.0; - U3(center[0]).z=20.0; - - radius[0]=3.0; - - rc = IDirect3DDevice7_ComputeSphereVisibility(lpD3DDevice, center, radius, 1, 0, result); - - ok(rc == D3D_OK, "Expected D3D_OK, received %x\n", rc); - ok(result[0] == 0x2002f, "Expected 0x2002f, got %x\n", result[0]); -} - static void SetRenderTargetTest(void) { HRESULT hr; @@ -3942,7 +3754,6 @@ START_TEST(d3d) D3D7EnumTest(); D3D7EnumLifetimeTest(); SetMaterialTest(); - ComputeSphereVisibility(); CapsTest(); VertexBufferDescTest(); D3D7_OldRenderStateTest(); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index f4388ca..07f9bf4 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -11576,6 +11576,178 @@ static void test_getdc(void) DestroyWindow(window); } +static test_computespherevisibility(void) +{ + D3DVALUE radius[3]; + D3DVECTOR center[3]; + DWORD result[3]; + HRESULT hr; + HWND window; + IDirect3DDevice7 *device; + D3DMATRIX proj = + { + 1.810660f, 0.0f, 0.0f, 0.0f, + 0.0f, 2.414213f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.020408f, 1.0f, + 0.0f, 0.0f, -0.102041f, 0.0f, + }; + D3DMATRIX view = + { + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.768221f, -0.640185f, 0.0f, + 0.0f, 0.640185f, 0.768221f, 0.0f, + -14.852037f, 9.857489f, 11.600972f, 1.0f, + }; + D3DMATRIX world = + { + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f, + }; + + window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, + 0, 0, 600, 480, NULL, NULL, NULL, NULL); + + if (!(device = create_device(window, DDSCL_NORMAL))) + { + skip("Failed to create a 3D device, skipping test.\n"); + DestroyWindow(window); + return; + } + + IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_WORLD, &world); + IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_VIEW , &view); + IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_PROJECTION, &proj); + + U1(center[0]).x = 11.461533f; + U2(center[0]).y = -4.761727f; + U3(center[0]).z = -1.171646f; + radius[0] = 38.252632f; + hr = IDirect3DDevice7_ComputeSphereVisibility(device, center, radius, 1, 0, result); + ok(hr == D3D_OK, "Expected D3D_OK, received %x\n", hr); + ok(result[0] == 0x3f, "Expected 0x3f, got %x\n", result[0]); + + U1(center[0]).x = -3.515620f; + U2(center[0]).y = -1.560661f; + U3(center[0]).z = -12.464638f; + radius[0] = 4.354097f; + U1(center[1]).x = 14.290396f; + U2(center[1]).y = -2.981143f; + U3(center[1]).z = -24.311312f; + radius[1] = 12.500704f; + U1(center[2]).x = 1.461626f; + U2(center[2]).y = -6.093709f; + U3(center[2]).z = -13.901010f; + radius[2]=17.251318f; + hr = IDirect3DDevice7_ComputeSphereVisibility(device, center, radius, 3, 0, result); + ok(hr == D3D_OK, "Expected D3D_OK, received %x\n", hr); + ok(result[0] == 0x103d, "Expected 0x103d, got %x\n", result[0]); + ok(result[1] == 0x3f, "Expected 0x3f, got %x\n", result[1]); + ok(result[2] == 0x3f, "Expected 0x3f, got %x\n", result[2]); + + view._11 = 1.0f; view._12 = 0.0f; view._13 = 0.0f; view._14 = 0.0f; + view._21 = 0.0f; view._22 = 1.0f; view._23 = 0.0f; view._24 = 0.0f; + view._31 = 0.0f; view._32 = 0.0f; view._33 = 1.0f; view._34 = 0.0f; + view._41 = 0.0f; view._42 = 0.0f; view._43 = 0.0f; view._44 = 1.0f; + + proj._11 = 10.0f; proj._12 = 0.0f; proj._13 = 0.0f; proj._14 = 0.0f; + proj._21 = 0.0f; proj._22 = 10.0f; proj._23 = 0.0f, proj._24 = 0.0f; + proj._31 = 0.0f; proj._32 = 0.0f; proj._33 = 10.0f, proj._34 = 0.0f; + proj._41 = 0.0f; proj._42 = 0.0f; proj._43 = 0.0f; proj._44 = 1.0f; + IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_VIEW , &view); + IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_PROJECTION, &proj); + + U1(center[0]).x = 0.0f; + U2(center[0]).y = 0.0f; + U3(center[0]).z = 0.05f; + radius[0] = 0.04f; + hr = IDirect3DDevice7_ComputeSphereVisibility(device, center, radius, 1, 0, result); + ok(hr == D3D_OK, "Expected D3D_OK, received %x\n", hr); + ok(result[0] == 0x0, "Expected 0x0, got %x\n", result[0]); + + proj._11 = 1.0f; proj._12 = 0.0f; proj._13 = 0.0f; proj._14 = 0.0f; + proj._21 = 0.0f; proj._22 = 1.0f; proj._23 = 0.0f; proj._24 = 0.0f; + proj._31 = 0.0f; proj._32 = 0.0f; proj._33 = 1.0f; proj._34 = 0.0f; + proj._41 = 0.0f; proj._42 = 0.0f; proj._43 = 0.0; proj._44 = 1.0; + IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_PROJECTION, &proj); + + U1(center[0]).x = 0.0f; + U2(center[0]).y = 0.0f; + U3(center[0]).z = 0.5f; + radius[0] = 0.5f; + hr = IDirect3DDevice7_ComputeSphereVisibility(device, center, radius, 1, 0, result); + ok(hr == D3D_OK, "Expected D3D_OK, received %x\n", hr); + ok(result[0] == 0x0, "Expected 0x0, got %x\n", result[0]); + + U1(center[0]).x = 0.0f; + U2(center[0]).y = 0.0f; + U3(center[0]).z = 0.0f; + radius[0] = 0.0f; + hr = IDirect3DDevice7_ComputeSphereVisibility(device, center, radius, 1, 0, result); + ok(hr == D3D_OK, "Expected D3D_OK, received %x\n", hr); + ok(result[0] == 0x0, "Expected 0x0, got %x\n", result[0]); + + U1(center[0]).x = -1.0f; + U2(center[0]).y = -1.0f; + U3(center[0]).z = 0.50f; + radius[0] = 0.25f; + hr = IDirect3DDevice7_ComputeSphereVisibility(device, center, radius, 1, 0, result); + ok(hr == D3D_OK, "Expected D3D_OK, received %x\n", hr); + ok(result[0] == 0x9, "Expected 0x9, got %x\n", result[0]); + + U1(center[0]).x = -20.0f; + U2(center[0]).y = 0.0f; + U3(center[0]).z = 0.50f; + radius[0] = 3.0f; + hr = IDirect3DDevice7_ComputeSphereVisibility(device, center, radius, 1, 0, result); + ok(hr == D3D_OK, "Expected D3D_OK, received %x\n", hr); + ok(result[0] == 0x103d, "Expected 0x103d, got %x\n", result[0]); + + U1(center[0]).x = 20.0f; + U2(center[0]).y = 0.0f; + U3(center[0]).z = 0.50f; + radius[0] = 3.0f; + hr = IDirect3DDevice7_ComputeSphereVisibility(device, center, radius, 1, 0, result); + ok(hr == D3D_OK, "Expected D3D_OK, received %x\n", hr); + ok(result[0] == 0x203e, "Expected 0x203e, got %x\n", result[0]); + + U1(center[0]).x = 0.0f; + U2(center[0]).y = -20.0f; + U3(center[0]).z = 0.50f; + radius[0] = 3.0f; + hr = IDirect3DDevice7_ComputeSphereVisibility(device, center, radius, 1, 0, result); + ok(hr == D3D_OK, "Expected D3D_OK, received %x\n", hr); + ok(result[0] == 0x803b, "Expected 0x803b, got %x\n", result[0]); + + U1(center[0]).x = 0.0f; + U2(center[0]).y = 20.0f; + U3(center[0]).z = 0.5f; + radius[0] = 3.0f; + hr = IDirect3DDevice7_ComputeSphereVisibility(device, center, radius, 1, 0, result); + ok(hr == D3D_OK, "Expected D3D_OK, received %x\n", hr); + ok(result[0] == 0x4037, "Expected 0x4037, got %x\n", result[0]); + + U1(center[0]).x = 0.0f; + U2(center[0]).y = 0.0f; + U3(center[0]).z = -20.0f; + radius[0] = 3.0f; + hr = IDirect3DDevice7_ComputeSphereVisibility(device, center, radius, 1, 0, result); + ok(hr == D3D_OK, "Expected D3D_OK, received %x\n", hr); + ok(result[0] == 0x1001f, "Expected 0x1001f, got %x\n", result[0]); + + U1(center[0]).x = 0.0f; + U2(center[0]).y = 0.0f; + U3(center[0]).z = 20.0f; + radius[0] = 3.0f; + hr = IDirect3DDevice7_ComputeSphereVisibility(device, center, radius, 1, 0, result); + ok(hr == D3D_OK, "Expected D3D_OK, received %x\n", hr); + ok(result[0] == 0x2002f, "Expected 0x2002f, got %x\n", result[0]); + + IDirect3DDevice7_Release(device); + DestroyWindow(window); +} + START_TEST(ddraw7) { HMODULE module = GetModuleHandleA("ddraw.dll"); @@ -11680,4 +11852,5 @@ START_TEST(ddraw7) test_blt(); test_color_clamping(); test_getdc(); + test_computespherevisibility(); } -- 2.5.0