2008-11-18 09:27:58 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2008 Henri Verbeet for CodeWeavers
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
#include "initguid.h"
|
|
|
|
#include "d3d10.h"
|
|
|
|
#include "wine/test.h"
|
|
|
|
|
2014-02-10 10:37:54 +01:00
|
|
|
static IDXGIDevice *create_device(void)
|
2008-11-18 09:27:58 +01:00
|
|
|
{
|
2014-02-10 10:37:54 +01:00
|
|
|
IDXGIDevice *dxgi_device;
|
|
|
|
ID3D10Device *device;
|
2008-11-18 09:27:58 +01:00
|
|
|
HRESULT hr;
|
|
|
|
|
2014-02-10 10:37:54 +01:00
|
|
|
if (SUCCEEDED(D3D10CreateDevice(NULL, D3D10_DRIVER_TYPE_HARDWARE, NULL, 0, D3D10_SDK_VERSION, &device)))
|
|
|
|
goto success;
|
|
|
|
if (SUCCEEDED(D3D10CreateDevice(NULL, D3D10_DRIVER_TYPE_WARP, NULL, 0, D3D10_SDK_VERSION, &device)))
|
|
|
|
goto success;
|
|
|
|
if (SUCCEEDED(D3D10CreateDevice(NULL, D3D10_DRIVER_TYPE_REFERENCE, NULL, 0, D3D10_SDK_VERSION, &device)))
|
|
|
|
goto success;
|
2008-11-18 09:27:58 +01:00
|
|
|
|
2014-02-10 10:37:54 +01:00
|
|
|
return NULL;
|
2008-11-18 09:27:58 +01:00
|
|
|
|
2014-02-10 10:37:54 +01:00
|
|
|
success:
|
|
|
|
hr = ID3D10Device_QueryInterface(device, &IID_IDXGIDevice, (void **)&dxgi_device);
|
2008-11-18 09:27:58 +01:00
|
|
|
ok(SUCCEEDED(hr), "Created device does not implement IDXGIDevice\n");
|
2014-02-10 10:37:54 +01:00
|
|
|
ID3D10Device_Release(device);
|
2008-11-18 09:27:58 +01:00
|
|
|
|
|
|
|
return dxgi_device;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_device_interfaces(IDXGIDevice *device)
|
|
|
|
{
|
|
|
|
IUnknown *obj;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
if (SUCCEEDED(hr = IDXGIDevice_QueryInterface(device, &IID_IUnknown, (void **)&obj)))
|
|
|
|
IUnknown_Release(obj);
|
|
|
|
ok(SUCCEEDED(hr), "IDXGIDevice does not implement IUnknown\n");
|
|
|
|
|
|
|
|
if (SUCCEEDED(hr = IDXGIDevice_QueryInterface(device, &IID_IDXGIObject, (void **)&obj)))
|
|
|
|
IUnknown_Release(obj);
|
|
|
|
ok(SUCCEEDED(hr), "IDXGIDevice does not implement IDXGIObject\n");
|
|
|
|
|
|
|
|
if (SUCCEEDED(hr = IDXGIDevice_QueryInterface(device, &IID_IDXGIDevice, (void **)&obj)))
|
|
|
|
IUnknown_Release(obj);
|
|
|
|
ok(SUCCEEDED(hr), "IDXGIDevice does not implement IDXGIDevice\n");
|
|
|
|
|
|
|
|
if (SUCCEEDED(hr = IDXGIDevice_QueryInterface(device, &IID_ID3D10Device, (void **)&obj)))
|
|
|
|
IUnknown_Release(obj);
|
|
|
|
ok(SUCCEEDED(hr), "IDXGIDevice does not implement ID3D10Device\n");
|
|
|
|
}
|
|
|
|
|
2009-12-04 11:50:50 +01:00
|
|
|
static void test_adapter_desc(IDXGIDevice *device)
|
|
|
|
{
|
2014-01-28 10:09:25 +01:00
|
|
|
DXGI_ADAPTER_DESC1 desc1;
|
|
|
|
IDXGIAdapter1 *adapter1;
|
2009-12-04 11:50:50 +01:00
|
|
|
DXGI_ADAPTER_DESC desc;
|
|
|
|
IDXGIAdapter *adapter;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
hr = IDXGIDevice_GetAdapter(device, &adapter);
|
|
|
|
ok(SUCCEEDED(hr), "GetAdapter failed, hr %#x.\n", hr);
|
|
|
|
|
|
|
|
hr = IDXGIAdapter_GetDesc(adapter, NULL);
|
|
|
|
ok(hr == E_INVALIDARG, "GetDesc returned %#x, expected %#x.\n",
|
|
|
|
hr, E_INVALIDARG);
|
|
|
|
|
|
|
|
hr = IDXGIAdapter_GetDesc(adapter, &desc);
|
|
|
|
ok(SUCCEEDED(hr), "GetDesc failed, hr %#x.\n", hr);
|
|
|
|
|
|
|
|
trace("%s.\n", wine_dbgstr_w(desc.Description));
|
|
|
|
trace("%04x: %04x:%04x (rev %02x).\n",
|
|
|
|
desc.SubSysId, desc.VendorId, desc.DeviceId, desc.Revision);
|
|
|
|
trace("Dedicated video memory: %lu (%lu MB).\n",
|
|
|
|
desc.DedicatedVideoMemory, desc.DedicatedVideoMemory / (1024 * 1024));
|
|
|
|
trace("Dedicated system memory: %lu (%lu MB).\n",
|
|
|
|
desc.DedicatedSystemMemory, desc.DedicatedSystemMemory / (1024 * 1024));
|
|
|
|
trace("Shared system memory: %lu (%lu MB).\n",
|
|
|
|
desc.SharedSystemMemory, desc.SharedSystemMemory / (1024 * 1024));
|
|
|
|
trace("LUID: %08x:%08x.\n", desc.AdapterLuid.HighPart, desc.AdapterLuid.LowPart);
|
|
|
|
|
2014-01-28 10:09:25 +01:00
|
|
|
hr = IDXGIAdapter_QueryInterface(adapter, &IID_IDXGIAdapter1, (void **)&adapter1);
|
|
|
|
ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE), "Got unexpected hr %#x.\n", hr);
|
|
|
|
if (hr == E_NOINTERFACE)
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
hr = IDXGIAdapter1_GetDesc1(adapter1, &desc1);
|
|
|
|
ok(SUCCEEDED(hr), "GetDesc1 failed, hr %#x.\n", hr);
|
|
|
|
|
|
|
|
ok(!lstrcmpW(desc.Description, desc1.Description),
|
|
|
|
"Got unexpected description %s.\n", wine_dbgstr_w(desc1.Description));
|
|
|
|
ok(desc1.VendorId == desc.VendorId, "Got unexpected vendor ID %04x.\n", desc1.VendorId);
|
|
|
|
ok(desc1.DeviceId == desc.DeviceId, "Got unexpected device ID %04x.\n", desc1.DeviceId);
|
|
|
|
ok(desc1.SubSysId == desc.SubSysId, "Got unexpected sub system ID %04x.\n", desc1.SubSysId);
|
|
|
|
ok(desc1.Revision == desc.Revision, "Got unexpected revision %02x.\n", desc1.Revision);
|
|
|
|
ok(desc1.DedicatedVideoMemory == desc.DedicatedVideoMemory,
|
|
|
|
"Got unexpected dedicated video memory %lu.\n", desc1.DedicatedVideoMemory);
|
|
|
|
ok(desc1.DedicatedSystemMemory == desc.DedicatedSystemMemory,
|
|
|
|
"Got unexpected dedicated system memory %lu.\n", desc1.DedicatedSystemMemory);
|
|
|
|
ok(desc1.SharedSystemMemory == desc.SharedSystemMemory,
|
|
|
|
"Got unexpected shared system memory %lu.\n", desc1.SharedSystemMemory);
|
|
|
|
ok(!memcmp(&desc.AdapterLuid, &desc1.AdapterLuid, sizeof(desc.AdapterLuid)),
|
|
|
|
"Got unexpected adapter LUID %08x:%08x.\n", desc1.AdapterLuid.HighPart, desc1.AdapterLuid.LowPart);
|
|
|
|
trace("Flags: %08x.\n", desc1.Flags);
|
|
|
|
|
|
|
|
IDXGIAdapter1_Release(adapter1);
|
|
|
|
|
|
|
|
done:
|
2009-12-04 11:50:50 +01:00
|
|
|
IDXGIAdapter_Release(adapter);
|
|
|
|
}
|
|
|
|
|
2009-01-16 10:14:24 +01:00
|
|
|
static void test_create_surface(IDXGIDevice *device)
|
|
|
|
{
|
|
|
|
ID3D10Texture2D *texture;
|
|
|
|
IDXGISurface *surface;
|
|
|
|
DXGI_SURFACE_DESC desc;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
desc.Width = 512;
|
|
|
|
desc.Height = 512;
|
|
|
|
desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
|
|
|
desc.SampleDesc.Count = 1;
|
|
|
|
desc.SampleDesc.Quality = 0;
|
|
|
|
|
|
|
|
hr = IDXGIDevice_CreateSurface(device, &desc, 1, DXGI_USAGE_RENDER_TARGET_OUTPUT, NULL, &surface);
|
|
|
|
ok(SUCCEEDED(hr), "Failed to create a dxgi surface, hr %#x\n", hr);
|
|
|
|
|
|
|
|
hr = IDXGISurface_QueryInterface(surface, &IID_ID3D10Texture2D, (void **)&texture);
|
2009-01-19 10:39:06 +01:00
|
|
|
ok(SUCCEEDED(hr), "Surface should implement ID3D10Texture2D\n");
|
2009-01-16 10:14:24 +01:00
|
|
|
if (SUCCEEDED(hr)) ID3D10Texture2D_Release(texture);
|
|
|
|
|
|
|
|
IDXGISurface_Release(surface);
|
|
|
|
}
|
|
|
|
|
2009-12-03 11:38:22 +01:00
|
|
|
static void test_parents(IDXGIDevice *device)
|
|
|
|
{
|
2009-12-07 11:08:40 +01:00
|
|
|
DXGI_SURFACE_DESC surface_desc;
|
|
|
|
IDXGISurface *surface;
|
2009-12-03 11:38:22 +01:00
|
|
|
IDXGIFactory *factory;
|
|
|
|
IDXGIAdapter *adapter;
|
|
|
|
IDXGIOutput *output;
|
|
|
|
IUnknown *parent;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2009-12-07 11:08:40 +01:00
|
|
|
surface_desc.Width = 512;
|
|
|
|
surface_desc.Height = 512;
|
|
|
|
surface_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
|
|
|
surface_desc.SampleDesc.Count = 1;
|
|
|
|
surface_desc.SampleDesc.Quality = 0;
|
|
|
|
|
|
|
|
hr = IDXGIDevice_CreateSurface(device, &surface_desc, 1, DXGI_USAGE_RENDER_TARGET_OUTPUT, NULL, &surface);
|
|
|
|
ok(SUCCEEDED(hr), "Failed to create a dxgi surface, hr %#x\n", hr);
|
|
|
|
|
|
|
|
hr = IDXGISurface_GetParent(surface, &IID_IDXGIDevice, (void **)&parent);
|
|
|
|
IDXGISurface_Release(surface);
|
|
|
|
ok(SUCCEEDED(hr), "GetParent failed, hr %#x.\n", hr);
|
|
|
|
ok(parent == (IUnknown *)device, "Got parent %p, expected %p.\n", parent, device);
|
|
|
|
IUnknown_Release(parent);
|
|
|
|
|
2009-12-03 11:38:22 +01:00
|
|
|
hr = IDXGIDevice_GetAdapter(device, &adapter);
|
|
|
|
ok(SUCCEEDED(hr), "GetAdapter failed, hr %#x.\n", hr);
|
|
|
|
|
|
|
|
hr = IDXGIAdapter_EnumOutputs(adapter, 0, &output);
|
|
|
|
if (hr == DXGI_ERROR_NOT_FOUND)
|
|
|
|
{
|
|
|
|
skip("Adapter has not outputs, skipping output tests.\n");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ok(SUCCEEDED(hr), "EnumOutputs failed, hr %#x.\n", hr);
|
|
|
|
|
|
|
|
hr = IDXGIOutput_GetParent(output, &IID_IDXGIAdapter, (void **)&parent);
|
|
|
|
IDXGIOutput_Release(output);
|
|
|
|
ok(SUCCEEDED(hr), "GetParent failed, hr %#x.\n", hr);
|
|
|
|
ok(parent == (IUnknown *)adapter, "Got parent %p, expected %p.\n", parent, adapter);
|
|
|
|
IUnknown_Release(parent);
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = IDXGIAdapter_GetParent(adapter, &IID_IDXGIFactory, (void **)&factory);
|
|
|
|
ok(SUCCEEDED(hr), "GetParent failed, hr %#x.\n", hr);
|
|
|
|
|
|
|
|
hr = IDXGIFactory_GetParent(factory, &IID_IUnknown, (void **)&parent);
|
|
|
|
ok(hr == E_NOINTERFACE, "GetParent returned %#x, expected %#x.\n", hr, E_NOINTERFACE);
|
|
|
|
ok(parent == NULL, "Got parent %p, expected %p.\n", parent, NULL);
|
|
|
|
IDXGIFactory_Release(factory);
|
|
|
|
|
|
|
|
hr = IDXGIDevice_GetParent(device, &IID_IDXGIAdapter, (void **)&parent);
|
|
|
|
ok(SUCCEEDED(hr), "GetParent failed, hr %#x.\n", hr);
|
|
|
|
ok(parent == (IUnknown *)adapter, "Got parent %p, expected %p.\n", parent, adapter);
|
|
|
|
IUnknown_Release(parent);
|
|
|
|
|
|
|
|
IDXGIAdapter_Release(adapter);
|
|
|
|
}
|
|
|
|
|
2011-05-16 11:52:33 +02:00
|
|
|
static void test_output(IDXGIDevice *device)
|
|
|
|
{
|
|
|
|
IDXGIAdapter *adapter;
|
|
|
|
HRESULT hr;
|
|
|
|
IDXGIOutput *output;
|
|
|
|
UINT mode_count, mode_count_comp, i;
|
|
|
|
DXGI_MODE_DESC *modes;
|
|
|
|
|
|
|
|
hr = IDXGIDevice_GetAdapter(device, &adapter);
|
|
|
|
ok(SUCCEEDED(hr), "GetAdapter failed, hr %#x.\n", hr);
|
|
|
|
|
|
|
|
hr = IDXGIAdapter_EnumOutputs(adapter, 0, &output);
|
|
|
|
if (hr == DXGI_ERROR_NOT_FOUND)
|
|
|
|
{
|
2014-02-10 10:37:53 +01:00
|
|
|
skip("Adapter doesn't have any outputs, skipping tests.\n");
|
2011-05-16 11:52:33 +02:00
|
|
|
IDXGIAdapter_Release(adapter);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok(SUCCEEDED(hr), "EnumOutputs failed, hr %#x.\n", hr);
|
|
|
|
|
2014-02-10 10:37:53 +01:00
|
|
|
hr = IDXGIOutput_GetDisplayModeList(output, DXGI_FORMAT_R8G8B8A8_UNORM, 0, NULL, NULL);
|
|
|
|
todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
|
2011-05-16 11:52:33 +02:00
|
|
|
|
2014-02-10 10:37:53 +01:00
|
|
|
hr = IDXGIOutput_GetDisplayModeList(output, DXGI_FORMAT_R8G8B8A8_UNORM, 0, &mode_count, NULL);
|
2014-02-10 10:37:54 +01:00
|
|
|
ok(SUCCEEDED(hr)
|
|
|
|
|| broken(hr == DXGI_ERROR_NOT_CURRENTLY_AVAILABLE), /* Remote Desktop Services / Win 7 testbot */
|
|
|
|
"Failed to list modes, hr %#x.\n", hr);
|
|
|
|
if (hr == DXGI_ERROR_NOT_CURRENTLY_AVAILABLE)
|
|
|
|
{
|
|
|
|
skip("GetDisplayModeList() not supported, skipping tests.\n");
|
|
|
|
IDXGIOutput_Release(output);
|
|
|
|
IDXGIAdapter_Release(adapter);
|
|
|
|
return;
|
|
|
|
}
|
2011-05-16 11:52:33 +02:00
|
|
|
mode_count_comp = mode_count;
|
|
|
|
|
2014-02-10 10:37:53 +01:00
|
|
|
hr = IDXGIOutput_GetDisplayModeList(output, 0, 0, &mode_count, NULL);
|
2011-05-16 11:52:33 +02:00
|
|
|
ok(SUCCEEDED(hr), "Failed to list modes, hr %#x.\n", hr);
|
2014-02-10 10:37:53 +01:00
|
|
|
ok(!mode_count, "Got unexpected mode_count %u.\n", mode_count);
|
2011-05-16 11:52:33 +02:00
|
|
|
|
2014-02-10 10:37:53 +01:00
|
|
|
hr = IDXGIOutput_GetDisplayModeList(output, DXGI_FORMAT_R8G8B8A8_UNORM,
|
|
|
|
DXGI_ENUM_MODES_SCALING, &mode_count, NULL);
|
2011-05-16 11:52:33 +02:00
|
|
|
ok(SUCCEEDED(hr), "Failed to list modes, hr %#x.\n", hr);
|
2014-02-10 10:37:53 +01:00
|
|
|
ok(mode_count >= mode_count_comp, "Got unexpected mode_count %u, expected >= %u.\n", mode_count, mode_count_comp);
|
2011-05-16 11:52:33 +02:00
|
|
|
mode_count_comp = mode_count;
|
|
|
|
|
2014-02-10 10:37:53 +01:00
|
|
|
modes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*modes) * (mode_count + 10));
|
2011-05-16 11:52:33 +02:00
|
|
|
|
2014-02-10 10:37:53 +01:00
|
|
|
hr = IDXGIOutput_GetDisplayModeList(output, DXGI_FORMAT_R8G8B8A8_UNORM,
|
|
|
|
DXGI_ENUM_MODES_SCALING, NULL, modes);
|
|
|
|
todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
|
|
|
|
ok(!modes[0].Height, "No output was expected.\n");
|
2011-05-16 11:52:33 +02:00
|
|
|
|
|
|
|
mode_count = 0;
|
2014-02-10 10:37:53 +01:00
|
|
|
hr = IDXGIOutput_GetDisplayModeList(output, DXGI_FORMAT_R8G8B8A8_UNORM,
|
|
|
|
DXGI_ENUM_MODES_SCALING, &mode_count, modes);
|
|
|
|
todo_wine ok(hr == DXGI_ERROR_MORE_DATA, "Got unexpected hr %#x.\n", hr);
|
|
|
|
ok(!modes[0].Height, "No output was expected.\n");
|
2011-05-16 11:52:33 +02:00
|
|
|
|
|
|
|
mode_count = mode_count_comp;
|
2014-02-10 10:37:53 +01:00
|
|
|
hr = IDXGIOutput_GetDisplayModeList(output, DXGI_FORMAT_R8G8B8A8_UNORM,
|
|
|
|
DXGI_ENUM_MODES_SCALING, &mode_count, modes);
|
2011-05-16 11:52:33 +02:00
|
|
|
ok(SUCCEEDED(hr), "Failed to list modes, hr %#x.\n", hr);
|
2014-02-10 10:37:53 +01:00
|
|
|
ok(mode_count == mode_count_comp, "Got unexpected mode_count %u, expected %u.\n", mode_count, mode_count_comp);
|
2011-05-16 11:52:33 +02:00
|
|
|
|
|
|
|
for (i = 0; i < mode_count; i++)
|
|
|
|
{
|
|
|
|
ok(modes[i].Height && modes[i].Width, "Proper mode was expected\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
mode_count += 5;
|
2014-02-10 10:37:53 +01:00
|
|
|
hr = IDXGIOutput_GetDisplayModeList(output, DXGI_FORMAT_R8G8B8A8_UNORM,
|
|
|
|
DXGI_ENUM_MODES_SCALING, &mode_count, modes);
|
2011-05-16 11:52:33 +02:00
|
|
|
ok(SUCCEEDED(hr), "Failed to list modes, hr %#x.\n", hr);
|
2014-02-10 10:37:53 +01:00
|
|
|
ok(mode_count == mode_count_comp, "Got unexpected mode_count %u, expected %u.\n", mode_count, mode_count_comp);
|
2011-05-16 11:52:33 +02:00
|
|
|
|
|
|
|
if (mode_count_comp)
|
|
|
|
{
|
|
|
|
mode_count = mode_count_comp - 1;
|
2014-02-10 10:37:53 +01:00
|
|
|
hr = IDXGIOutput_GetDisplayModeList(output, DXGI_FORMAT_R8G8B8A8_UNORM,
|
|
|
|
DXGI_ENUM_MODES_SCALING, &mode_count, modes);
|
|
|
|
todo_wine ok(hr == DXGI_ERROR_MORE_DATA, "Got unexpected hr %#x.\n", hr);
|
|
|
|
ok(mode_count == mode_count_comp - 1, "Got unexpected mode_count %u, expected %u.\n",
|
|
|
|
mode_count, mode_count_comp - 1);
|
2011-05-16 11:52:33 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-02-10 10:37:53 +01:00
|
|
|
skip("Not enough modes for test, skipping.\n");
|
2011-05-16 11:52:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, modes);
|
|
|
|
IDXGIOutput_Release(output);
|
|
|
|
IDXGIAdapter_Release(adapter);
|
|
|
|
}
|
|
|
|
|
2012-09-26 19:46:37 +02:00
|
|
|
struct refresh_rates
|
|
|
|
{
|
|
|
|
UINT numerator;
|
|
|
|
UINT denominator;
|
|
|
|
BOOL numerator_should_pass;
|
|
|
|
BOOL denominator_should_pass;
|
|
|
|
};
|
|
|
|
|
|
|
|
static void test_createswapchain(IDXGIDevice *device)
|
|
|
|
{
|
|
|
|
IUnknown *obj;
|
|
|
|
IDXGIAdapter *adapter;
|
|
|
|
IDXGIFactory *factory;
|
|
|
|
IDXGISwapChain *swapchain;
|
|
|
|
DXGI_SWAP_CHAIN_DESC creation_desc, result_desc;
|
|
|
|
HRESULT hr;
|
2013-10-16 09:46:57 +02:00
|
|
|
WNDCLASSA wc = {0};
|
2012-09-26 19:46:37 +02:00
|
|
|
UINT i;
|
|
|
|
|
|
|
|
const struct refresh_rates refresh_list[] =
|
|
|
|
{
|
|
|
|
{60, 60, FALSE, FALSE},
|
|
|
|
{60, 0, TRUE, FALSE},
|
|
|
|
{60, 1, TRUE, TRUE},
|
|
|
|
{ 0, 60, TRUE, FALSE},
|
|
|
|
{ 0, 0, TRUE, FALSE},
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-10-16 09:46:57 +02:00
|
|
|
wc.lpfnWndProc = DefWindowProcA;
|
2012-09-26 19:46:37 +02:00
|
|
|
wc.lpszClassName = "dxgi_test_wc";
|
|
|
|
|
2013-10-16 09:46:57 +02:00
|
|
|
RegisterClassA(&wc);
|
2012-09-26 19:46:37 +02:00
|
|
|
|
|
|
|
creation_desc.OutputWindow = 0;
|
|
|
|
creation_desc.BufferDesc.Width = 800;
|
|
|
|
creation_desc.BufferDesc.Height = 600;
|
|
|
|
creation_desc.BufferDesc.RefreshRate.Numerator = 60;
|
|
|
|
creation_desc.BufferDesc.RefreshRate.Denominator = 60;
|
|
|
|
creation_desc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
|
|
|
creation_desc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
|
|
|
|
creation_desc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
|
|
|
|
creation_desc.SampleDesc.Count = 1;
|
|
|
|
creation_desc.SampleDesc.Quality = 0;
|
|
|
|
creation_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
|
|
|
|
creation_desc.BufferCount = 1;
|
2013-10-16 09:46:57 +02:00
|
|
|
creation_desc.OutputWindow = CreateWindowA("dxgi_test_wc", "dxgi_test", 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
2012-09-26 19:46:37 +02:00
|
|
|
creation_desc.Windowed = TRUE;
|
|
|
|
creation_desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
|
|
|
|
creation_desc.Flags = 0;
|
|
|
|
|
|
|
|
hr = IDXGIDevice_QueryInterface(device, &IID_IUnknown, (void **)&obj);
|
|
|
|
ok(SUCCEEDED(hr), "IDXGIDevice does not implement IUnknown\n");
|
|
|
|
|
|
|
|
hr = IDXGIDevice_GetAdapter(device, &adapter);
|
|
|
|
ok(SUCCEEDED(hr), "GetAdapter failed, hr %#x.\n", hr);
|
|
|
|
|
|
|
|
hr = IDXGIAdapter_GetParent(adapter, &IID_IDXGIFactory, (void **)&factory);
|
|
|
|
ok(SUCCEEDED(hr), "GetParent failed, hr %#x.\n", hr);
|
|
|
|
|
|
|
|
hr = IDXGIFactory_CreateSwapChain(factory, obj, &creation_desc, &swapchain);
|
|
|
|
ok(SUCCEEDED(hr), "CreateSwapChain failed, hr %#x.\n", hr);
|
|
|
|
|
|
|
|
hr = IDXGISwapChain_GetDesc(swapchain, NULL);
|
|
|
|
ok(hr == E_INVALIDARG, "GetDesc unexpectedly returned %#x.\n", hr);
|
|
|
|
|
|
|
|
IDXGISwapChain_Release(swapchain);
|
|
|
|
|
|
|
|
for (i = 0; i < sizeof(refresh_list)/sizeof(refresh_list[0]); i++)
|
|
|
|
{
|
|
|
|
creation_desc.BufferDesc.RefreshRate.Numerator = refresh_list[i].numerator;
|
|
|
|
creation_desc.BufferDesc.RefreshRate.Denominator = refresh_list[i].denominator;
|
|
|
|
|
|
|
|
hr = IDXGIFactory_CreateSwapChain(factory, obj, &creation_desc, &swapchain);
|
|
|
|
ok(SUCCEEDED(hr), "CreateSwapChain failed, hr %#x.\n", hr);
|
|
|
|
|
|
|
|
hr = IDXGISwapChain_GetDesc(swapchain, &result_desc);
|
|
|
|
ok(SUCCEEDED(hr), "GetDesc failed, hr %#x.\n", hr);
|
|
|
|
|
|
|
|
if (refresh_list[i].numerator_should_pass)
|
|
|
|
ok(result_desc.BufferDesc.RefreshRate.Numerator == refresh_list[i].numerator,
|
|
|
|
"Numerator %u is %u.\n", i, result_desc.BufferDesc.RefreshRate.Numerator);
|
|
|
|
else
|
|
|
|
todo_wine ok(result_desc.BufferDesc.RefreshRate.Numerator == refresh_list[i].numerator,
|
|
|
|
"Numerator %u is %u.\n", i, result_desc.BufferDesc.RefreshRate.Numerator);
|
|
|
|
|
|
|
|
if (refresh_list[i].denominator_should_pass)
|
|
|
|
ok(result_desc.BufferDesc.RefreshRate.Denominator == refresh_list[i].denominator,
|
|
|
|
"Denominator %u is %u.\n", i ,result_desc.BufferDesc.RefreshRate.Denominator);
|
|
|
|
else
|
|
|
|
todo_wine ok(result_desc.BufferDesc.RefreshRate.Denominator == refresh_list[i].denominator,
|
|
|
|
"Denominator %u is %u.\n", i, result_desc.BufferDesc.RefreshRate.Denominator);
|
|
|
|
|
|
|
|
IDXGISwapChain_Release(swapchain);
|
|
|
|
}
|
|
|
|
|
|
|
|
creation_desc.Windowed = FALSE;
|
|
|
|
|
|
|
|
for (i = 0; i < sizeof(refresh_list)/sizeof(refresh_list[0]); i++)
|
|
|
|
{
|
|
|
|
creation_desc.BufferDesc.RefreshRate.Numerator = refresh_list[i].numerator;
|
|
|
|
creation_desc.BufferDesc.RefreshRate.Denominator = refresh_list[i].denominator;
|
|
|
|
|
|
|
|
hr = IDXGIFactory_CreateSwapChain(factory, obj, &creation_desc, &swapchain);
|
|
|
|
ok(SUCCEEDED(hr), "CreateSwapChain failed, hr %#x.\n", hr);
|
|
|
|
|
|
|
|
hr = IDXGISwapChain_GetDesc(swapchain, &result_desc);
|
|
|
|
ok(SUCCEEDED(hr), "GetDesc failed, hr %#x.\n", hr);
|
|
|
|
|
|
|
|
if (refresh_list[i].numerator_should_pass)
|
|
|
|
ok(result_desc.BufferDesc.RefreshRate.Numerator == refresh_list[i].numerator,
|
|
|
|
"Numerator %u is %u.\n", i, result_desc.BufferDesc.RefreshRate.Numerator);
|
|
|
|
else
|
|
|
|
todo_wine ok(result_desc.BufferDesc.RefreshRate.Numerator == refresh_list[i].numerator,
|
|
|
|
"Numerator %u is %u.\n", i, result_desc.BufferDesc.RefreshRate.Numerator);
|
|
|
|
|
|
|
|
if (refresh_list[i].denominator_should_pass)
|
|
|
|
ok(result_desc.BufferDesc.RefreshRate.Denominator == refresh_list[i].denominator,
|
|
|
|
"Denominator %u is %u.\n", i ,result_desc.BufferDesc.RefreshRate.Denominator);
|
|
|
|
else
|
|
|
|
todo_wine ok(result_desc.BufferDesc.RefreshRate.Denominator == refresh_list[i].denominator,
|
|
|
|
"Denominator %u is %u.\n", i, result_desc.BufferDesc.RefreshRate.Denominator);
|
|
|
|
|
|
|
|
hr = IDXGISwapChain_SetFullscreenState(swapchain, FALSE, NULL);
|
|
|
|
todo_wine ok(SUCCEEDED(hr), "SetFullscreenState failed, hr %#x.\n", hr);
|
|
|
|
|
|
|
|
IDXGISwapChain_Release(swapchain);
|
|
|
|
}
|
|
|
|
|
|
|
|
IDXGIFactory_Release(factory);
|
|
|
|
IDXGIAdapter_Release(adapter);
|
|
|
|
IUnknown_Release(obj);
|
|
|
|
}
|
|
|
|
|
2008-11-18 09:27:58 +01:00
|
|
|
START_TEST(device)
|
|
|
|
{
|
|
|
|
IDXGIDevice *device;
|
|
|
|
ULONG refcount;
|
|
|
|
|
2014-02-10 10:37:54 +01:00
|
|
|
if (!(device = create_device()))
|
2008-11-18 09:27:58 +01:00
|
|
|
{
|
|
|
|
skip("Failed to create device, skipping tests\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-12-04 11:50:50 +01:00
|
|
|
test_adapter_desc(device);
|
2008-11-18 09:27:58 +01:00
|
|
|
test_device_interfaces(device);
|
2009-01-16 10:14:24 +01:00
|
|
|
test_create_surface(device);
|
2009-12-03 11:38:22 +01:00
|
|
|
test_parents(device);
|
2011-05-16 11:52:33 +02:00
|
|
|
test_output(device);
|
2012-09-26 19:46:37 +02:00
|
|
|
test_createswapchain(device);
|
2008-11-18 09:27:58 +01:00
|
|
|
|
|
|
|
refcount = IDXGIDevice_Release(device);
|
|
|
|
ok(!refcount, "Device has %u references left\n", refcount);
|
|
|
|
}
|