diff options
| author | QemmHD <stephenlethco2@gmail.com> | 2026-11-24 19:02:38 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-11-24 19:02:38 -0500 |
| commit | 706f5429e16f08c8defc45675f524d413656ed70 (patch) | |
| tree | 05850c5f893c2295855dfdf8208a1f1a6ac8371f /runtime/shims/d3d12_com.cpp | |
| parent | af868171d918dfdf7581fee99e87886dc110763a (diff) | |
| parent | be010a409c24c5732c3dc6122f28f2a493a5afc6 (diff) | |
Merge pull request #1154 from PyZikYG/copy-queue-timestamp-support
Merging.
**Why merged:** D3D-COPY-TIMESTAMP-CAPS: timestamp bits are tracked per queue family, and transfer-only families count as 0 bits because they can't reset or resolve queries. This was the first native Windows run of the fixed head; madhyn's Wine run was on an older head, and KernelSmoker ran vk_queue on Linux. Behaviour change: OPTIONS3.CopyQueueTimestampQueriesSupported can now be TRUE, and a copy queue that gets a transfer-only family returns E_FAIL from GetTimestampFrequency and GetClockCalibration instead of borrowing the graphics family's bits.
**Why it's good:** d3d12_vulkan_device, d3d12_query_rules, vk_queue, vk_queue_query_sync and vk_queue_constructor_oom: 5/5 both plain and under validation on the 4070 SUPER.
Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Merged alone onto main 0f98d193c, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative with the rest of this batch on main 507029d1e: the repo-consistency set gives 578 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 317/318 with the usual 11 skips; the only failure is main's pre-existing d3d12_depth_resolve. All d3d12_* tests under validation: 119/120 with 0 VUIDs. The semantic suite has only the known environment-only failure. git merge-tree against current main 9c5e70661: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes.
AI-assisted (Claude Code, Claude Opus 5.5).
Diffstat (limited to 'runtime/shims/d3d12_com.cpp')
| -rw-r--r-- | runtime/shims/d3d12_com.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/runtime/shims/d3d12_com.cpp b/runtime/shims/d3d12_com.cpp index 7c5244141..3adb31549 100644 --- a/runtime/shims/d3d12_com.cpp +++ b/runtime/shims/d3d12_com.cpp | |||
| @@ -1731,7 +1731,7 @@ public: | |||
| 1731 | for (const auto& command : list.commands().commands()) { | 1731 | for (const auto& command : list.commands().commands()) { |
| 1732 | const auto range = leonida::query_range(command); | 1732 | const auto range = leonida::query_range(command); |
| 1733 | if (range.count && range.type == leonida::d3d12_query::timestamp && | 1733 | if (range.count && range.type == leonida::d3d12_query::timestamp && |
| 1734 | context_.query_heap_type(range.heap) == other) | 1734 | (!timestamp_family_supported() || context_.query_heap_type(range.heap) == other)) |
| 1735 | return false; | 1735 | return false; |
| 1736 | } | 1736 | } |
| 1737 | return true; | 1737 | return true; |
| @@ -1790,16 +1790,20 @@ public: | |||
| 1790 | } | 1790 | } |
| 1791 | 1791 | ||
| 1792 | // Ticks per second of the timestamps EndQuery writes: one tick is timestampPeriod nanoseconds. Every D3D12 | 1792 | // Ticks per second of the timestamps EndQuery writes: one tick is timestampPeriod nanoseconds. Every D3D12 |
| 1793 | // queue of the device shares one VkQueue, so they share one frequency. E_FAIL when that queue has no | 1793 | // device has one timestamp period, but individual queue families may not write timestamps. |
| 1794 | // timestamps (timestampValidBits 0), as D3D12 reports for a queue that does not support them. | ||
| 1795 | HRESULT STDMETHODCALLTYPE GetTimestampFrequency(UINT64* frequency) override { | 1794 | HRESULT STDMETHODCALLTYPE GetTimestampFrequency(UINT64* frequency) override { |
| 1796 | if (!frequency) return E_INVALIDARG; | 1795 | if (!frequency) return E_INVALIDARG; |
| 1797 | const double period = context_.timestamp_period(); | 1796 | const double period = context_.timestamp_period(); |
| 1798 | if (!(period > 0)) return E_FAIL; | 1797 | if (!(period > 0) || !timestamp_family_supported()) return E_FAIL; |
| 1799 | *frequency = static_cast<UINT64>(1e9 / period + 0.5); | 1798 | *frequency = static_cast<UINT64>(1e9 / period + 0.5); |
| 1800 | return S_OK; | 1799 | return S_OK; |
| 1801 | } | 1800 | } |
| 1802 | 1801 | ||
| 1802 | bool timestamp_family_supported() const { | ||
| 1803 | // The low-level queue factory also accepts caller-owned queues without a QueueClock. | ||
| 1804 | return !clock_.get_device_proc || clock_.timestamp_valid_bits != 0; | ||
| 1805 | } | ||
| 1806 | |||
| 1803 | // Queue labels, in order with the submissions around them. | 1807 | // Queue labels, in order with the submissions around them. |
| 1804 | void STDMETHODCALLTYPE SetMarker(UINT metadata, const void* data, UINT size) override { | 1808 | void STDMETHODCALLTYPE SetMarker(UINT metadata, const void* data, UINT size) override { |
| 1805 | d3d12_trace::record("ID3D12CommandQueue::SetMarker"); | 1809 | d3d12_trace::record("ID3D12CommandQueue::SetMarker"); |