d3d9/tests: Use a separate device for float_texture_test().
This commit is contained in:
parent
63c679e651
commit
1abd58edea
|
@ -3791,37 +3791,48 @@ static void release_buffer_test(IDirect3DDevice9 *device)
|
||||||
IDirect3DVertexBuffer9_Release(vb);
|
IDirect3DVertexBuffer9_Release(vb);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void float_texture_test(IDirect3DDevice9 *device)
|
static void float_texture_test(void)
|
||||||
{
|
{
|
||||||
IDirect3D9 *d3d = NULL;
|
IDirect3DTexture9 *texture;
|
||||||
HRESULT hr;
|
IDirect3DDevice9 *device;
|
||||||
IDirect3DTexture9 *texture = NULL;
|
|
||||||
D3DLOCKED_RECT lr;
|
D3DLOCKED_RECT lr;
|
||||||
|
IDirect3D9 *d3d;
|
||||||
|
ULONG refcount;
|
||||||
float *data;
|
float *data;
|
||||||
DWORD color;
|
DWORD color;
|
||||||
float quad[] = {
|
HWND window;
|
||||||
-1.0, -1.0, 0.1, 0.0, 0.0,
|
HRESULT hr;
|
||||||
-1.0, 1.0, 0.1, 0.0, 1.0,
|
|
||||||
1.0, -1.0, 0.1, 1.0, 0.0,
|
static const float quad[] =
|
||||||
1.0, 1.0, 0.1, 1.0, 1.0,
|
{
|
||||||
|
-1.0f, -1.0f, 0.1f, 0.0f, 0.0f,
|
||||||
|
-1.0f, 1.0f, 0.1f, 0.0f, 1.0f,
|
||||||
|
1.0f, -1.0f, 0.1f, 1.0f, 0.0f,
|
||||||
|
1.0f, 1.0f, 0.1f, 1.0f, 1.0f,
|
||||||
};
|
};
|
||||||
|
|
||||||
memset(&lr, 0, sizeof(lr));
|
window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||||
IDirect3DDevice9_GetDirect3D(device, &d3d);
|
0, 0, 640, 480, NULL, NULL, NULL, NULL);
|
||||||
if(IDirect3D9_CheckDeviceFormat(d3d, 0, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, 0,
|
d3d = Direct3DCreate9(D3D_SDK_VERSION);
|
||||||
D3DRTYPE_TEXTURE, D3DFMT_R32F) != D3D_OK) {
|
ok(!!d3d, "Failed to create a D3D object.\n");
|
||||||
|
if (!(device = create_device(d3d, window, window, TRUE)))
|
||||||
|
{
|
||||||
|
skip("Failed to create a D3D device, skipping tests.\n");
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IDirect3D9_CheckDeviceFormat(d3d, 0, D3DDEVTYPE_HAL,
|
||||||
|
D3DFMT_X8R8G8B8, 0, D3DRTYPE_TEXTURE, D3DFMT_R32F) != D3D_OK)
|
||||||
|
{
|
||||||
skip("D3DFMT_R32F textures not supported\n");
|
skip("D3DFMT_R32F textures not supported\n");
|
||||||
goto out;
|
IDirect3DDevice9_Release(device);
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = IDirect3DDevice9_CreateTexture(device, 1, 1, 1, 0, D3DFMT_R32F,
|
hr = IDirect3DDevice9_CreateTexture(device, 1, 1, 1, 0, D3DFMT_R32F, D3DPOOL_MANAGED, &texture, NULL);
|
||||||
D3DPOOL_MANAGED, &texture, NULL);
|
ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr);
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice9_CreateTexture failed with %08x\n", hr);
|
|
||||||
if(!texture) {
|
|
||||||
skip("Failed to create R32F texture\n");
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
memset(&lr, 0, sizeof(lr));
|
||||||
hr = IDirect3DTexture9_LockRect(texture, 0, &lr, NULL, 0);
|
hr = IDirect3DTexture9_LockRect(texture, 0, &lr, NULL, 0);
|
||||||
ok(hr == D3D_OK, "IDirect3DTexture9_LockRect failed with %08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DTexture9_LockRect failed with %08x\n", hr);
|
||||||
data = lr.pBits;
|
data = lr.pBits;
|
||||||
|
@ -3829,9 +3840,14 @@ static void float_texture_test(IDirect3DDevice9 *device)
|
||||||
hr = IDirect3DTexture9_UnlockRect(texture, 0);
|
hr = IDirect3DTexture9_UnlockRect(texture, 0);
|
||||||
ok(hr == D3D_OK, "IDirect3DTexture9_UnlockRect failed with %08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DTexture9_UnlockRect failed with %08x\n", hr);
|
||||||
|
|
||||||
hr = IDirect3DDevice9_SetTexture(device, 0, (IDirect3DBaseTexture9 *) texture);
|
hr = IDirect3DDevice9_SetRenderState(device, D3DRS_LIGHTING, FALSE);
|
||||||
|
ok(SUCCEEDED(hr), "Failed to disable lighting, hr %#x.\n", hr);
|
||||||
|
hr = IDirect3DDevice9_SetTexture(device, 0, (IDirect3DBaseTexture9 *)texture);
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice9_SetTexture failed with %08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DDevice9_SetTexture failed with %08x\n", hr);
|
||||||
|
|
||||||
|
hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff0000ff, 1.0f, 0);
|
||||||
|
ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
|
||||||
|
|
||||||
hr = IDirect3DDevice9_BeginScene(device);
|
hr = IDirect3DDevice9_BeginScene(device);
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice9_BeginScene failed with %08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DDevice9_BeginScene failed with %08x\n", hr);
|
||||||
if(SUCCEEDED(hr))
|
if(SUCCEEDED(hr))
|
||||||
|
@ -3845,8 +3861,6 @@ static void float_texture_test(IDirect3DDevice9 *device)
|
||||||
hr = IDirect3DDevice9_EndScene(device);
|
hr = IDirect3DDevice9_EndScene(device);
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice9_EndScene failed with %08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DDevice9_EndScene failed with %08x\n", hr);
|
||||||
}
|
}
|
||||||
hr = IDirect3DDevice9_SetTexture(device, 0, NULL);
|
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice9_SetTexture failed with %08x\n", hr);
|
|
||||||
|
|
||||||
color = getPixelColor(device, 240, 320);
|
color = getPixelColor(device, 240, 320);
|
||||||
ok(color == 0x0000ffff, "R32F with value 0.0 has color %08x, expected 0x0000ffff\n", color);
|
ok(color == 0x0000ffff, "R32F with value 0.0 has color %08x, expected 0x0000ffff\n", color);
|
||||||
|
@ -3854,9 +3868,12 @@ static void float_texture_test(IDirect3DDevice9 *device)
|
||||||
hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
|
hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice9_Present failed with %08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DDevice9_Present failed with %08x\n", hr);
|
||||||
|
|
||||||
out:
|
IDirect3DTexture9_Release(texture);
|
||||||
if(texture) IDirect3DTexture9_Release(texture);
|
refcount = IDirect3DDevice9_Release(device);
|
||||||
|
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||||
|
done:
|
||||||
IDirect3D9_Release(d3d);
|
IDirect3D9_Release(d3d);
|
||||||
|
DestroyWindow(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void g16r16_texture_test(void)
|
static void g16r16_texture_test(void)
|
||||||
|
@ -16606,11 +16623,11 @@ START_TEST(visual)
|
||||||
shademode_test(device_ptr);
|
shademode_test(device_ptr);
|
||||||
srgbtexture_test(device_ptr);
|
srgbtexture_test(device_ptr);
|
||||||
release_buffer_test(device_ptr);
|
release_buffer_test(device_ptr);
|
||||||
float_texture_test(device_ptr);
|
|
||||||
|
|
||||||
cleanup_device(device_ptr);
|
cleanup_device(device_ptr);
|
||||||
device_ptr = NULL;
|
device_ptr = NULL;
|
||||||
|
|
||||||
|
float_texture_test();
|
||||||
g16r16_texture_test();
|
g16r16_texture_test();
|
||||||
pixelshader_blending_test();
|
pixelshader_blending_test();
|
||||||
texture_transform_flags_test();
|
texture_transform_flags_test();
|
||||||
|
|
Loading…
Reference in New Issue