upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/test/d3d12_compute_test.cpp
diff options
context:
space:
mode:
authorNolan Cotter <186326284+NolanCotter@users.noreply.github.com>2026-11-22 20:39:59 -0700
committerNolan Cotter <186326284+NolanCotter@users.noreply.github.com>2026-11-22 20:39:59 -0700
commitfa5f26db8eafd2cc27f627b68c0a5a5949bcf2ff (patch)
treefc57e238be829295fc216dff89a6d93e64c16b50 /runtime/test/d3d12_compute_test.cpp
parent9b693ecd8a2f90799f6c47f8f06cf062feb9820c (diff)
parent7b7d73f890f9fbbf5967bbb694390bbc99e33ba6 (diff)
Merge origin/main: DXGI device fields coexist with the console-ABI device state
Diffstat (limited to 'runtime/test/d3d12_compute_test.cpp')
-rw-r--r--runtime/test/d3d12_compute_test.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/runtime/test/d3d12_compute_test.cpp b/runtime/test/d3d12_compute_test.cpp
index 2b0b14cda..c8b29d29c 100644
--- a/runtime/test/d3d12_compute_test.cpp
+++ b/runtime/test/d3d12_compute_test.cpp
@@ -9,7 +9,9 @@
9// The shader (test/glsl/cs_user_data.comp) is written to the translator's push-constant and address contract. 9// The shader (test/glsl/cs_user_data.comp) is written to the translator's push-constant and address contract.
10// No game data. Set LEONIDA_VK_VALIDATION=1 to run under VK_LAYER_KHRONOS_validation. 10// No game data. Set LEONIDA_VK_VALIDATION=1 to run under VK_LAYER_KHRONOS_validation.
11#include "shader_fixture_path.h" 11#include "shader_fixture_path.h"
12#include "test_temp_dir.h"
12#include "vk_test_device.h" 13#include "vk_test_device.h"
14#include "host_wine.h"
13#include "../shims/d3d12_com.h" 15#include "../shims/d3d12_com.h"
14#include "../src/gfx10_descriptors.h" 16#include "../src/gfx10_descriptors.h"
15#include "../src/cached_pso.h" 17#include "../src/cached_pso.h"
@@ -203,9 +205,11 @@ std::vector<HRESULT> cached_pso_cases(Device* device, D3D12_COMPUTE_PIPELINE_STA
203} 205}
204 206
205// The same cases on the PC runtime, with an empty compute shader from d3dcompiler_47: the default adapter, then WARP. 207// The same cases on the PC runtime, with an empty compute shader from d3dcompiler_47: the default adapter, then WARP.
206// Empty when the host has no D3D12 device or no compiler (Wine), which the caller reports as a skip. 208// Empty when the host has no D3D12 device or no compiler, or is Wine's, which the caller reports as a skip: vkd3d has
209// both, but its GetCachedBlob is a stub, so every host answered nothing and the comparison failed on each run.
207std::vector<std::vector<HRESULT>> host_cached_pso_cases(const std::vector<std::uint8_t>& root_blob, 210std::vector<std::vector<HRESULT>> host_cached_pso_cases(const std::vector<std::uint8_t>& root_blob,
208 const std::vector<std::uint8_t>& other_root_blob) { 211 const std::vector<std::uint8_t>& other_root_blob) {
212 if (hostwine::host_is_wine()) return {};
209 using CompileFn = HRESULT(WINAPI*)(LPCVOID, SIZE_T, LPCSTR, const void*, void*, LPCSTR, LPCSTR, UINT, UINT, 213 using CompileFn = HRESULT(WINAPI*)(LPCVOID, SIZE_T, LPCSTR, const void*, void*, LPCSTR, LPCSTR, UINT, UINT,
210 ID3DBlob**, ID3DBlob**); 214 ID3DBlob**, ID3DBlob**);
211 using CreateDeviceFn = decltype(&::D3D12CreateDevice); 215 using CreateDeviceFn = decltype(&::D3D12CreateDevice);
@@ -268,10 +272,9 @@ int main() {
268 for (std::uint32_t i = 0; i < 14; ++i) put32(fssm, 0xbf810000u + i); // filler, s_endpgm-like words 272 for (std::uint32_t i = 0; i < 14; ++i) put32(fssm, 0xbf810000u + i); // filler, s_endpgm-like words
269 const auto container = shader_container(fssm); 273 const auto container = shader_container(fssm);
270 EXPECT(leonida::fssm_program(container) == fssm); 274 EXPECT(leonida::fssm_program(container) == fssm);
271 const auto library = std::filesystem::temp_directory_path() / "leonida_compute_test"; 275 const testfiles::ScratchDir scratch("leonida_compute_test");
272 std::filesystem::create_directories(library); 276 const auto& library = scratch.path();
273 std::filesystem::copy_file(vktest::shader_fixture_path(LEONIDA_TEST_CS_SPV), library / "cs_user_data.spv", 277 EXPECT(testfiles::copy_file(vktest::shader_fixture_path(LEONIDA_TEST_CS_SPV), library / "cs_user_data.spv"));
274 std::filesystem::copy_options::overwrite_existing);
275 { 278 {
276 std::ofstream index(library / "index.json", std::ios::binary); 279 std::ofstream index(library / "index.json", std::ios::binary);
277 // An entry for the same program with set-0 bindings comes first, as in one group of the corpus: the PSO 280 // An entry for the same program with set-0 bindings comes first, as in one group of the corpus: the PSO
@@ -387,7 +390,9 @@ int main() {
387 E_INVALIDARG, E_INVALIDARG, S_OK}; 390 E_INVALIDARG, E_INVALIDARG, S_OK};
388 EXPECT(layer == expected); 391 EXPECT(layer == expected);
389 const auto hosts = host_cached_pso_cases(root_blob, other_root_blob); 392 const auto hosts = host_cached_pso_cases(root_blob, other_root_blob);
390 if (hosts.empty()) std::printf("SKIP: no host D3D12 device or compiler for the CachedPSO comparison\n"); 393 if (hosts.empty())
394 std::printf("SKIP: no host D3D12 reference (Wine, or no device or compiler) for the CachedPSO "
395 "comparison\n");
391 for (const auto& host : hosts) EXPECT(host == layer); 396 for (const auto& host : hosts) EXPECT(host == layer);
392 if (!hosts.empty()) std::printf("cached PSO: %zu host adapter(s) gave the same %d answers\n", hosts.size(), cached_case_count); 397 if (!hosts.empty()) std::printf("cached PSO: %zu host adapter(s) gave the same %d answers\n", hosts.size(), cached_case_count);
393 398
@@ -889,7 +894,6 @@ int main() {
889 fence.reset(); 894 fence.reset();
890 EXPECT(rt::d3d12_xs::device_proxy_ref_count(device.p) == 1); 895 EXPECT(rt::d3d12_xs::device_proxy_ref_count(device.p) == 1);
891 } 896 }
892 std::filesystem::remove_all(library);
893 897
894 unsigned mismatches = 0; 898 unsigned mismatches = 0;
895 for (std::uint32_t i = 0; i < elements; ++i) { 899 for (std::uint32_t i = 0; i < elements; ++i) {