From: Józef Kucia jkucia@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- include/vkd3d_dxgi.idl | 25 ++++++++++++++++++++++++- tests/d3d12.c | 31 +++++++++++++++++++++++++++++-- 2 files changed, 53 insertions(+), 3 deletions(-)
diff --git a/include/vkd3d_dxgi.idl b/include/vkd3d_dxgi.idl index 5b80e1f6c3f4..91f233664f91 100644 --- a/include/vkd3d_dxgi.idl +++ b/include/vkd3d_dxgi.idl @@ -38,7 +38,6 @@ typedef enum DXGI_MODE_ROTATION DXGI_MODE_ROTATION_ROTATE270 = 0x4, } DXGI_MODE_ROTATION;
-interface IDXGIAdapter; interface IDXGIAdapter1; interface IDXGIOutput; typedef struct DXGI_SWAP_CHAIN_DESC DXGI_SWAP_CHAIN_DESC; @@ -54,6 +53,18 @@ const DXGI_USAGE DXGI_USAGE_READ_ONLY = 0x00000100ul; const DXGI_USAGE DXGI_USAGE_DISCARD_ON_PRESENT = 0x00000200ul; const DXGI_USAGE DXGI_USAGE_UNORDERED_ACCESS = 0x00000400ul;
+typedef struct DXGI_ADAPTER_DESC { + WCHAR Description[128]; + UINT VendorId; + UINT DeviceId; + UINT SubSysId; + UINT Revision; + SIZE_T DedicatedVideoMemory; + SIZE_T DedicatedSystemMemory; + SIZE_T SharedSystemMemory; + LUID AdapterLuid; +} DXGI_ADAPTER_DESC; + [ local, object, @@ -79,6 +90,18 @@ interface IDXGIDeviceSubObject : IDXGIObject HRESULT GetDevice(REFIID riid, void **device); }
+[ + object, + local, + uuid(2411e7e1-12ac-4ccf-bd14-9798e8534dc0) +] +interface IDXGIAdapter : IDXGIObject +{ + HRESULT EnumOutputs(UINT output_idx, IDXGIOutput **output); + HRESULT GetDesc(DXGI_ADAPTER_DESC *desc); + HRESULT CheckInterfaceSupport(REFGUID guid, void *umd_version); +} + [ local, object, diff --git a/tests/d3d12.c b/tests/d3d12.c index f52176632819..5265ed12424e 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -890,8 +890,7 @@ static IUnknown *create_adapter(void) return adapter; }
- if (use_adapter_idx) - hr = IDXGIFactory4_EnumAdapters(factory, use_adapter_idx, (IDXGIAdapter **)&adapter); + hr = IDXGIFactory4_EnumAdapters(factory, use_adapter_idx, (IDXGIAdapter **)&adapter); IDXGIFactory4_Release(factory); if (FAILED(hr)) trace("Failed to get adapter, hr %#x.\n", hr); @@ -923,6 +922,32 @@ static ID3D12Device *create_device(void) return SUCCEEDED(hr) ? device : NULL; }
+#ifdef _WIN32 +static void print_adapter_info(void) +{ + IDXGIAdapter *dxgi_adapter; + DXGI_ADAPTER_DESC desc; + IUnknown *adapter; + HRESULT hr; + + if (!(adapter = create_adapter())) + return; + + hr = IUnknown_QueryInterface(adapter, &IID_IDXGIAdapter, (void **)&dxgi_adapter); + ok(hr == S_OK, "Failed to query IDXGIAdapter, hr %#x.\n", hr); + IUnknown_Release(adapter); + + hr = IDXGIAdapter_GetDesc(dxgi_adapter, &desc); + ok(hr == S_OK, "Failed to get adapter desc, hr %#x.\n", hr); + + trace("Adapter: %04x:%04x.\n", desc.VendorId, desc.DeviceId); + + IDXGIAdapter_Release(dxgi_adapter); +} +#else +static void print_adapter_info(void) {} +#endif + static bool broken_on_warp(bool condition) { return broken(use_warp_device && condition); @@ -21915,6 +21940,8 @@ START_TEST(d3d12) ID3D12Debug_Release(debug); }
+ print_adapter_info(); + run_test(test_create_device); run_test(test_node_count); run_test(test_check_feature_support);
On Wed, 28 Nov 2018 at 21:22, Józef Kucia joseph.kucia@gmail.com wrote:
+typedef struct DXGI_ADAPTER_DESC {
Formatting.
+#ifdef _WIN32 +static void print_adapter_info(void) +{
- IDXGIAdapter *dxgi_adapter;
- DXGI_ADAPTER_DESC desc;
- IUnknown *adapter;
- HRESULT hr;
- if (!(adapter = create_adapter()))
return;
- hr = IUnknown_QueryInterface(adapter, &IID_IDXGIAdapter, (void **)&dxgi_adapter);
- ok(hr == S_OK, "Failed to query IDXGIAdapter, hr %#x.\n", hr);
- IUnknown_Release(adapter);
- hr = IDXGIAdapter_GetDesc(dxgi_adapter, &desc);
- ok(hr == S_OK, "Failed to get adapter desc, hr %#x.\n", hr);
- trace("Adapter: %04x:%04x.\n", desc.VendorId, desc.DeviceId);
- IDXGIAdapter_Release(dxgi_adapter);
+} +#else +static void print_adapter_info(void) {} +#endif
I don't necessarily care that strongly, but is the #ifdef really needed? It seems print_adapter_info() already handles create_adapter() returning NULL.
On Thu, Nov 29, 2018 at 4:31 PM Henri Verbeet hverbeet@gmail.com wrote:
+#ifdef _WIN32 +static void print_adapter_info(void) +{
- IDXGIAdapter *dxgi_adapter;
- DXGI_ADAPTER_DESC desc;
- IUnknown *adapter;
- HRESULT hr;
- if (!(adapter = create_adapter()))
return;
- hr = IUnknown_QueryInterface(adapter, &IID_IDXGIAdapter, (void **)&dxgi_adapter);
- ok(hr == S_OK, "Failed to query IDXGIAdapter, hr %#x.\n", hr);
- IUnknown_Release(adapter);
- hr = IDXGIAdapter_GetDesc(dxgi_adapter, &desc);
- ok(hr == S_OK, "Failed to get adapter desc, hr %#x.\n", hr);
- trace("Adapter: %04x:%04x.\n", desc.VendorId, desc.DeviceId);
- IDXGIAdapter_Release(dxgi_adapter);
+} +#else +static void print_adapter_info(void) {} +#endif
I don't necessarily care that strongly, but is the #ifdef really needed? It seems print_adapter_info() already handles create_adapter() returning NULL.
We currently include DXGI headers only when _WIN32 is defined. We could include DXGI headers unconditionally, but those are not very useful when we do not have DXGI.
On Thu, 29 Nov 2018 at 19:11, Józef Kucia joseph.kucia@gmail.com wrote:
We currently include DXGI headers only when _WIN32 is defined. We could include DXGI headers unconditionally, but those are not very useful when we do not have DXGI.
Ah, right.