mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
tests: Add command-line option to force WARP device.
This commit is contained in:
parent
6c237a91f6
commit
bdee037a1c
@ -47,7 +47,9 @@ typedef int HRESULT;
|
||||
#define WIDL_C_INLINE_WRAPPERS
|
||||
#include "d3d12.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#ifdef _WIN32
|
||||
# include "dxgi1_4.h"
|
||||
#else
|
||||
# include <pthread.h>
|
||||
# include "vkd3d_utils.h"
|
||||
#endif
|
||||
@ -911,11 +913,44 @@ static void check_sub_resource_vec4_(unsigned int line, ID3D12Resource *texture,
|
||||
got.x, got.y, got.z, got.w, expected->x, expected->y, expected->z, expected->w, x, y);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
static IUnknown *create_warp_adapter(void)
|
||||
{
|
||||
IDXGIFactory4 *factory;
|
||||
IUnknown *adapter;
|
||||
HRESULT hr;
|
||||
|
||||
hr = CreateDXGIFactory1(&IID_IDXGIFactory4, (void **)&factory);
|
||||
ok(SUCCEEDED(hr), "Failed to create IDXGIFactory4, hr %#x.\n", hr);
|
||||
|
||||
adapter = NULL;
|
||||
hr = IDXGIFactory4_EnumWarpAdapter(factory, &IID_IUnknown, (void **)&adapter);
|
||||
IDXGIFactory4_Release(factory);
|
||||
if (FAILED(hr))
|
||||
trace("Failed to get WARP adapter, hr %#x.\n", hr);
|
||||
return adapter;
|
||||
}
|
||||
#else
|
||||
static IUnknown *create_warp_adapter(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool use_warp_device;
|
||||
|
||||
static ID3D12Device *create_device(void)
|
||||
{
|
||||
IUnknown *adapter = NULL;
|
||||
ID3D12Device *device;
|
||||
|
||||
if (FAILED(D3D12CreateDevice(NULL, D3D_FEATURE_LEVEL_11_0, &IID_ID3D12Device, (void **)&device)))
|
||||
if (use_warp_device && !(adapter = create_warp_adapter()))
|
||||
{
|
||||
trace("Failed to create WARP device.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (FAILED(D3D12CreateDevice(adapter, D3D_FEATURE_LEVEL_11_0, &IID_ID3D12Device, (void **)&device)))
|
||||
return NULL;
|
||||
|
||||
return device;
|
||||
@ -929,7 +964,7 @@ static bool is_min_max_filtering_supported(ID3D12Device *device)
|
||||
if (FAILED(hr = ID3D12Device_CheckFeatureSupport(device,
|
||||
D3D12_FEATURE_D3D12_OPTIONS, &options, sizeof(options))))
|
||||
{
|
||||
trace("CheckFeatureSupport failed, hr %#x.\n", hr);
|
||||
trace("Failed to check feature support, hr %#x.\n", hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -8900,11 +8935,17 @@ static void test_cs_uav_store(void)
|
||||
|
||||
START_TEST(d3d12)
|
||||
{
|
||||
BOOL enable_debug_layer = FALSE;
|
||||
bool enable_debug_layer = false;
|
||||
ID3D12Debug *debug;
|
||||
unsigned int i;
|
||||
|
||||
if (argc >= 2 && !strcmp(argv[1], "--validate"))
|
||||
enable_debug_layer = TRUE;
|
||||
for (i = 1; i < argc; ++i)
|
||||
{
|
||||
if (!strcmp(argv[i], "--validate"))
|
||||
enable_debug_layer = true;
|
||||
else if (!strcmp(argv[i], "--warp"))
|
||||
use_warp_device = true;
|
||||
}
|
||||
|
||||
if (enable_debug_layer && SUCCEEDED(D3D12GetDebugInterface(&IID_ID3D12Debug, (void **)&debug)))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user