d3d8/tests: Use a separate device for volume_v16u16_test().
This commit is contained in:
parent
29680b685a
commit
554871ea81
|
@ -4142,17 +4142,21 @@ static void volume_dxt5_test(IDirect3DDevice8 *device)
|
||||||
IDirect3DVolumeTexture8_Release(texture);
|
IDirect3DVolumeTexture8_Release(texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void volume_v16u16_test(IDirect3DDevice8 *device)
|
static void volume_v16u16_test(void)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
|
||||||
IDirect3D8 *d3d8;
|
|
||||||
IDirect3DVolumeTexture8 *texture;
|
IDirect3DVolumeTexture8 *texture;
|
||||||
DWORD shader;
|
IDirect3DDevice8 *device;
|
||||||
D3DLOCKED_BOX box;
|
D3DLOCKED_BOX box;
|
||||||
|
IDirect3D8 *d3d;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
DWORD color;
|
D3DCOLOR color;
|
||||||
SHORT *texel;
|
ULONG refcount;
|
||||||
D3DCAPS8 caps;
|
D3DCAPS8 caps;
|
||||||
|
DWORD shader;
|
||||||
|
SHORT *texel;
|
||||||
|
HWND window;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
static const struct
|
static const struct
|
||||||
{
|
{
|
||||||
struct vec3 position;
|
struct vec3 position;
|
||||||
|
@ -4161,13 +4165,13 @@ static void volume_v16u16_test(IDirect3DDevice8 *device)
|
||||||
quads[] =
|
quads[] =
|
||||||
{
|
{
|
||||||
{{ -1.0f, -1.0f, 0.0f}, { 0.0f, 0.0f, 0.25f}},
|
{{ -1.0f, -1.0f, 0.0f}, { 0.0f, 0.0f, 0.25f}},
|
||||||
{{ 0.0f, -1.0f, 1.0f}, { 1.0f, 0.0f, 0.25f}},
|
|
||||||
{{ -1.0f, 1.0f, 0.0f}, { 0.0f, 1.0f, 0.25f}},
|
{{ -1.0f, 1.0f, 0.0f}, { 0.0f, 1.0f, 0.25f}},
|
||||||
|
{{ 0.0f, -1.0f, 1.0f}, { 1.0f, 0.0f, 0.25f}},
|
||||||
{{ 0.0f, 1.0f, 1.0f}, { 1.0f, 1.0f, 0.25f}},
|
{{ 0.0f, 1.0f, 1.0f}, { 1.0f, 1.0f, 0.25f}},
|
||||||
|
|
||||||
{{ 0.0f, -1.0f, 0.0f}, { 0.0f, 0.0f, 0.75f}},
|
{{ 0.0f, -1.0f, 0.0f}, { 0.0f, 0.0f, 0.75f}},
|
||||||
{{ 1.0f, -1.0f, 1.0f}, { 1.0f, 0.0f, 0.75f}},
|
|
||||||
{{ 0.0f, 1.0f, 0.0f}, { 0.0f, 1.0f, 0.75f}},
|
{{ 0.0f, 1.0f, 0.0f}, { 0.0f, 1.0f, 0.75f}},
|
||||||
|
{{ 1.0f, -1.0f, 1.0f}, { 1.0f, 0.0f, 0.75f}},
|
||||||
{{ 1.0f, 1.0f, 1.0f}, { 1.0f, 1.0f, 0.75f}},
|
{{ 1.0f, 1.0f, 1.0f}, { 1.0f, 1.0f, 0.75f}},
|
||||||
};
|
};
|
||||||
static const DWORD shader_code[] =
|
static const DWORD shader_code[] =
|
||||||
|
@ -4180,22 +4184,30 @@ static void volume_v16u16_test(IDirect3DDevice8 *device)
|
||||||
0x0000ffff /* end */
|
0x0000ffff /* end */
|
||||||
};
|
};
|
||||||
|
|
||||||
hr = IDirect3DDevice8_GetDirect3D(device, &d3d8);
|
window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||||
ok(SUCCEEDED(hr), "Failed to get d3d8 interface, hr %#x.\n", hr);
|
0, 0, 640, 480, NULL, NULL, NULL, NULL);
|
||||||
hr = IDirect3D8_CheckDeviceFormat(d3d8, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
|
d3d = Direct3DCreate8(D3D_SDK_VERSION);
|
||||||
D3DFMT_X8R8G8B8, 0, D3DRTYPE_VOLUMETEXTURE, D3DFMT_V16U16);
|
ok(!!d3d, "Failed to create a D3D object.\n");
|
||||||
IDirect3D8_Release(d3d8);
|
if (!(device = create_device(d3d, window, window, TRUE)))
|
||||||
if (FAILED(hr))
|
{
|
||||||
|
skip("Failed to create a D3D device, skipping tests.\n");
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FAILED(IDirect3D8_CheckDeviceFormat(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
|
||||||
|
D3DFMT_X8R8G8B8, 0, D3DRTYPE_VOLUMETEXTURE, D3DFMT_V16U16)))
|
||||||
{
|
{
|
||||||
skip("Volume V16U16 textures are not supported, skipping test.\n");
|
skip("Volume V16U16 textures are not supported, skipping test.\n");
|
||||||
return;
|
IDirect3DDevice8_Release(device);
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
hr = IDirect3DDevice8_GetDeviceCaps(device, &caps);
|
hr = IDirect3DDevice8_GetDeviceCaps(device, &caps);
|
||||||
ok(SUCCEEDED(hr), "Failed to get caps, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Failed to get caps, hr %#x.\n", hr);
|
||||||
if (caps.PixelShaderVersion < D3DPS_VERSION(1, 1))
|
if (caps.PixelShaderVersion < D3DPS_VERSION(1, 1))
|
||||||
{
|
{
|
||||||
skip("No pixel shader 1.1 support, skipping test.\n");
|
skip("No pixel shader 1.1 support, skipping test.\n");
|
||||||
return;
|
IDirect3DDevice8_Release(device);
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = IDirect3DDevice8_SetVertexShader(device, D3DFVF_XYZ | D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE3(0));
|
hr = IDirect3DDevice8_SetVertexShader(device, D3DFVF_XYZ | D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE3(0));
|
||||||
|
@ -4258,7 +4270,7 @@ static void volume_v16u16_test(IDirect3DDevice8 *device)
|
||||||
hr = IDirect3DDevice8_SetTexture(device, 0, (IDirect3DBaseTexture8 *) texture);
|
hr = IDirect3DDevice8_SetTexture(device, 0, (IDirect3DBaseTexture8 *) texture);
|
||||||
ok(SUCCEEDED(hr), "Failed to set texture, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Failed to set texture, hr %#x.\n", hr);
|
||||||
|
|
||||||
hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x00ff00ff, 0.0f, 0);
|
hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x00ff00ff, 1.0f, 0);
|
||||||
ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
|
||||||
hr = IDirect3DDevice8_BeginScene(device);
|
hr = IDirect3DDevice8_BeginScene(device);
|
||||||
ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
|
||||||
|
@ -4288,12 +4300,13 @@ static void volume_v16u16_test(IDirect3DDevice8 *device)
|
||||||
IDirect3DVolumeTexture8_Release(texture);
|
IDirect3DVolumeTexture8_Release(texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = IDirect3DDevice8_SetPixelShader(device, 0);
|
|
||||||
ok(SUCCEEDED(hr), "Failed to set pixel shader, hr %#x.\n", hr);
|
|
||||||
hr = IDirect3DDevice8_DeletePixelShader(device, shader);
|
hr = IDirect3DDevice8_DeletePixelShader(device, shader);
|
||||||
ok(SUCCEEDED(hr), "Failed delete pixel shader, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Failed delete pixel shader, hr %#x.\n", hr);
|
||||||
hr = IDirect3DDevice8_SetTexture(device, 0, NULL);
|
refcount = IDirect3DDevice8_Release(device);
|
||||||
ok(SUCCEEDED(hr), "Failed to set texture, hr %#x.\n", hr);
|
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||||
|
done:
|
||||||
|
IDirect3D8_Release(d3d);
|
||||||
|
DestroyWindow(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fill_surface(IDirect3DSurface8 *surface, DWORD color, DWORD flags)
|
static void fill_surface(IDirect3DSurface8 *surface, DWORD color, DWORD flags)
|
||||||
|
@ -4736,7 +4749,6 @@ START_TEST(visual)
|
||||||
resz_test(device_ptr);
|
resz_test(device_ptr);
|
||||||
fog_special_test(device_ptr);
|
fog_special_test(device_ptr);
|
||||||
volume_dxt5_test(device_ptr);
|
volume_dxt5_test(device_ptr);
|
||||||
volume_v16u16_test(device_ptr);
|
|
||||||
|
|
||||||
refcount = IDirect3DDevice8_Release(device_ptr);
|
refcount = IDirect3DDevice8_Release(device_ptr);
|
||||||
ok(!refcount, "Device has %u references left.\n", refcount);
|
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||||
|
@ -4744,5 +4756,6 @@ cleanup:
|
||||||
IDirect3D8_Release(d3d);
|
IDirect3D8_Release(d3d);
|
||||||
DestroyWindow(window);
|
DestroyWindow(window);
|
||||||
|
|
||||||
|
volume_v16u16_test();
|
||||||
add_dirty_rect_test();
|
add_dirty_rect_test();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue