Module: vkd3d Branch: master Commit: 4f67675a5179ef6b44a9f26bcd70c580da975488 URL: https://gitlab.winehq.org/wine/vkd3d/-/commit/4f67675a5179ef6b44a9f26bcd70c5...
Author: Giovanni Mascellani gmascellani@codeweavers.com Date: Thu May 2 11:56:04 2024 -0700
tests: Support using the Agility SDK in the crosstests.
---
README | 43 ++++++++++++++++++++++++++++++++++++++++++ include/private/vkd3d_common.h | 4 ++++ tests/d3d12.c | 2 ++ tests/d3d12_crosstest.h | 20 ++++++++++++++++++++ tests/d3d12_invalid_usage.c | 2 ++ tests/hlsl_d3d12.c | 2 ++ tests/shader_runner.c | 3 +++ tests/shader_runner_d3d12.c | 2 ++ 8 files changed, 78 insertions(+)
diff --git a/README b/README index 27da28b7..a3fcedde 100644 --- a/README +++ b/README @@ -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 '.'. diff --git a/include/private/vkd3d_common.h b/include/private/vkd3d_common.h index 79682483..6fbcbcc9 100644 --- a/include/private/vkd3d_common.h +++ b/include/private/vkd3d_common.h @@ -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') diff --git a/tests/d3d12.c b/tests/d3d12.c index 31f387db..6fef405f 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -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; diff --git a/tests/d3d12_crosstest.h b/tests/d3d12_crosstest.h index 99770353..8388a7a7 100644 --- a/tests/d3d12_crosstest.h +++ b/tests/d3d12_crosstest.h @@ -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 diff --git a/tests/d3d12_invalid_usage.c b/tests/d3d12_invalid_usage.c index 09e192a0..3e95d527 100644 --- a/tests/d3d12_invalid_usage.c +++ b/tests/d3d12_invalid_usage.c @@ -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) diff --git a/tests/hlsl_d3d12.c b/tests/hlsl_d3d12.c index 2fe41fc2..1595df86 100644 --- a/tests/hlsl_d3d12.c +++ b/tests/hlsl_d3d12.c @@ -21,6 +21,8 @@ #include "vkd3d_common.h" #include "vkd3d_d3d12shader.h"
+VKD3D_AGILITY_SDK_EXPORTS + #ifndef D3DERR_INVALIDCALL #define D3DERR_INVALIDCALL 0x8876086c #endif diff --git a/tests/shader_runner.c b/tests/shader_runner.c index f8e18348..91714ab1 100644 --- a/tests/shader_runner.c +++ b/tests/shader_runner.c @@ -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"); diff --git a/tests/shader_runner_d3d12.c b/tests/shader_runner_d3d12.c index ff2cad2f..126db6d7 100644 --- a/tests/shader_runner_d3d12.c +++ b/tests/shader_runner_d3d12.c @@ -28,6 +28,8 @@ #include "shader_runner.h" #include "dxcompiler.h"
+VKD3D_AGILITY_SDK_EXPORTS + struct d3d12_resource { struct resource r;