tests: Support using the Agility SDK in the crosstests.

This commit is contained in:
Giovanni Mascellani 2024-05-02 11:56:04 -07:00 committed by Henri Verbeet
parent c49daadce1
commit 4f67675a51
Notes: Henri Verbeet 2024-07-09 20:53:44 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Conor McCarthy (@cmccarthy)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/853
8 changed files with 78 additions and 0 deletions

43
README
View File

@ -111,3 +111,46 @@ to submit their patches using the merge request tool.
Each merge request is automatically tested with the GitLab CI
system. See gitlab/README in the Git tree for more details.
============================
Testing with the Agility SDK
============================
Traditionally Microsoft have released the Direct3D 12 development files,
including the debug layer runtime, as part of the larger Windows SDK.
In 2021 the DirectX 12 Agility SDK was introduced, which may be updated
independently of the Windows SDK. If you plan to run the vkd3d
crosstests with Microsoft's debug layer you might want to get it from
the Agility SDK, both because it's probably going to be more up-to-date
and because the Agility SDK is a couple dozens of megabytes versus the
gigabytes of the Windows SDK.
In order to build the vkd3d crosstests with Agility SDK support, follow
these steps:
* The Agility SDK is distributed at [1]: select your preferred
version (likely the most recent one) and note the number in column
D3D12SDKVersion, which you're going to need later.
[1] https://devblogs.microsoft.com/directx/directx12agility/
* Configure vkd3d with something like:
'CROSSCC64="x86_64-w64-mingw32-gcc -DVKD3D_AGILITY_SDK_VERSION=<version>"',
as well as the equivalent CROSSCC32 variable for the 32-bit
crosstests. You'll have to replace '<version>' with the
D3D12SDKVersion number you noted above. Then build the crosstests
with 'make crosstest' as usual.
* Download the Agility SDK NuGet package, which is essentially a ZIP
file with a .nupkg extension. Extract d3d12core.dll and
d3d12sdklayers.dll for your architecture, and put them in the
directory containing the crosstest executables.
* Now you can run the crosstests, possibly with arguments
'--validate' and '--gbv' to enable the debug layers. They will use
the runtime from the Agility SDK.
* It's also possible to use '-DVKD3D_AGILITY_SDK_PATH=/path/to/sdk/' to
specify the directory to load the Agility SDK DLLs from at runtime.
If relative, the path is intended to be relative to the executable
path. If unspecified the path defaults to '.'.

View File

@ -52,6 +52,10 @@
((uint32_t)(ch0) | ((uint32_t)(ch1) << 8) \
| ((uint32_t)(ch2) << 16) | ((uint32_t)(ch3) << 24))
#define VKD3D_EXPAND(x) x
#define VKD3D_STRINGIFY(x) #x
#define VKD3D_EXPAND_AND_STRINGIFY(x) VKD3D_EXPAND(VKD3D_STRINGIFY(x))
#define TAG_AON9 VKD3D_MAKE_TAG('A', 'o', 'n', '9')
#define TAG_DXBC VKD3D_MAKE_TAG('D', 'X', 'B', 'C')
#define TAG_DXIL VKD3D_MAKE_TAG('D', 'X', 'I', 'L')

View File

@ -23,6 +23,8 @@
#include "d3d12_crosstest.h"
VKD3D_AGILITY_SDK_EXPORTS
struct test_options test_options = {0};
static PFN_D3D12_CREATE_VERSIONED_ROOT_SIGNATURE_DESERIALIZER pfn_D3D12CreateVersionedRootSignatureDeserializer;

View File

@ -259,6 +259,24 @@ static void wait_queue_idle_(unsigned int line, ID3D12Device *device, ID3D12Comm
}
#ifdef VKD3D_CROSSTEST
#ifdef VKD3D_AGILITY_SDK_VERSION
# define VKD3D_AGILITY_SDK_EXPORT_VERSION \
VKD3D_EXPORT const UINT D3D12SDKVersion = VKD3D_AGILITY_SDK_VERSION;
# ifdef VKD3D_AGILITY_SDK_PATH
# define VKD3D_AGILITY_SDK_EXPORT_PATH \
VKD3D_EXPORT const char *D3D12SDKPath = VKD3D_EXPAND_AND_STRINGIFY(VKD3D_AGILITY_SDK_PATH);
# else
# define VKD3D_AGILITY_SDK_EXPORT_PATH \
VKD3D_EXPORT const char *D3D12SDKPath = ".";
# endif
# define VKD3D_AGILITY_SDK_EXPORTS \
VKD3D_AGILITY_SDK_EXPORT_VERSION \
VKD3D_AGILITY_SDK_EXPORT_PATH
#else
# define VKD3D_AGILITY_SDK_EXPORTS
#endif
static IUnknown *create_warp_adapter(IDXGIFactory4 *factory)
{
IUnknown *adapter;
@ -505,6 +523,8 @@ static inline bool is_depth_clip_enable_supported(ID3D12Device *device)
#else
#define VKD3D_AGILITY_SDK_EXPORTS
#define DECLARE_VK_PFN(name) static PFN_##name name;
DECLARE_VK_PFN(vkGetInstanceProcAddr)
#define VK_INSTANCE_PFN DECLARE_VK_PFN

View File

@ -18,6 +18,8 @@
#include "d3d12_crosstest.h"
VKD3D_AGILITY_SDK_EXPORTS
struct test_options test_options = {0};
#define recreate_command_list(a, b, c) recreate_command_list_(__LINE__, a, b, c)

View File

@ -21,6 +21,8 @@
#include "vkd3d_common.h"
#include "vkd3d_d3d12shader.h"
VKD3D_AGILITY_SDK_EXPORTS
#ifndef D3DERR_INVALIDCALL
#define D3DERR_INVALIDCALL 0x8876086c
#endif

View File

@ -2219,6 +2219,9 @@ START_TEST(shader_runner)
print_dll_version("d3d9.dll");
print_dll_version("d3d11.dll");
print_dll_version("d3d12.dll");
print_dll_version("d3d12core.dll");
if (test_options.enable_debug_layer)
print_dll_version("d3d12sdklayers.dll");
#elif defined(_WIN32)
trace("Running tests from a Windows non-cross build\n");

View File

@ -28,6 +28,8 @@
#include "shader_runner.h"
#include "dxcompiler.h"
VKD3D_AGILITY_SDK_EXPORTS
struct d3d12_resource
{
struct resource r;