d3d9/tests: Use a separate device for pointsize_test().
This commit is contained in:
parent
22511c11aa
commit
f3a898a87d
|
@ -9616,61 +9616,71 @@ static BOOL point_match(IDirect3DDevice9 *device, UINT x, UINT y, UINT r)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pointsize_test(IDirect3DDevice9 *device)
|
static void pointsize_test(void)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
float ptsize, ptsizemax_orig, ptsizemin_orig;
|
||||||
D3DCAPS9 caps;
|
|
||||||
D3DMATRIX matrix;
|
|
||||||
D3DMATRIX identity;
|
|
||||||
float ptsize, ptsize_orig, ptsizemax_orig, ptsizemin_orig;
|
|
||||||
DWORD color;
|
|
||||||
IDirect3DSurface9 *rt, *backbuffer;
|
IDirect3DSurface9 *rt, *backbuffer;
|
||||||
IDirect3DTexture9 *tex1, *tex2;
|
IDirect3DTexture9 *tex1, *tex2;
|
||||||
RECT rect = {0, 0, 128, 128};
|
IDirect3DDevice9 *device;
|
||||||
D3DLOCKED_RECT lr;
|
D3DLOCKED_RECT lr;
|
||||||
const DWORD tex1_data[4] = {0x00ff0000, 0x00ff0000,
|
IDirect3D9 *d3d;
|
||||||
0x00000000, 0x00000000};
|
D3DCOLOR color;
|
||||||
const DWORD tex2_data[4] = {0x00000000, 0x0000ff00,
|
ULONG refcount;
|
||||||
0x00000000, 0x0000ff00};
|
D3DCAPS9 caps;
|
||||||
|
HWND window;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
const float vertices[] = {
|
static const RECT rect = {0, 0, 128, 128};
|
||||||
64, 64, 0.1,
|
static const DWORD tex1_data[4] = {0x00ff0000, 0x00ff0000, 0x00000000, 0x00000000};
|
||||||
128, 64, 0.1,
|
static const DWORD tex2_data[4] = {0x00000000, 0x0000ff00, 0x00000000, 0x0000ff00};
|
||||||
192, 64, 0.1,
|
static const float vertices[] =
|
||||||
256, 64, 0.1,
|
{
|
||||||
320, 64, 0.1,
|
64.0f, 64.0f, 0.1f,
|
||||||
384, 64, 0.1,
|
128.0f, 64.0f, 0.1f,
|
||||||
448, 64, 0.1,
|
192.0f, 64.0f, 0.1f,
|
||||||
512, 64, 0.1,
|
256.0f, 64.0f, 0.1f,
|
||||||
|
320.0f, 64.0f, 0.1f,
|
||||||
|
384.0f, 64.0f, 0.1f,
|
||||||
|
448.0f, 64.0f, 0.1f,
|
||||||
|
512.0f, 64.0f, 0.1f,
|
||||||
};
|
};
|
||||||
|
/* Transforms the coordinate system [-1.0;1.0]x[-1.0;1.0] to
|
||||||
|
* [0.0;0.0]x[640.0;480.0]. Z is untouched. */
|
||||||
|
D3DMATRIX matrix =
|
||||||
|
{{{
|
||||||
|
2.0f / 640.0f, 0.0f, 0.0f, 0.0f,
|
||||||
|
0.0f, -2.0 / 480.0f, 0.0f, 0.0f,
|
||||||
|
0.0f, 0.0f, 1.0f, 0.0f,
|
||||||
|
-1.0f, 1.0f, 0.0f, 1.0f,
|
||||||
|
}}};
|
||||||
|
|
||||||
/* Transforms the coordinate system [-1.0;1.0]x[-1.0;1.0] to [0.0;0.0]x[640.0;480.0]. Z is untouched */
|
window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||||
U(matrix).m[0][0] = 2.0/640.0; U(matrix).m[1][0] = 0.0; U(matrix).m[2][0] = 0.0; U(matrix).m[3][0] =-1.0;
|
0, 0, 640, 480, NULL, NULL, NULL, NULL);
|
||||||
U(matrix).m[0][1] = 0.0; U(matrix).m[1][1] =-2.0/480.0; U(matrix).m[2][1] = 0.0; U(matrix).m[3][1] = 1.0;
|
d3d = Direct3DCreate9(D3D_SDK_VERSION);
|
||||||
U(matrix).m[0][2] = 0.0; U(matrix).m[1][2] = 0.0; U(matrix).m[2][2] = 1.0; U(matrix).m[3][2] = 0.0;
|
ok(!!d3d, "Failed to create a D3D object.\n");
|
||||||
U(matrix).m[0][3] = 0.0; U(matrix).m[1][3] = 0.0; U(matrix).m[2][3] = 0.0; U(matrix).m[3][3] = 1.0;
|
if (!(device = create_device(d3d, window, window, TRUE)))
|
||||||
|
{
|
||||||
U(identity).m[0][0] = 1.0; U(identity).m[1][0] = 0.0; U(identity).m[2][0] = 0.0; U(identity).m[3][0] = 0.0;
|
skip("Failed to create a D3D device, skipping tests.\n");
|
||||||
U(identity).m[0][1] = 0.0; U(identity).m[1][1] = 1.0; U(identity).m[2][1] = 0.0; U(identity).m[3][1] = 0.0;
|
goto done;
|
||||||
U(identity).m[0][2] = 0.0; U(identity).m[1][2] = 0.0; U(identity).m[2][2] = 1.0; U(identity).m[3][2] = 0.0;
|
}
|
||||||
U(identity).m[0][3] = 0.0; U(identity).m[1][3] = 0.0; U(identity).m[2][3] = 0.0; U(identity).m[3][3] = 1.0;
|
|
||||||
|
|
||||||
memset(&caps, 0, sizeof(caps));
|
memset(&caps, 0, sizeof(caps));
|
||||||
hr = IDirect3DDevice9_GetDeviceCaps(device, &caps);
|
hr = IDirect3DDevice9_GetDeviceCaps(device, &caps);
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice9_GetDeviceCaps failed hr=%08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DDevice9_GetDeviceCaps failed hr=%08x\n", hr);
|
||||||
if(caps.MaxPointSize < 32.0) {
|
if(caps.MaxPointSize < 32.0) {
|
||||||
skip("MaxPointSize < 32.0, skipping(MaxPointsize = %f)\n", caps.MaxPointSize);
|
skip("MaxPointSize < 32.0, skipping(MaxPointsize = %f)\n", caps.MaxPointSize);
|
||||||
return;
|
IDirect3DDevice9_Release(device);
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff0000ff, 0.0, 0);
|
hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff0000ff, 1.0f, 0);
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice9_Clear failed, hr=%08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DDevice9_Clear failed, hr=%08x\n", hr);
|
||||||
|
hr = IDirect3DDevice9_SetRenderState(device, D3DRS_LIGHTING, FALSE);
|
||||||
|
ok(SUCCEEDED(hr), "Failed to disable lighting, hr %#x.\n", hr);
|
||||||
hr = IDirect3DDevice9_SetTransform(device, D3DTS_PROJECTION, &matrix);
|
hr = IDirect3DDevice9_SetTransform(device, D3DTS_PROJECTION, &matrix);
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice9_SetTransform failed, hr=%08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DDevice9_SetTransform failed, hr=%08x\n", hr);
|
||||||
hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ);
|
hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ);
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice9_SetFVF failed hr=%08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DDevice9_SetFVF failed hr=%08x\n", hr);
|
||||||
hr = IDirect3DDevice9_GetRenderState(device, D3DRS_POINTSIZE, (DWORD *) &ptsize_orig);
|
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice9_GetRenderState failed hr=%08x\n", hr);
|
|
||||||
|
|
||||||
hr = IDirect3DDevice9_BeginScene(device);
|
hr = IDirect3DDevice9_BeginScene(device);
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice9_BeginScene failed hr=%08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DDevice9_BeginScene failed hr=%08x\n", hr);
|
||||||
|
@ -9776,7 +9786,7 @@ static void pointsize_test(IDirect3DDevice9 *device)
|
||||||
* is no point sprite cap bit in d3d because native d3d software emulates point sprites. Until the
|
* is no point sprite cap bit in d3d because native d3d software emulates point sprites. Until the
|
||||||
* SW emulation is implemented in wined3d, this test will fail on GL drivers that does not support them.
|
* SW emulation is implemented in wined3d, this test will fail on GL drivers that does not support them.
|
||||||
*/
|
*/
|
||||||
hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff0000ff, 0.0, 0);
|
hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff0000ff, 1.0f, 0);
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice9_Clear failed, hr=%08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DDevice9_Clear failed, hr=%08x\n", hr);
|
||||||
|
|
||||||
hr = IDirect3DDevice9_CreateTexture(device, 2, 2, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &tex1, NULL);
|
hr = IDirect3DDevice9_CreateTexture(device, 2, 2, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &tex1, NULL);
|
||||||
|
@ -9850,7 +9860,7 @@ static void pointsize_test(IDirect3DDevice9 *device)
|
||||||
|
|
||||||
hr = IDirect3DDevice9_SetRenderTarget(device, 0, rt);
|
hr = IDirect3DDevice9_SetRenderTarget(device, 0, rt);
|
||||||
ok(SUCCEEDED(hr), "SetRenderTarget failed, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "SetRenderTarget failed, hr %#x.\n", hr);
|
||||||
hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff00ffff, 0.0f, 0);
|
hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff00ffff, 1.0f, 0);
|
||||||
ok(SUCCEEDED(hr), "Clear failed, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Clear failed, hr %#x.\n", hr);
|
||||||
|
|
||||||
hr = IDirect3DDevice9_BeginScene(device);
|
hr = IDirect3DDevice9_BeginScene(device);
|
||||||
|
@ -9883,23 +9893,13 @@ static void pointsize_test(IDirect3DDevice9 *device)
|
||||||
hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
|
hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
|
||||||
ok(SUCCEEDED(hr), "Present failed, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Present failed, hr %#x.\n", hr);
|
||||||
|
|
||||||
hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_DISABLE);
|
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice9_SetTextureStageState failed hr=%08x\n", hr);
|
|
||||||
hr = IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_COLOROP, D3DTOP_DISABLE);
|
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice9_SetTextureStageState failed hr=%08x\n", hr);
|
|
||||||
hr = IDirect3DDevice9_SetTexture(device, 0, NULL);
|
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice9_SetTexture failed hr=%08x\n", hr);
|
|
||||||
hr = IDirect3DDevice9_SetTexture(device, 1, NULL);
|
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice9_SetTexture failed hr=%08x\n", hr);
|
|
||||||
IDirect3DTexture9_Release(tex1);
|
IDirect3DTexture9_Release(tex1);
|
||||||
IDirect3DTexture9_Release(tex2);
|
IDirect3DTexture9_Release(tex2);
|
||||||
|
refcount = IDirect3DDevice9_Release(device);
|
||||||
hr = IDirect3DDevice9_SetRenderState(device, D3DRS_POINTSPRITEENABLE, FALSE);
|
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice9_SetRenderState failed hr=%08x\n", hr);
|
done:
|
||||||
hr = IDirect3DDevice9_SetRenderState(device, D3DRS_POINTSIZE, *((DWORD *) (&ptsize_orig)));
|
IDirect3D9_Release(d3d);
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice9_SetRenderState failed hr=%08x\n", hr);
|
DestroyWindow(window);
|
||||||
hr = IDirect3DDevice9_SetTransform(device, D3DTS_PROJECTION, &identity);
|
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice9_SetTransform failed, hr=%08x\n", hr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void multiple_rendertargets_test(void)
|
static void multiple_rendertargets_test(void)
|
||||||
|
@ -16523,11 +16523,11 @@ START_TEST(visual)
|
||||||
fixed_function_decl_test(device_ptr);
|
fixed_function_decl_test(device_ptr);
|
||||||
conditional_np2_repeat_test(device_ptr);
|
conditional_np2_repeat_test(device_ptr);
|
||||||
fixed_function_bumpmap_test(device_ptr);
|
fixed_function_bumpmap_test(device_ptr);
|
||||||
pointsize_test(device_ptr);
|
|
||||||
|
|
||||||
cleanup_device(device_ptr);
|
cleanup_device(device_ptr);
|
||||||
device_ptr = NULL;
|
device_ptr = NULL;
|
||||||
|
|
||||||
|
pointsize_test();
|
||||||
tssargtemp_test();
|
tssargtemp_test();
|
||||||
np2_stretch_rect_test();
|
np2_stretch_rect_test();
|
||||||
yuv_color_test();
|
yuv_color_test();
|
||||||
|
|
Loading…
Reference in New Issue