2016-09-21 03:57:24 -07:00
|
|
|
/*
|
|
|
|
* Copyright 2016 Józef Kucia for CodeWeavers
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
* DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/* Hack for MinGW-w64 headers.
|
|
|
|
*
|
|
|
|
* We want to use WIDL C inline wrappers because some methods
|
|
|
|
* in D3D12 interfaces return aggregate objects. Unfortunately,
|
|
|
|
* WIDL C inline wrappers are broken when used with MinGW-w64
|
|
|
|
* headers because FORCEINLINE expands to extern inline
|
|
|
|
* which leads to the "multiple storage classes in declaration
|
|
|
|
* specifiers" compiler error.
|
|
|
|
*/
|
|
|
|
#ifdef __MINGW32__
|
2016-09-21 03:57:24 -07:00
|
|
|
# include <_mingw.h>
|
2016-09-21 03:57:24 -07:00
|
|
|
# ifdef __MINGW64_VERSION_MAJOR
|
|
|
|
# undef __forceinline
|
|
|
|
# define __forceinline __inline__ __attribute__((__always_inline__,__gnu_inline__))
|
|
|
|
# endif
|
2016-09-21 03:57:24 -07:00
|
|
|
|
|
|
|
# define _HRESULT_DEFINED
|
|
|
|
typedef int HRESULT;
|
2016-09-21 03:57:24 -07:00
|
|
|
#endif
|
|
|
|
|
2016-09-21 03:57:24 -07:00
|
|
|
#define INITGUID
|
2016-09-21 03:57:24 -07:00
|
|
|
#define COBJMACROS
|
2016-09-21 03:57:24 -07:00
|
|
|
#include "vkd3d_test.h"
|
|
|
|
#include "vkd3d_windows.h"
|
|
|
|
|
2016-09-21 03:57:24 -07:00
|
|
|
#define WIDL_C_INLINE_WRAPPERS
|
|
|
|
#include "d3d12.h"
|
|
|
|
|
2016-09-21 06:02:13 -07:00
|
|
|
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*x))
|
|
|
|
|
2016-09-21 06:14:01 -07:00
|
|
|
#define get_refcount(a) get_refcount_((IUnknown *)a)
|
|
|
|
static ULONG get_refcount_(IUnknown *iface)
|
|
|
|
{
|
|
|
|
IUnknown_AddRef(iface);
|
|
|
|
return IUnknown_Release(iface);
|
|
|
|
}
|
|
|
|
|
2016-09-21 03:57:24 -07:00
|
|
|
#define check_interface(a, b, c) check_interface_(__LINE__, (IUnknown *)a, b, c)
|
|
|
|
static void check_interface_(unsigned int line, IUnknown *iface, REFIID riid, BOOL supported)
|
|
|
|
{
|
|
|
|
HRESULT hr, expected_hr;
|
|
|
|
IUnknown *unk;
|
|
|
|
|
|
|
|
expected_hr = supported ? S_OK : E_NOINTERFACE;
|
|
|
|
|
|
|
|
hr = IUnknown_QueryInterface(iface, riid, (void **)&unk);
|
|
|
|
ok_(line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
IUnknown_Release(unk);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ID3D12Device *create_device(void)
|
|
|
|
{
|
|
|
|
ID3D12Device *device;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
if (FAILED(hr = D3D12CreateDevice(NULL, D3D_FEATURE_LEVEL_11_0, &IID_ID3D12Device, (void **)&device)))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return device;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_create_device(void)
|
|
|
|
{
|
|
|
|
ID3D12Device *device;
|
|
|
|
ULONG refcount;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
if (!(device = create_device()))
|
|
|
|
{
|
|
|
|
skip("Failed to create device.\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
check_interface(device, &IID_ID3D12Object, TRUE);
|
|
|
|
check_interface(device, &IID_ID3D12DeviceChild, FALSE);
|
|
|
|
check_interface(device, &IID_ID3D12Pageable, FALSE);
|
|
|
|
check_interface(device, &IID_ID3D12Device, TRUE);
|
|
|
|
|
|
|
|
refcount = ID3D12Device_Release(device);
|
2016-09-21 03:57:24 -07:00
|
|
|
ok(!refcount, "ID3D12Device has %u references left.\n", (unsigned int)refcount);
|
2016-09-21 03:57:24 -07:00
|
|
|
|
|
|
|
hr = D3D12CreateDevice(NULL, D3D_FEATURE_LEVEL_11_0, &IID_ID3D12Device, (void **)&device);
|
|
|
|
ok(hr == S_OK, "D3D12CreateDevice failed, hr %#x.\n", hr);
|
|
|
|
ID3D12Device_Release(device);
|
|
|
|
|
|
|
|
hr = D3D12CreateDevice(NULL, D3D_FEATURE_LEVEL_9_1, &IID_ID3D12Device, (void **)&device);
|
|
|
|
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
|
|
|
hr = D3D12CreateDevice(NULL, D3D_FEATURE_LEVEL_9_2, &IID_ID3D12Device, (void **)&device);
|
|
|
|
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
|
|
|
hr = D3D12CreateDevice(NULL, D3D_FEATURE_LEVEL_9_3, &IID_ID3D12Device, (void **)&device);
|
|
|
|
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
|
|
|
hr = D3D12CreateDevice(NULL, D3D_FEATURE_LEVEL_10_0, &IID_ID3D12Device, (void **)&device);
|
|
|
|
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
|
|
|
hr = D3D12CreateDevice(NULL, D3D_FEATURE_LEVEL_10_1, &IID_ID3D12Device, (void **)&device);
|
|
|
|
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
|
|
|
|
|
|
|
hr = D3D12CreateDevice(NULL, 0, &IID_ID3D12Device, (void **)&device);
|
|
|
|
ok(hr == E_INVALIDARG, "D3D12CreateDevice failed, hr %#x.\n", hr);
|
|
|
|
hr = D3D12CreateDevice(NULL, ~0u, &IID_ID3D12Device, (void **)&device);
|
|
|
|
ok(hr == E_INVALIDARG, "D3D12CreateDevice failed, hr %#x.\n", hr);
|
|
|
|
}
|
|
|
|
|
2016-09-21 05:51:48 -07:00
|
|
|
static void test_node_count(void)
|
|
|
|
{
|
|
|
|
ID3D12Device *device;
|
|
|
|
UINT node_count;
|
|
|
|
ULONG refcount;
|
|
|
|
|
|
|
|
if (!(device = create_device()))
|
|
|
|
{
|
|
|
|
skip("Failed to create device.\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
node_count = ID3D12Device_GetNodeCount(device);
|
|
|
|
trace("Node count: %u.\n", node_count);
|
|
|
|
ok(1 <= node_count && node_count <= 32, "Got unexpected node count %u.\n", node_count);
|
|
|
|
|
|
|
|
refcount = ID3D12Device_Release(device);
|
|
|
|
ok(!refcount, "ID3D12Device has %u references left.\n", (unsigned int)refcount);
|
|
|
|
}
|
|
|
|
|
2016-09-21 06:02:13 -07:00
|
|
|
static void test_check_feature_support(void)
|
|
|
|
{
|
|
|
|
D3D12_FEATURE_DATA_FEATURE_LEVELS feature_levels;
|
|
|
|
D3D_FEATURE_LEVEL max_supported_feature_level;
|
|
|
|
ID3D12Device *device;
|
|
|
|
ULONG refcount;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
static const D3D_FEATURE_LEVEL all_feature_levels[] =
|
|
|
|
{
|
|
|
|
D3D_FEATURE_LEVEL_12_1,
|
|
|
|
D3D_FEATURE_LEVEL_12_0,
|
|
|
|
D3D_FEATURE_LEVEL_11_1,
|
|
|
|
D3D_FEATURE_LEVEL_11_0,
|
|
|
|
D3D_FEATURE_LEVEL_10_1,
|
|
|
|
D3D_FEATURE_LEVEL_10_0,
|
|
|
|
D3D_FEATURE_LEVEL_9_3,
|
|
|
|
D3D_FEATURE_LEVEL_9_2,
|
|
|
|
D3D_FEATURE_LEVEL_9_1,
|
|
|
|
};
|
|
|
|
static const D3D_FEATURE_LEVEL d3d12_feature_levels[] =
|
|
|
|
{
|
|
|
|
D3D_FEATURE_LEVEL_12_1,
|
|
|
|
D3D_FEATURE_LEVEL_12_0,
|
|
|
|
D3D_FEATURE_LEVEL_11_1,
|
|
|
|
D3D_FEATURE_LEVEL_11_0,
|
|
|
|
};
|
|
|
|
static const D3D_FEATURE_LEVEL d3d_9_x_feature_levels[] =
|
|
|
|
{
|
|
|
|
D3D_FEATURE_LEVEL_9_3,
|
|
|
|
D3D_FEATURE_LEVEL_9_2,
|
|
|
|
D3D_FEATURE_LEVEL_9_1,
|
|
|
|
};
|
|
|
|
static const D3D_FEATURE_LEVEL invalid_feature_levels[] =
|
|
|
|
{
|
|
|
|
0x0000,
|
|
|
|
0x3000,
|
|
|
|
};
|
|
|
|
|
|
|
|
if (!(device = create_device()))
|
|
|
|
{
|
|
|
|
skip("Failed to create device.\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Feature levels */
|
|
|
|
memset(&feature_levels, 0, sizeof(feature_levels));
|
|
|
|
hr = ID3D12Device_CheckFeatureSupport(device, D3D12_FEATURE_FEATURE_LEVELS,
|
|
|
|
&feature_levels, sizeof(feature_levels));
|
|
|
|
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
|
|
|
|
|
|
|
feature_levels.NumFeatureLevels = ARRAY_SIZE(all_feature_levels);
|
|
|
|
feature_levels.pFeatureLevelsRequested = all_feature_levels;
|
|
|
|
feature_levels.MaxSupportedFeatureLevel = 0;
|
|
|
|
hr = ID3D12Device_CheckFeatureSupport(device, D3D12_FEATURE_FEATURE_LEVELS,
|
|
|
|
&feature_levels, sizeof(feature_levels));
|
|
|
|
ok(SUCCEEDED(hr), "CheckFeatureSupport failed, hr %#x.\n", hr);
|
|
|
|
trace("Max supported feature level %#x.\n", feature_levels.MaxSupportedFeatureLevel);
|
|
|
|
max_supported_feature_level = feature_levels.MaxSupportedFeatureLevel;
|
|
|
|
|
|
|
|
feature_levels.NumFeatureLevels = ARRAY_SIZE(d3d12_feature_levels);
|
|
|
|
feature_levels.pFeatureLevelsRequested = d3d12_feature_levels;
|
|
|
|
feature_levels.MaxSupportedFeatureLevel = 0;
|
|
|
|
hr = ID3D12Device_CheckFeatureSupport(device, D3D12_FEATURE_FEATURE_LEVELS,
|
|
|
|
&feature_levels, sizeof(feature_levels));
|
|
|
|
ok(SUCCEEDED(hr), "CheckFeatureSupport failed, hr %#x.\n", hr);
|
|
|
|
ok(feature_levels.MaxSupportedFeatureLevel == max_supported_feature_level,
|
|
|
|
"Got unexpected feature level %#x, expected %#x.\n",
|
|
|
|
feature_levels.MaxSupportedFeatureLevel, max_supported_feature_level);
|
|
|
|
|
|
|
|
/* Check invalid size. */
|
|
|
|
hr = ID3D12Device_CheckFeatureSupport(device, D3D12_FEATURE_FEATURE_LEVELS,
|
|
|
|
&feature_levels, sizeof(feature_levels) + 1);
|
|
|
|
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
|
|
|
hr = ID3D12Device_CheckFeatureSupport(device, D3D12_FEATURE_FEATURE_LEVELS,
|
|
|
|
&feature_levels, sizeof(feature_levels) - 1);
|
|
|
|
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
|
|
|
|
|
|
|
feature_levels.NumFeatureLevels = ARRAY_SIZE(d3d_9_x_feature_levels);
|
|
|
|
feature_levels.pFeatureLevelsRequested = d3d_9_x_feature_levels;
|
|
|
|
feature_levels.MaxSupportedFeatureLevel = 0;
|
|
|
|
hr = ID3D12Device_CheckFeatureSupport(device, D3D12_FEATURE_FEATURE_LEVELS,
|
|
|
|
&feature_levels, sizeof(feature_levels));
|
|
|
|
ok(SUCCEEDED(hr), "CheckFeatureSupport failed, hr %#x.\n", hr);
|
|
|
|
ok(feature_levels.MaxSupportedFeatureLevel == D3D_FEATURE_LEVEL_9_3,
|
|
|
|
"Got unexpected max feature level %#x.\n", feature_levels.MaxSupportedFeatureLevel);
|
|
|
|
|
|
|
|
feature_levels.NumFeatureLevels = ARRAY_SIZE(invalid_feature_levels);
|
|
|
|
feature_levels.pFeatureLevelsRequested = invalid_feature_levels;
|
|
|
|
feature_levels.MaxSupportedFeatureLevel = 0;
|
|
|
|
hr = ID3D12Device_CheckFeatureSupport(device, D3D12_FEATURE_FEATURE_LEVELS,
|
|
|
|
&feature_levels, sizeof(feature_levels));
|
|
|
|
ok(SUCCEEDED(hr), "CheckFeatureSupport failed, hr %#x.\n", hr);
|
|
|
|
ok(feature_levels.MaxSupportedFeatureLevel == 0x3000,
|
|
|
|
"Got unexpected max feature level %#x.\n", feature_levels.MaxSupportedFeatureLevel);
|
|
|
|
|
|
|
|
refcount = ID3D12Device_Release(device);
|
|
|
|
ok(!refcount, "ID3D12Device has %u references left.\n", (unsigned int)refcount);
|
|
|
|
}
|
|
|
|
|
2016-09-21 06:44:19 -07:00
|
|
|
static void test_create_command_allocator(void)
|
|
|
|
{
|
|
|
|
ID3D12CommandAllocator *command_allocator;
|
|
|
|
ID3D12Device *device, *tmp_device;
|
|
|
|
ULONG refcount;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
if (!(device = create_device()))
|
|
|
|
{
|
|
|
|
skip("Failed to create device.\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = ID3D12Device_CreateCommandAllocator(device, D3D12_COMMAND_LIST_TYPE_DIRECT,
|
|
|
|
&IID_ID3D12CommandAllocator, (void **)&command_allocator);
|
|
|
|
ok(SUCCEEDED(hr), "CreateCommandAllocator failed, hr %#x.\n", hr);
|
|
|
|
|
|
|
|
refcount = get_refcount(device);
|
|
|
|
ok(refcount == 2, "Got unexpected refcount %u.\n", (unsigned int)refcount);
|
|
|
|
hr = ID3D12CommandAllocator_GetDevice(command_allocator, &IID_ID3D12Device, (void **)&tmp_device);
|
|
|
|
ok(SUCCEEDED(hr), "GetDevice failed, hr %#x.\n", hr);
|
|
|
|
refcount = get_refcount(device);
|
|
|
|
ok(refcount == 3, "Got unexpected refcount %u.\n", (unsigned int)refcount);
|
|
|
|
refcount = ID3D12Device_Release(tmp_device);
|
|
|
|
ok(refcount == 2, "Got unexpected refcount %u.\n", (unsigned int)refcount);
|
|
|
|
|
|
|
|
check_interface(command_allocator, &IID_ID3D12Object, TRUE);
|
|
|
|
check_interface(command_allocator, &IID_ID3D12DeviceChild, TRUE);
|
|
|
|
check_interface(command_allocator, &IID_ID3D12Pageable, TRUE);
|
|
|
|
check_interface(command_allocator, &IID_ID3D12CommandAllocator, TRUE);
|
|
|
|
|
|
|
|
refcount = ID3D12CommandAllocator_Release(command_allocator);
|
|
|
|
ok(!refcount, "ID3D12CommandAllocator has %u references left.\n", (unsigned int)refcount);
|
|
|
|
|
|
|
|
hr = ID3D12Device_CreateCommandAllocator(device, D3D12_COMMAND_LIST_TYPE_BUNDLE,
|
|
|
|
&IID_ID3D12CommandAllocator, (void **)&command_allocator);
|
|
|
|
ok(SUCCEEDED(hr), "CreateCommandAllocator failed, hr %#x.\n", hr);
|
|
|
|
refcount = ID3D12CommandAllocator_Release(command_allocator);
|
|
|
|
ok(!refcount, "ID3D12CommandAllocator has %u references left.\n", (unsigned int)refcount);
|
|
|
|
|
|
|
|
hr = ID3D12Device_CreateCommandAllocator(device, D3D12_COMMAND_LIST_TYPE_COMPUTE,
|
|
|
|
&IID_ID3D12CommandAllocator, (void **)&command_allocator);
|
|
|
|
ok(SUCCEEDED(hr), "CreateCommandAllocator failed, hr %#x.\n", hr);
|
|
|
|
refcount = ID3D12CommandAllocator_Release(command_allocator);
|
|
|
|
ok(!refcount, "ID3D12CommandAllocator has %u references left.\n", (unsigned int)refcount);
|
|
|
|
|
|
|
|
hr = ID3D12Device_CreateCommandAllocator(device, D3D12_COMMAND_LIST_TYPE_COPY,
|
|
|
|
&IID_ID3D12CommandAllocator, (void **)&command_allocator);
|
|
|
|
ok(SUCCEEDED(hr), "CreateCommandAllocator failed, hr %#x.\n", hr);
|
|
|
|
refcount = ID3D12CommandAllocator_Release(command_allocator);
|
|
|
|
ok(!refcount, "ID3D12CommandAllocator has %u references left.\n", (unsigned int)refcount);
|
|
|
|
|
|
|
|
hr = ID3D12Device_CreateCommandAllocator(device, ~0u,
|
|
|
|
&IID_ID3D12CommandAllocator, (void **)&command_allocator);
|
|
|
|
ok(hr == E_INVALIDARG, "CreateCommandAllocator failed, hr %#x.\n", hr);
|
|
|
|
|
|
|
|
refcount = ID3D12Device_Release(device);
|
|
|
|
ok(!refcount, "ID3D12Device has %u references left.\n", (unsigned int)refcount);
|
|
|
|
}
|
|
|
|
|
2016-09-21 07:25:51 -07:00
|
|
|
static void test_create_command_list(void)
|
|
|
|
{
|
|
|
|
ID3D12CommandAllocator *command_allocator;
|
|
|
|
ID3D12Device *device, *tmp_device;
|
|
|
|
ID3D12CommandList *command_list;
|
|
|
|
ULONG refcount;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
if (!(device = create_device()))
|
|
|
|
{
|
|
|
|
skip("Failed to create device.\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = ID3D12Device_CreateCommandList(device, 0, D3D12_COMMAND_LIST_TYPE_DIRECT,
|
|
|
|
NULL, NULL, &IID_ID3D12CommandList, (void **)&command_list);
|
|
|
|
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
|
|
|
|
|
|
|
hr = ID3D12Device_CreateCommandAllocator(device, D3D12_COMMAND_LIST_TYPE_DIRECT,
|
|
|
|
&IID_ID3D12CommandAllocator, (void **)&command_allocator);
|
|
|
|
ok(SUCCEEDED(hr), "CreateCommandAllocator failed, hr %#x.\n", hr);
|
|
|
|
|
|
|
|
refcount = get_refcount(device);
|
|
|
|
ok(refcount == 2, "Got unexpected refcount %u.\n", (unsigned int)refcount);
|
|
|
|
|
|
|
|
hr = ID3D12Device_CreateCommandList(device, 0, D3D12_COMMAND_LIST_TYPE_DIRECT,
|
|
|
|
command_allocator, NULL, &IID_ID3D12CommandList, (void **)&command_list);
|
|
|
|
ok(SUCCEEDED(hr), "CreateCommandList failed, hr %#x.\n", hr);
|
|
|
|
|
|
|
|
refcount = get_refcount(command_allocator);
|
|
|
|
ok(refcount == 1, "Got unexpected refcount %u.\n", (unsigned int)refcount);
|
|
|
|
|
|
|
|
refcount = get_refcount(device);
|
|
|
|
ok(refcount == 3, "Got unexpected refcount %u.\n", (unsigned int)refcount);
|
|
|
|
hr = ID3D12CommandList_GetDevice(command_list, &IID_ID3D12Device, (void **)&tmp_device);
|
|
|
|
ok(SUCCEEDED(hr), "GetDevice failed, hr %#x.\n", hr);
|
|
|
|
refcount = get_refcount(device);
|
|
|
|
ok(refcount == 4, "Got unexpected refcount %u.\n", (unsigned int)refcount);
|
|
|
|
refcount = ID3D12Device_Release(tmp_device);
|
|
|
|
ok(refcount == 3, "Got unexpected refcount %u.\n", (unsigned int)refcount);
|
|
|
|
|
|
|
|
check_interface(command_list, &IID_ID3D12Object, TRUE);
|
|
|
|
check_interface(command_list, &IID_ID3D12DeviceChild, TRUE);
|
|
|
|
check_interface(command_list, &IID_ID3D12Pageable, FALSE);
|
|
|
|
check_interface(command_list, &IID_ID3D12CommandList, TRUE);
|
|
|
|
check_interface(command_list, &IID_ID3D12GraphicsCommandList, TRUE);
|
|
|
|
check_interface(command_list, &IID_ID3D12CommandAllocator, FALSE);
|
|
|
|
|
|
|
|
refcount = ID3D12CommandList_Release(command_list);
|
|
|
|
ok(!refcount, "ID3D12CommandList has %u references left.\n", (unsigned int)refcount);
|
|
|
|
refcount = ID3D12CommandAllocator_Release(command_allocator);
|
|
|
|
ok(!refcount, "ID3D12CommandAllocator has %u references left.\n", (unsigned int)refcount);
|
|
|
|
|
|
|
|
hr = ID3D12Device_CreateCommandAllocator(device, D3D12_COMMAND_LIST_TYPE_BUNDLE,
|
|
|
|
&IID_ID3D12CommandAllocator, (void **)&command_allocator);
|
|
|
|
ok(SUCCEEDED(hr), "CreateCommandAllocator failed, hr %#x.\n", hr);
|
|
|
|
hr = ID3D12Device_CreateCommandList(device, 0, D3D12_COMMAND_LIST_TYPE_DIRECT,
|
|
|
|
command_allocator, NULL, &IID_ID3D12CommandList, (void **)&command_list);
|
|
|
|
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
|
|
|
hr = ID3D12Device_CreateCommandList(device, 0, D3D12_COMMAND_LIST_TYPE_BUNDLE,
|
|
|
|
command_allocator, NULL, &IID_ID3D12CommandList, (void **)&command_list);
|
|
|
|
ok(SUCCEEDED(hr), "CreateCommandList failed, hr %#x.\n", hr);
|
|
|
|
check_interface(command_list, &IID_ID3D12GraphicsCommandList, TRUE);
|
|
|
|
refcount = ID3D12CommandList_Release(command_list);
|
|
|
|
ok(!refcount, "ID3D12CommandList has %u references left.\n", (unsigned int)refcount);
|
|
|
|
refcount = ID3D12CommandAllocator_Release(command_allocator);
|
|
|
|
ok(!refcount, "ID3D12CommandAllocator has %u references left.\n", (unsigned int)refcount);
|
|
|
|
|
|
|
|
hr = ID3D12Device_CreateCommandAllocator(device, D3D12_COMMAND_LIST_TYPE_COMPUTE,
|
|
|
|
&IID_ID3D12CommandAllocator, (void **)&command_allocator);
|
|
|
|
ok(SUCCEEDED(hr), "CreateCommandAllocator failed, hr %#x.\n", hr);
|
|
|
|
hr = ID3D12Device_CreateCommandList(device, 0, D3D12_COMMAND_LIST_TYPE_BUNDLE,
|
|
|
|
command_allocator, NULL, &IID_ID3D12CommandList, (void **)&command_list);
|
|
|
|
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
|
|
|
hr = ID3D12Device_CreateCommandList(device, 0, D3D12_COMMAND_LIST_TYPE_COMPUTE,
|
|
|
|
command_allocator, NULL, &IID_ID3D12CommandList, (void **)&command_list);
|
|
|
|
ok(SUCCEEDED(hr), "CreateCommandList failed, hr %#x.\n", hr);
|
|
|
|
check_interface(command_list, &IID_ID3D12GraphicsCommandList, TRUE);
|
|
|
|
refcount = ID3D12CommandList_Release(command_list);
|
|
|
|
ok(!refcount, "ID3D12CommandList has %u references left.\n", (unsigned int)refcount);
|
|
|
|
refcount = ID3D12CommandAllocator_Release(command_allocator);
|
|
|
|
ok(!refcount, "ID3D12CommandAllocator has %u references left.\n", (unsigned int)refcount);
|
|
|
|
|
|
|
|
hr = ID3D12Device_CreateCommandAllocator(device, D3D12_COMMAND_LIST_TYPE_COPY,
|
|
|
|
&IID_ID3D12CommandAllocator, (void **)&command_allocator);
|
|
|
|
ok(SUCCEEDED(hr), "CreateCommandAllocator failed, hr %#x.\n", hr);
|
|
|
|
hr = ID3D12Device_CreateCommandList(device, 0, D3D12_COMMAND_LIST_TYPE_DIRECT,
|
|
|
|
command_allocator, NULL, &IID_ID3D12CommandList, (void **)&command_list);
|
|
|
|
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
|
|
|
hr = ID3D12Device_CreateCommandList(device, 0, D3D12_COMMAND_LIST_TYPE_COMPUTE,
|
|
|
|
command_allocator, NULL, &IID_ID3D12CommandList, (void **)&command_list);
|
|
|
|
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
|
|
|
hr = ID3D12Device_CreateCommandList(device, 0, D3D12_COMMAND_LIST_TYPE_COPY,
|
|
|
|
command_allocator, NULL, &IID_ID3D12CommandList, (void **)&command_list);
|
|
|
|
ok(SUCCEEDED(hr), "CreateCommandList failed, hr %#x.\n", hr);
|
|
|
|
check_interface(command_list, &IID_ID3D12GraphicsCommandList, TRUE);
|
|
|
|
refcount = ID3D12CommandList_Release(command_list);
|
|
|
|
ok(!refcount, "ID3D12CommandList has %u references left.\n", (unsigned int)refcount);
|
|
|
|
refcount = ID3D12CommandAllocator_Release(command_allocator);
|
|
|
|
ok(!refcount, "ID3D12CommandAllocator has %u references left.\n", (unsigned int)refcount);
|
|
|
|
|
|
|
|
refcount = ID3D12Device_Release(device);
|
|
|
|
ok(!refcount, "ID3D12Device has %u references left.\n", (unsigned int)refcount);
|
|
|
|
}
|
|
|
|
|
2016-09-21 06:14:01 -07:00
|
|
|
static void test_create_command_queue(void)
|
|
|
|
{
|
|
|
|
D3D12_COMMAND_QUEUE_DESC desc, result_desc;
|
|
|
|
ID3D12Device *device, *tmp_device;
|
|
|
|
ID3D12CommandQueue *queue;
|
|
|
|
ULONG refcount;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
if (!(device = create_device()))
|
|
|
|
{
|
|
|
|
skip("Failed to create device.\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
desc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT;
|
|
|
|
desc.Priority = D3D12_COMMAND_QUEUE_PRIORITY_NORMAL;
|
|
|
|
desc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE;
|
|
|
|
desc.NodeMask = 0;
|
|
|
|
hr = ID3D12Device_CreateCommandQueue(device, &desc, &IID_ID3D12CommandQueue, (void **)&queue);
|
|
|
|
ok(SUCCEEDED(hr), "CreateCommandQueue failed, hr %#x.\n", hr);
|
|
|
|
|
|
|
|
refcount = get_refcount(device);
|
|
|
|
ok(refcount == 2, "Got unexpected refcount %u.\n", (unsigned int)refcount);
|
|
|
|
hr = ID3D12CommandQueue_GetDevice(queue, &IID_ID3D12Device, (void **)&tmp_device);
|
|
|
|
ok(SUCCEEDED(hr), "GetDevice failed, hr %#x.\n", hr);
|
|
|
|
refcount = get_refcount(device);
|
|
|
|
ok(refcount == 3, "Got unexpected refcount %u.\n", (unsigned int)refcount);
|
|
|
|
refcount = ID3D12Device_Release(tmp_device);
|
|
|
|
ok(refcount == 2, "Got unexpected refcount %u.\n", (unsigned int)refcount);
|
|
|
|
|
|
|
|
check_interface(queue, &IID_ID3D12Object, TRUE);
|
|
|
|
check_interface(queue, &IID_ID3D12DeviceChild, TRUE);
|
|
|
|
check_interface(queue, &IID_ID3D12Pageable, TRUE);
|
|
|
|
check_interface(queue, &IID_ID3D12CommandQueue, TRUE);
|
|
|
|
|
|
|
|
result_desc = ID3D12CommandQueue_GetDesc(queue);
|
|
|
|
ok(result_desc.Type == desc.Type, "Got unexpected type %#x.\n", result_desc.Type);
|
|
|
|
ok(result_desc.Priority == desc.Priority, "Got unexpected priority %#x.\n", result_desc.Priority);
|
|
|
|
ok(result_desc.Flags == desc.Flags, "Got unexpected flags %#x.\n", result_desc.Flags);
|
|
|
|
ok(result_desc.NodeMask == 0x1, "Got unexpected node mask 0x%08x.\n", result_desc.NodeMask);
|
|
|
|
|
|
|
|
refcount = ID3D12CommandQueue_Release(queue);
|
|
|
|
ok(!refcount, "ID3D12CommandQueue has %u references left.\n", (unsigned int)refcount);
|
|
|
|
|
|
|
|
refcount = ID3D12Device_Release(device);
|
|
|
|
ok(!refcount, "ID3D12Device has %u references left.\n", (unsigned int)refcount);
|
|
|
|
}
|
|
|
|
|
2016-09-21 03:57:24 -07:00
|
|
|
START_TEST(d3d12)
|
|
|
|
{
|
2016-09-21 04:19:16 -07:00
|
|
|
ID3D12Debug *debug;
|
|
|
|
|
|
|
|
if (SUCCEEDED(D3D12GetDebugInterface(&IID_ID3D12Debug, (void **)&debug)))
|
|
|
|
{
|
|
|
|
ID3D12Debug_EnableDebugLayer(debug);
|
|
|
|
ID3D12Debug_Release(debug);
|
|
|
|
}
|
|
|
|
|
2016-09-21 03:57:24 -07:00
|
|
|
test_create_device();
|
2016-09-21 05:51:48 -07:00
|
|
|
test_node_count();
|
2016-09-21 06:02:13 -07:00
|
|
|
test_check_feature_support();
|
2016-09-21 06:44:19 -07:00
|
|
|
test_create_command_allocator();
|
2016-09-21 07:25:51 -07:00
|
|
|
test_create_command_list();
|
2016-09-21 06:14:01 -07:00
|
|
|
test_create_command_queue();
|
2016-09-21 03:57:24 -07:00
|
|
|
}
|