2016-09-20 09:26:52 -07:00
|
|
|
From a5f4ae0710b650be91c1b4e0e565fa8e816f75b0 Mon Sep 17 00:00:00 2001
|
2016-08-31 08:42:50 -07:00
|
|
|
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
|
|
|
Date: Thu, 25 Aug 2016 19:50:30 +0200
|
|
|
|
Subject: d3d11/tests: Test 1d texture interfaces.
|
|
|
|
|
|
|
|
---
|
|
|
|
dlls/d3d11/tests/d3d11.c | 159 +++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
|
1 file changed, 159 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
|
2016-09-20 09:26:52 -07:00
|
|
|
index 02eeb88..861e3fc 100644
|
2016-08-31 08:42:50 -07:00
|
|
|
--- a/dlls/d3d11/tests/d3d11.c
|
|
|
|
+++ b/dlls/d3d11/tests/d3d11.c
|
2016-09-20 09:26:52 -07:00
|
|
|
@@ -1801,6 +1801,164 @@ static void test_create_texture1d(void)
|
2016-08-31 08:42:50 -07:00
|
|
|
ok(!refcount, "Device has %u references left.\n", refcount);
|
|
|
|
}
|
|
|
|
|
|
|
|
+static void test_texture1d_interfaces(void)
|
|
|
|
+{
|
|
|
|
+ ID3D10Texture1D *d3d10_texture;
|
|
|
|
+ D3D11_TEXTURE1D_DESC desc;
|
|
|
|
+ ID3D11Texture1D *texture;
|
|
|
|
+ IDXGISurface *surface;
|
|
|
|
+ ID3D11Device *device;
|
|
|
|
+ unsigned int i;
|
|
|
|
+ ULONG refcount;
|
|
|
|
+ HRESULT hr;
|
|
|
|
+
|
|
|
|
+ static const struct test
|
|
|
|
+ {
|
|
|
|
+ BOOL implements_d3d10_interfaces;
|
|
|
|
+ UINT bind_flags;
|
|
|
|
+ UINT misc_flags;
|
|
|
|
+ UINT expected_bind_flags;
|
|
|
|
+ UINT expected_misc_flags;
|
|
|
|
+ }
|
|
|
|
+ desc_conversion_tests[] =
|
|
|
|
+ {
|
|
|
|
+ {
|
|
|
|
+ TRUE,
|
|
|
|
+ D3D11_BIND_SHADER_RESOURCE, 0,
|
|
|
|
+ D3D10_BIND_SHADER_RESOURCE, 0
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ TRUE,
|
|
|
|
+ D3D11_BIND_UNORDERED_ACCESS, 0,
|
|
|
|
+ D3D11_BIND_UNORDERED_ACCESS, 0
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ FALSE,
|
|
|
|
+ 0, D3D11_RESOURCE_MISC_RESOURCE_CLAMP,
|
|
|
|
+ 0, 0
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ TRUE,
|
|
|
|
+ 0, D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX,
|
|
|
|
+ 0, D3D10_RESOURCE_MISC_SHARED_KEYEDMUTEX
|
|
|
|
+ },
|
|
|
|
+ /* Fails on WARP, needs to be verified using real hardware
|
|
|
|
+ {
|
|
|
|
+ TRUE,
|
|
|
|
+ 0, D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX | D3D11_RESOURCE_MISC_SHARED_NTHANDLE,
|
|
|
|
+ 0, D3D10_RESOURCE_MISC_SHARED_KEYEDMUTEX
|
|
|
|
+ },
|
|
|
|
+ */
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ if (!(device = create_device(NULL)))
|
|
|
|
+ {
|
|
|
|
+ skip("Failed to create ID3D11Device, skipping tests.\n");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ desc.Width = 512;
|
|
|
|
+ desc.MipLevels = 0;
|
|
|
|
+ desc.ArraySize = 1;
|
|
|
|
+ desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
|
|
|
+ desc.Usage = D3D11_USAGE_DEFAULT;
|
|
|
|
+ desc.BindFlags = D3D11_BIND_RENDER_TARGET;
|
|
|
|
+ desc.CPUAccessFlags = 0;
|
|
|
|
+ desc.MiscFlags = 0;
|
|
|
|
+
|
|
|
|
+ hr = ID3D11Device_CreateTexture1D(device, &desc, NULL, &texture);
|
|
|
|
+ ok(SUCCEEDED(hr), "Failed to create a 2d texture, hr %#x.\n", hr);
|
|
|
|
+
|
|
|
|
+ hr = ID3D11Texture1D_QueryInterface(texture, &IID_IDXGISurface, (void **)&surface);
|
|
|
|
+ ok(hr == E_NOINTERFACE, "Texture should not implement IDXGISurface.\n");
|
|
|
|
+
|
|
|
|
+ hr = ID3D11Texture1D_QueryInterface(texture, &IID_ID3D10Texture1D, (void **)&d3d10_texture);
|
|
|
|
+ ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */,
|
|
|
|
+ "Texture should implement ID3D10Texture1D.\n");
|
|
|
|
+ if (SUCCEEDED(hr)) ID3D10Texture1D_Release(d3d10_texture);
|
|
|
|
+ ID3D11Texture1D_Release(texture);
|
|
|
|
+
|
|
|
|
+ if (FAILED(hr))
|
|
|
|
+ {
|
|
|
|
+ win_skip("2D textures do not implement ID3D10Texture1D, skipping tests.\n");
|
|
|
|
+ ID3D11Device_Release(device);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for (i = 0; i < sizeof(desc_conversion_tests) / sizeof(*desc_conversion_tests); ++i)
|
|
|
|
+ {
|
|
|
|
+ const struct test *current = &desc_conversion_tests[i];
|
|
|
|
+ D3D10_TEXTURE1D_DESC d3d10_desc;
|
|
|
|
+ ID3D10Device *d3d10_device;
|
|
|
|
+
|
|
|
|
+ desc.Width = 512;
|
|
|
|
+ desc.MipLevels = 1;
|
|
|
|
+ desc.ArraySize = 1;
|
|
|
|
+ desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
|
|
|
+ desc.Usage = D3D11_USAGE_DEFAULT;
|
|
|
|
+ desc.BindFlags = current->bind_flags;
|
|
|
|
+ desc.CPUAccessFlags = 0;
|
|
|
|
+ desc.MiscFlags = current->misc_flags;
|
|
|
|
+
|
|
|
|
+ hr = ID3D11Device_CreateTexture1D(device, &desc, NULL, &texture);
|
|
|
|
+ /* Shared resources are not supported by REF and WARP devices. */
|
|
|
|
+ ok(SUCCEEDED(hr) || broken(hr == E_OUTOFMEMORY),
|
|
|
|
+ "Test %u: Failed to create a 1d texture, hr %#x.\n", i, hr);
|
|
|
|
+ if (FAILED(hr))
|
|
|
|
+ {
|
|
|
|
+ win_skip("Failed to create ID3D11Texture1D, skipping test %u.\n", i);
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ hr = ID3D11Texture1D_QueryInterface(texture, &IID_IDXGISurface, (void **)&surface);
|
|
|
|
+ ok(SUCCEEDED(hr), "Test %u: Texture should implement IDXGISurface.\n", i);
|
|
|
|
+ IDXGISurface_Release(surface);
|
|
|
|
+
|
|
|
|
+ hr = ID3D11Texture1D_QueryInterface(texture, &IID_ID3D10Texture1D, (void **)&d3d10_texture);
|
|
|
|
+ ID3D11Texture1D_Release(texture);
|
|
|
|
+
|
|
|
|
+ if (current->implements_d3d10_interfaces)
|
|
|
|
+ {
|
|
|
|
+ ok(SUCCEEDED(hr), "Test %u: Texture should implement ID3D10Texture1D.\n", i);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ todo_wine ok(hr == E_NOINTERFACE, "Test %u: Texture should not implement ID3D10Texture1D.\n", i);
|
|
|
|
+ if (SUCCEEDED(hr)) ID3D10Texture1D_Release(d3d10_texture);
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ID3D10Texture1D_GetDesc(d3d10_texture, &d3d10_desc);
|
|
|
|
+
|
|
|
|
+ ok(d3d10_desc.Width == desc.Width,
|
|
|
|
+ "Test %u: Got unexpected Width %u.\n", i, d3d10_desc.Width);
|
|
|
|
+ ok(d3d10_desc.MipLevels == desc.MipLevels,
|
|
|
|
+ "Test %u: Got unexpected MipLevels %u.\n", i, d3d10_desc.MipLevels);
|
|
|
|
+ ok(d3d10_desc.ArraySize == desc.ArraySize,
|
|
|
|
+ "Test %u: Got unexpected ArraySize %u.\n", i, d3d10_desc.ArraySize);
|
|
|
|
+ ok(d3d10_desc.Format == desc.Format,
|
|
|
|
+ "Test %u: Got unexpected Format %u.\n", i, d3d10_desc.Format);
|
|
|
|
+ ok(d3d10_desc.Usage == (D3D10_USAGE)desc.Usage,
|
|
|
|
+ "Test %u: Got unexpected Usage %u.\n", i, d3d10_desc.Usage);
|
|
|
|
+ ok(d3d10_desc.BindFlags == current->expected_bind_flags,
|
|
|
|
+ "Test %u: Got unexpected BindFlags %#x.\n", i, d3d10_desc.BindFlags);
|
|
|
|
+ ok(d3d10_desc.CPUAccessFlags == desc.CPUAccessFlags,
|
|
|
|
+ "Test %u: Got unexpected CPUAccessFlags %#x.\n", i, d3d10_desc.CPUAccessFlags);
|
|
|
|
+ ok(d3d10_desc.MiscFlags == current->expected_misc_flags,
|
|
|
|
+ "Test %u: Got unexpected MiscFlags %#x.\n", i, d3d10_desc.MiscFlags);
|
|
|
|
+
|
|
|
|
+ d3d10_device = (ID3D10Device *)0xdeadbeef;
|
|
|
|
+ ID3D10Texture1D_GetDevice(d3d10_texture, &d3d10_device);
|
|
|
|
+ todo_wine ok(!d3d10_device, "Test %u: Got unexpected device pointer %p, expected NULL.\n", i, d3d10_device);
|
|
|
|
+ if (d3d10_device) ID3D10Device_Release(d3d10_device);
|
|
|
|
+
|
|
|
|
+ ID3D10Texture1D_Release(d3d10_texture);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ refcount = ID3D11Device_Release(device);
|
|
|
|
+ ok(!refcount, "Device has %u references left.\n", refcount);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
static void test_create_texture2d(void)
|
|
|
|
{
|
|
|
|
ULONG refcount, expected_refcount;
|
2016-09-20 09:26:52 -07:00
|
|
|
@@ -10990,6 +11148,7 @@ START_TEST(d3d11)
|
|
|
|
run_for_each_feature_level(test_device_interfaces);
|
2016-08-31 08:42:50 -07:00
|
|
|
test_get_immediate_context();
|
|
|
|
test_create_texture1d();
|
|
|
|
+ test_texture1d_interfaces();
|
|
|
|
test_create_texture2d();
|
|
|
|
test_texture2d_interfaces();
|
|
|
|
test_create_texture3d();
|
|
|
|
--
|
2016-09-20 09:26:52 -07:00
|
|
|
2.9.0
|
2016-08-31 08:42:50 -07:00
|
|
|
|