diff options
| author | Rain156 <77776581+Rain156@users.noreply.github.com> | 2026-11-24 21:46:19 +0800 |
|---|---|---|
| committer | Rain156 <77776581+Rain156@users.noreply.github.com> | 2026-11-24 21:46:19 +0800 |
| commit | e59cc2e655edda02d4a42d0ccfdec80eed7ea29f (patch) | |
| tree | 03b7ca83f9cc57857e406823b0dfd6f3c7d8639d /runtime | |
| parent | 1b1d4edd2dea9ef1fbabfadb8e3d719be39e38eb (diff) | |
Distinguish desktop and Xbox feature queries while retaining the D16/S8 paths
Keep the desktop HRESULTs for Xbox-only formats. Check both console and desktop vtable callers in the mock, and exercise the full rectangle target for a derived PSO with a zero sample mask.
Diffstat (limited to 'runtime')
| -rw-r--r-- | runtime/shims/d3d12_vulkan_device.cpp | 7 | ||||
| -rw-r--r-- | runtime/shims/d3d12_xs_device.cpp | 23 | ||||
| -rw-r--r-- | runtime/shims/d3d12_xs_device.h | 1 | ||||
| -rw-r--r-- | runtime/test/d3d12_translated_draw_test.cpp | 3 | ||||
| -rw-r--r-- | runtime/test/xbox_d16s8_surface_test.cpp | 21 | ||||
| -rw-r--r-- | runtime/test/xs_proxy_mock_test.cpp | 40 |
6 files changed, 81 insertions, 14 deletions
diff --git a/runtime/shims/d3d12_vulkan_device.cpp b/runtime/shims/d3d12_vulkan_device.cpp index 6ce904903..d4c759039 100644 --- a/runtime/shims/d3d12_vulkan_device.cpp +++ b/runtime/shims/d3d12_vulkan_device.cpp | |||
| @@ -9515,9 +9515,6 @@ public: | |||
| 9515 | auto* info = static_cast<D3D12_FEATURE_DATA_FORMAT_INFO*>(data); | 9515 | auto* info = static_cast<D3D12_FEATURE_DATA_FORMAT_INFO*>(data); |
| 9516 | // Plane count describes the DXGI layout even when the backend cannot create the texture. | 9516 | // Plane count describes the DXGI layout even when the backend cannot create the texture. |
| 9517 | switch (info->Format) { | 9517 | switch (info->Format) { |
| 9518 | case xbox_d16s8: | ||
| 9519 | case xbox_d16_plane: | ||
| 9520 | case xbox_s8_plane: | ||
| 9521 | case DXGI_FORMAT_R32G8X24_TYPELESS: | 9518 | case DXGI_FORMAT_R32G8X24_TYPELESS: |
| 9522 | case DXGI_FORMAT_D32_FLOAT_S8X24_UINT: | 9519 | case DXGI_FORMAT_D32_FLOAT_S8X24_UINT: |
| 9523 | case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS: | 9520 | case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS: |
| @@ -9555,7 +9552,7 @@ public: | |||
| 9555 | // formats P208/V208/V408 (130-132), and from 192 up; 189-191 are the sampler-feedback formats and | 9552 | // formats P208/V208/V408 (130-132), and from 192 up; 189-191 are the sampler-feedback formats and |
| 9556 | // A4B4G4R4. UNKNOWN is a buffer format (raw and structured buffers). | 9553 | // A4B4G4R4. UNKNOWN is a buffer format (raw and structured buffers). |
| 9557 | const UINT format_value = static_cast<UINT>(fs->Format); | 9554 | const UINT format_value = static_cast<UINT>(fs->Format); |
| 9558 | if (format_value > static_cast<UINT>(DXGI_FORMAT_B4G4R4A4_UNORM) && !(format_value>=118 && format_value<=120) && | 9555 | if (format_value > static_cast<UINT>(DXGI_FORMAT_B4G4R4A4_UNORM) && !(rt::d3d12_xs::console_feature_query() && format_value >= 118 && format_value <= 120) && |
| 9559 | (format_value < 189 || format_value > 191)) | 9556 | (format_value < 189 || format_value > 191)) |
| 9560 | return d3d12_trace::result(method, E_FAIL); | 9557 | return d3d12_trace::result(method, E_FAIL); |
| 9561 | if (fs->Format == DXGI_FORMAT_UNKNOWN) { | 9558 | if (fs->Format == DXGI_FORMAT_UNKNOWN) { |
| @@ -9806,7 +9803,7 @@ public: | |||
| 9806 | // output untouched; a known format clears it before the sample count is checked. | 9803 | // output untouched; a known format clears it before the sample count is checked. |
| 9807 | const UINT format_id = UINT(levels->Format); | 9804 | const UINT format_id = UINT(levels->Format); |
| 9808 | if (levels->Format == DXGI_FORMAT_R1_UNORM || | 9805 | if (levels->Format == DXGI_FORMAT_R1_UNORM || |
| 9809 | !(format_id <= DXGI_FORMAT_B4G4R4A4_UNORM || (format_id>=118 && format_id<=120) || | 9806 | !(format_id <= DXGI_FORMAT_B4G4R4A4_UNORM || (rt::d3d12_xs::console_feature_query() && format_id >= 118 && format_id <= 120) || |
| 9810 | (format_id >= DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE && | 9807 | (format_id >= DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE && |
| 9811 | format_id <= DXGI_FORMAT_A4B4G4R4_UNORM))) | 9808 | format_id <= DXGI_FORMAT_A4B4G4R4_UNORM))) |
| 9812 | return d3d12_trace::result(method, E_FAIL); | 9809 | return d3d12_trace::result(method, E_FAIL); |
diff --git a/runtime/shims/d3d12_xs_device.cpp b/runtime/shims/d3d12_xs_device.cpp index 39b7d846c..7e0fddf36 100644 --- a/runtime/shims/d3d12_xs_device.cpp +++ b/runtime/shims/d3d12_xs_device.cpp | |||
| @@ -75,6 +75,7 @@ | |||
| 75 | namespace rt::d3d12_xs { | 75 | namespace rt::d3d12_xs { |
| 76 | namespace { | 76 | namespace { |
| 77 | std::atomic<ConsoleCaller> g_console_caller{nullptr}; | 77 | std::atomic<ConsoleCaller> g_console_caller{nullptr}; |
| 78 | thread_local bool g_console_feature_query = false; | ||
| 78 | 79 | ||
| 79 | bool is_console_caller(const void* address) { | 80 | bool is_console_caller(const void* address) { |
| 80 | const ConsoleCaller classify = g_console_caller.load(std::memory_order_acquire); | 81 | const ConsoleCaller classify = g_console_caller.load(std::memory_order_acquire); |
| @@ -3834,6 +3835,24 @@ std::uint64_t WINAPI proxy_slot(DeviceProxy* self, std::uint64_t a1, std::uint64 | |||
| 3834 | } else if constexpr (Slot == 12) { | 3835 | } else if constexpr (Slot == 12) { |
| 3835 | return hr_to_u64(proxy_create_command_list(self, a1, a2, a3, a4, reinterpret_cast<const IID*>(a5), | 3836 | return hr_to_u64(proxy_create_command_list(self, a1, a2, a3, a4, reinterpret_cast<const IID*>(a5), |
| 3836 | reinterpret_cast<void**>(a6))); | 3837 | reinterpret_cast<void**>(a6))); |
| 3838 | } else if constexpr (Slot == 13) { | ||
| 3839 | const bool console = is_console_caller(_ReturnAddress()); | ||
| 3840 | struct RestoreFeatureQuery { | ||
| 3841 | bool previous; | ||
| 3842 | ~RestoreFeatureQuery() { g_console_feature_query = previous; } | ||
| 3843 | } restore{std::exchange(g_console_feature_query, console)}; | ||
| 3844 | const auto feature = static_cast<D3D12_FEATURE>(a1); | ||
| 3845 | if (feature == D3D12_FEATURE_FORMAT_INFO && a3 == sizeof(D3D12_FEATURE_DATA_FORMAT_INFO) && | ||
| 3846 | console && local_accessible(a2, sizeof(D3D12_FEATURE_DATA_FORMAT_INFO), true)) { | ||
| 3847 | auto* info = reinterpret_cast<D3D12_FEATURE_DATA_FORMAT_INFO*>(a2); | ||
| 3848 | const auto format = static_cast<unsigned>(info->Format); | ||
| 3849 | // Xbox D16/S8 and its depth and stencil aliases occupy slots reserved by desktop DXGI. | ||
| 3850 | if (format >= 118 && format <= 120) { | ||
| 3851 | info->PlaneCount = 2; | ||
| 3852 | return hr_to_u64(S_OK); | ||
| 3853 | } | ||
| 3854 | } | ||
| 3855 | return hr_to_u64(self->real->CheckFeatureSupport(feature, reinterpret_cast<void*>(a2), static_cast<UINT>(a3))); | ||
| 3837 | } else if constexpr (Slot == 36) { | 3856 | } else if constexpr (Slot == 36) { |
| 3838 | return hr_to_u64(proxy_create_fence(self, a1, a2, reinterpret_cast<const IID*>(a3), | 3857 | return hr_to_u64(proxy_create_fence(self, a1, a2, reinterpret_cast<const IID*>(a3), |
| 3839 | reinterpret_cast<void**>(a4))); | 3858 | reinterpret_cast<void**>(a4))); |
| @@ -4344,6 +4363,8 @@ unsigned device_proxy_slot_count(const void* device) { | |||
| 4344 | return static_cast<const DeviceProxy*>(device)->slot_count; | 4363 | return static_cast<const DeviceProxy*>(device)->slot_count; |
| 4345 | } | 4364 | } |
| 4346 | 4365 | ||
| 4366 | bool console_feature_query() noexcept { return g_console_feature_query; } | ||
| 4367 | |||
| 4347 | void set_console_caller(ConsoleCaller classify) { | 4368 | void set_console_caller(ConsoleCaller classify) { |
| 4348 | g_console_caller.store(classify, std::memory_order_release); | 4369 | g_console_caller.store(classify, std::memory_order_release); |
| 4349 | } | 4370 | } |
| @@ -4379,7 +4400,7 @@ std::shared_ptr<leonida::FrameTokenSource> device_frame_tokens(const void* devic | |||
| 4379 | } | 4400 | } |
| 4380 | 4401 | ||
| 4381 | bool device_slot_overridden(unsigned slot) { | 4402 | bool device_slot_overridden(unsigned slot) { |
| 4382 | if (slot <= 2 || slot == 8 || slot == 9 || slot == 12 || slot == 14 || (slot >= 17 && slot <= 24) || slot == 25 || slot == 26 || slot == 31 || slot == 32 || | 4403 | if (slot <= 2 || slot == 8 || slot == 9 || slot == 12 || slot == 13 || slot == 14 || (slot >= 17 && slot <= 24) || slot == 25 || slot == 26 || slot == 31 || slot == 32 || |
| 4383 | slot == 34 || slot == 35 || slot == 36 || slot == 45 || slot == 46 || slot == 50 || slot == 56 || slot == 57 || slot == 62 || | 4404 | slot == 34 || slot == 35 || slot == 36 || slot == 45 || slot == 46 || slot == 50 || slot == 56 || slot == 57 || slot == 62 || |
| 4384 | slot == 67 || slot == 70 || slot == 75 || slot == 76 || slot == kCreateCommittedResource3X || slot == 133 || slot == 41 || slot == 61 || slot == 74 || slot == 86 || slot == 101 || slot == 108) | 4405 | slot == 67 || slot == 70 || slot == 75 || slot == 76 || slot == kCreateCommittedResource3X || slot == 133 || slot == 41 || slot == 61 || slot == 74 || slot == 86 || slot == 101 || slot == 108) |
| 4385 | return true; | 4406 | return true; |
diff --git a/runtime/shims/d3d12_xs_device.h b/runtime/shims/d3d12_xs_device.h index 42e50d93e..65c2bb831 100644 --- a/runtime/shims/d3d12_xs_device.h +++ b/runtime/shims/d3d12_xs_device.h | |||
| @@ -123,6 +123,7 @@ namespace rt::d3d12_xs { | |||
| 123 | // Identify calls from a mapped title image when PC and Xbox use the same vtable slot. | 123 | // Identify calls from a mapped title image when PC and Xbox use the same vtable slot. |
| 124 | using ConsoleCaller = bool (*)(std::uint64_t address); | 124 | using ConsoleCaller = bool (*)(std::uint64_t address); |
| 125 | void set_console_caller(ConsoleCaller classify); | 125 | void set_console_caller(ConsoleCaller classify); |
| 126 | bool console_feature_query() noexcept; | ||
| 126 | 127 | ||
| 127 | 128 | ||
| 128 | // Wraps `real` and returns the requested device interface through `out`. Takes ownership of one reference to | 129 | // Wraps `real` and returns the requested device interface through `out`. Takes ownership of one reference to |
diff --git a/runtime/test/d3d12_translated_draw_test.cpp b/runtime/test/d3d12_translated_draw_test.cpp index 362345b1f..1b2c7b6be 100644 --- a/runtime/test/d3d12_translated_draw_test.cpp +++ b/runtime/test/d3d12_translated_draw_test.cpp | |||
| @@ -436,7 +436,8 @@ int main(int argc, char** argv) { | |||
| 436 | for (UINT y = 0; y < target_extent; ++y) { | 436 | for (UINT y = 0; y < target_extent; ++y) { |
| 437 | for (UINT x = 0; x < target_extent; ++x) { | 437 | for (UINT x = 0; x < target_extent; ++x) { |
| 438 | const auto i = y * target_extent + x; | 438 | const auto i = y * target_extent + x; |
| 439 | const auto& want = y >= target_extent / 2 && x < target_extent / 2 ? lower_left : triangles[i]; | 439 | const bool covered = !derived_zero && y >= target_extent / 2 && x < target_extent / 2; |
| 440 | const auto& want = covered ? lower_left : triangles[i]; | ||
| 440 | if (pixels[i] != want) { | 441 | if (pixels[i] != want) { |
| 441 | std::fprintf(stderr, "rectangle draw mismatch at (%u, %u) in frame %llu\n", x, y, | 442 | std::fprintf(stderr, "rectangle draw mismatch at (%u, %u) in frame %llu\n", x, y, |
| 442 | static_cast<unsigned long long>(frame)); | 443 | static_cast<unsigned long long>(frame)); |
diff --git a/runtime/test/xbox_d16s8_surface_test.cpp b/runtime/test/xbox_d16s8_surface_test.cpp index e58ad9e21..8eacb3b18 100644 --- a/runtime/test/xbox_d16s8_surface_test.cpp +++ b/runtime/test/xbox_d16s8_surface_test.cpp | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | #include "../shims/d3d12_xs_device.h" | ||
| 1 | #include "vk_test_device.h" | 2 | #include "vk_test_device.h" |
| 2 | #include "d3d12_test_shaders.h" | 3 | #include "d3d12_test_shaders.h" |
| 3 | #include "../shims/d3d12_com.h" | 4 | #include "../shims/d3d12_com.h" |
| @@ -38,9 +39,23 @@ int main() { | |||
| 38 | tex.Flags = D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL; | 39 | tex.Flags = D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL; |
| 39 | const auto required = dev->GetResourceAllocationInfo(0, 1, &tex); | 40 | const auto required = dev->GetResourceAllocationInfo(0, 1, &tex); |
| 40 | CHECK(required.SizeInBytes > 0 && required.SizeInBytes != ~UINT64{0} && required.Alignment); | 41 | CHECK(required.SizeInBytes > 0 && required.SizeInBytes != ~UINT64{0} && required.Alignment); |
| 41 | D3D12_FEATURE_DATA_FORMAT_INFO planes{format}; | 42 | D3D12_FEATURE_DATA_FORMAT_INFO planes{format, 255}; |
| 42 | CHECK(SUCCEEDED(dev->CheckFeatureSupport(D3D12_FEATURE_FORMAT_INFO, &planes, sizeof(planes))) && | 43 | CHECK(dev->CheckFeatureSupport(D3D12_FEATURE_FORMAT_INFO, &planes, sizeof(planes)) == E_INVALIDARG); |
| 43 | planes.PlaneCount == 2); | 44 | CHECK(planes.PlaneCount == 255); |
| 45 | { | ||
| 46 | Ref<ID3D12Device> inner, console; | ||
| 47 | CHECK(SUCCEEDED(dev->QueryInterface(IID_PPV_ARGS(&inner.p)))); | ||
| 48 | CHECK(SUCCEEDED(rt::d3d12_xs::create_device_proxy(inner.p, __uuidof(ID3D12Device), | ||
| 49 | reinterpret_cast<void**>(&console.p), true))); | ||
| 50 | inner.p = nullptr; // the proxy now owns this reference | ||
| 51 | rt::d3d12_xs::set_console_caller([](std::uint64_t) { return true; }); | ||
| 52 | for (unsigned alias = 118; alias <= 120; ++alias) { | ||
| 53 | planes = {static_cast<DXGI_FORMAT>(alias), 255}; | ||
| 54 | CHECK(SUCCEEDED(console->CheckFeatureSupport(D3D12_FEATURE_FORMAT_INFO, &planes, sizeof(planes)))); | ||
| 55 | CHECK(planes.PlaneCount == 2); | ||
| 56 | } | ||
| 57 | rt::d3d12_xs::set_console_caller(nullptr); | ||
| 58 | } | ||
| 44 | D3D12_HEAP_PROPERTIES def{D3D12_HEAP_TYPE_DEFAULT}, rd{D3D12_HEAP_TYPE_READBACK}; | 59 | D3D12_HEAP_PROPERTIES def{D3D12_HEAP_TYPE_DEFAULT}, rd{D3D12_HEAP_TYPE_READBACK}; |
| 45 | D3D12_CLEAR_VALUE clear{}; | 60 | D3D12_CLEAR_VALUE clear{}; |
| 46 | clear.Format = format; | 61 | clear.Format = format; |
diff --git a/runtime/test/xs_proxy_mock_test.cpp b/runtime/test/xs_proxy_mock_test.cpp index 5592d5875..2cf8770e6 100644 --- a/runtime/test/xs_proxy_mock_test.cpp +++ b/runtime/test/xs_proxy_mock_test.cpp | |||
| @@ -1433,18 +1433,28 @@ int check_xbox_slots() { | |||
| 1433 | EXPECT(mock->calls[41] == 2 && mock->args[41][0] == word(&pc_sig)); | 1433 | EXPECT(mock->calls[41] == 2 && mock->args[41][0] == word(&pc_sig)); |
| 1434 | EXPECT(mock->array[41][1] == D3D12_INDIRECT_ARGUMENT_TYPE_DISPATCH_MESH); | 1434 | EXPECT(mock->array[41][1] == D3D12_INDIRECT_ARGUMENT_TYPE_DISPATCH_MESH); |
| 1435 | 1435 | ||
| 1436 | // 61 CreateSamplerX(desc, dest): the PC CreateSampler (slot 22) gets the same two words, not the PC slot 61 | 1436 | // Device slot 61 serves the mapped title and desktop callers through their own ABI. |
| 1437 | // (CreateMetaCommand). A null description is skipped without reaching the device. | ||
| 1438 | D3D12_SAMPLER_DESC sampler{}; | 1437 | D3D12_SAMPLER_DESC sampler{}; |
| 1439 | sampler.Filter = D3D12_FILTER_MIN_MAG_MIP_LINEAR; | 1438 | sampler.Filter = D3D12_FILTER_MIN_MAG_MIP_LINEAR; |
| 1440 | sampler.AddressU = sampler.AddressV = sampler.AddressW = D3D12_TEXTURE_ADDRESS_MODE_WRAP; | 1439 | sampler.AddressU = sampler.AddressV = sampler.AddressW = D3D12_TEXTURE_ADDRESS_MODE_WRAP; |
| 1441 | sampler.MaxLOD = D3D12_FLOAT32_MAX; | 1440 | sampler.MaxLOD = D3D12_FLOAT32_MAX; |
| 1442 | const std::uint64_t sampler_handle = 0x7ff012340040ull; | 1441 | const std::uint64_t sampler_handle = 0x7ff012340040ull; |
| 1443 | raw(device, 61, word(&sampler), sampler_handle); | 1442 | raw(device, 61, word(&sampler), sampler_handle); |
| 1444 | EXPECT(mock->calls[61] == 0 && mock->calls[22] == 1 && xs::device_slot_hits(61) == 1); | 1443 | EXPECT(mock->calls[61] == 1 && mock->calls[22] == 0 && xs::device_slot_hits(61) == 1); |
| 1444 | // A caller the check calls the title's (here every one): the PC CreateSampler (slot 22) gets the same two words, | ||
| 1445 | // not the PC slot 61. A null description is skipped without reaching the device. | ||
| 1446 | xs::set_console_caller([](std::uint64_t) { return true; }); | ||
| 1447 | raw(device, 61, word(&sampler), sampler_handle); | ||
| 1448 | EXPECT(mock->calls[61] == 1 && mock->calls[22] == 1 && xs::device_slot_hits(61) == 2); | ||
| 1445 | EXPECT(mock->args[22][0] == word(&sampler) && mock->args[22][1] == sampler_handle); | 1449 | EXPECT(mock->args[22][0] == word(&sampler) && mock->args[22][1] == sampler_handle); |
| 1446 | raw(device, 61, 0, sampler_handle); | 1450 | raw(device, 61, 0, sampler_handle); |
| 1447 | EXPECT(mock->calls[61] == 0 && mock->calls[22] == 1 && xs::device_slot_hits(61) == 2); | 1451 | EXPECT(mock->calls[61] == 1 && mock->calls[22] == 1 && xs::device_slot_hits(61) == 3); |
| 1452 | // A caller outside the title's images is a host one again. | ||
| 1453 | xs::set_console_caller([](std::uint64_t) { return false; }); | ||
| 1454 | raw(device, 61, word(&sampler), sampler_handle); | ||
| 1455 | EXPECT(mock->calls[61] == 2 && mock->calls[22] == 1); | ||
| 1456 | xs::set_console_caller(nullptr); | ||
| 1457 | |||
| 1448 | 1458 | ||
| 1449 | EXPECT(xs::device_slot_overridden(41) && xs::device_slot_overridden(48) && xs::device_slot_overridden(61) && | 1459 | EXPECT(xs::device_slot_overridden(41) && xs::device_slot_overridden(48) && xs::device_slot_overridden(61) && |
| 1450 | xs::device_slot_overridden(73) && | 1460 | xs::device_slot_overridden(73) && |
| @@ -1823,12 +1833,14 @@ int check_signalx_detection() { | |||
| 1823 | EXPECT(device4 && queue5 && fence5); | 1833 | EXPECT(device4 && queue5 && fence5); |
| 1824 | Mock* const queue5_mock = reinterpret_cast<Mock*>(xs::queue_proxy_real_queue(queue5)); | 1834 | Mock* const queue5_mock = reinterpret_cast<Mock*>(xs::queue_proxy_real_queue(queue5)); |
| 1825 | UINT64 hz = 0; | 1835 | UINT64 hz = 0; |
| 1836 | xs::set_console_caller([](std::uint64_t) { return true; }); | ||
| 1826 | EXPECT(hr_of(raw(queue5, 18, word(&hz))) == S_OK && hz == 1000000 && | 1837 | EXPECT(hr_of(raw(queue5, 18, word(&hz))) == S_OK && hz == 1000000 && |
| 1827 | queue5_mock->calls[16] == 1 && queue5_mock->calls[18] == 0); | 1838 | queue5_mock->calls[16] == 1 && queue5_mock->calls[18] == 0); |
| 1828 | hz = 0; | 1839 | hz = 0; |
| 1829 | EXPECT(hr_of(raw(queue5, 16, word(fence5), 8)) == S_OK); | 1840 | EXPECT(hr_of(raw(queue5, 16, word(fence5), 8)) == S_OK); |
| 1830 | EXPECT(hr_of(raw(queue5, 18, word(&hz))) == S_OK && hz == 1000000 && | 1841 | EXPECT(hr_of(raw(queue5, 18, word(&hz))) == S_OK && hz == 1000000 && |
| 1831 | queue5_mock->calls[16] == 2 && queue5_mock->calls[18] == 0); | 1842 | queue5_mock->calls[16] == 2 && queue5_mock->calls[18] == 0); |
| 1843 | xs::set_console_caller(nullptr); | ||
| 1832 | EXPECT(release(queue5) == 0 && release(fence5) == 0 && release(device4) == 0 && mock4->refs == 0); | 1844 | EXPECT(release(queue5) == 0 && release(fence5) == 0 && release(device4) == 0 && mock4->refs == 0); |
| 1833 | std::printf("xs_proxy_mock: SignalX on an undetected queue's slot 25 forwards as Signal and marks the " | 1845 | std::printf("xs_proxy_mock: SignalX on an undetected queue's slot 25 forwards as Signal and marks the " |
| 1834 | "newer layout; proven-older stays older, a fence at 23 does not pin, and an undetected " | 1846 | "newer layout; proven-older stays older, a fence at 23 does not pin, and an undetected " |
| @@ -1923,9 +1935,29 @@ int check_slot74() { | |||
| 1923 | std::uint32_t second[4] = {0x55555555, 0x66666666, 0x77777777, 0x88888888}; | 1935 | std::uint32_t second[4] = {0x55555555, 0x66666666, 0x77777777, 0x88888888}; |
| 1924 | const std::uint32_t first_before[4] = {first[0], first[1], first[2], first[3]}; | 1936 | const std::uint32_t first_before[4] = {first[0], first[1], first[2], first[3]}; |
| 1925 | const std::uint32_t second_before[4] = {second[0], second[1], second[2], second[3]}; | 1937 | const std::uint32_t second_before[4] = {second[0], second[1], second[2], second[3]}; |
| 1938 | // The title's call (a caller the classifier takes for a guest image): the stand-in. | ||
| 1939 | xs::set_console_caller([](std::uint64_t) { return true; }); | ||
| 1926 | EXPECT(hr_of(raw(device, 74, word(first), 7, word(second))) == S_OK); | 1940 | EXPECT(hr_of(raw(device, 74, word(first), 7, word(second))) == S_OK); |
| 1927 | EXPECT(mock->calls[74] == 0 && xs::device_slot_hits(74) == 1); | 1941 | EXPECT(mock->calls[74] == 0 && xs::device_slot_hits(74) == 1); |
| 1928 | EXPECT(std::memcmp(first, first_before, sizeof(first)) == 0 && std::memcmp(second, second_before, sizeof(second)) == 0); | 1942 | EXPECT(std::memcmp(first, first_before, sizeof(first)) == 0 && std::memcmp(second, second_before, sizeof(second)) == 0); |
| 1943 | // A host caller, under a classifier and with none installed: the PC slot 74 (ShaderCacheControl) with the | ||
| 1944 | // same words where the PC device has it, and the refusal past its table where it does not (found on Windows | ||
| 1945 | // in the review of this change: the stand-in used to take a host's ShaderCacheControl too). | ||
| 1946 | for (const bool installed : {true, false}) { | ||
| 1947 | if (installed) | ||
| 1948 | xs::set_console_caller([](std::uint64_t) { return false; }); | ||
| 1949 | else | ||
| 1950 | xs::set_console_caller(nullptr); | ||
| 1951 | const std::uint64_t before = mock->calls[74]; | ||
| 1952 | const HRESULT hr = hr_of(raw(device, 74, 0x1, 0x2)); | ||
| 1953 | if (level >= 9) { | ||
| 1954 | EXPECT(hr == S_OK && mock->calls[74] == before + 1); | ||
| 1955 | EXPECT(mock->args[74][0] == 0x1 && mock->args[74][1] == 0x2); | ||
| 1956 | } else { | ||
| 1957 | EXPECT(hr == E_NOTIMPL && mock->calls[74] == before); | ||
| 1958 | } | ||
| 1959 | } | ||
| 1960 | xs::set_console_caller(nullptr); | ||
| 1929 | EXPECT(release(device) == 0 && mock->refs == 0); | 1961 | EXPECT(release(device) == 0 && mock->refs == 0); |
| 1930 | } | 1962 | } |
| 1931 | return 0; | 1963 | return 0; |