upleb.uk

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

summaryrefslogtreecommitdiff
path: root/runtime/shims/d3d12_com.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/shims/d3d12_com.cpp')
-rw-r--r--runtime/shims/d3d12_com.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/runtime/shims/d3d12_com.cpp b/runtime/shims/d3d12_com.cpp
index 4f4904e96..8be31b940 100644
--- a/runtime/shims/d3d12_com.cpp
+++ b/runtime/shims/d3d12_com.cpp
@@ -1658,7 +1658,7 @@ public:
1658 for (const auto& command : list.commands().commands()) { 1658 for (const auto& command : list.commands().commands()) {
1659 const auto range = leonida::query_range(command); 1659 const auto range = leonida::query_range(command);
1660 if (range.count && range.type == leonida::d3d12_query::timestamp && 1660 if (range.count && range.type == leonida::d3d12_query::timestamp &&
1661 context_.query_heap_type(range.heap) == other) 1661 (!timestamp_family_supported() || context_.query_heap_type(range.heap) == other))
1662 return false; 1662 return false;
1663 } 1663 }
1664 return true; 1664 return true;
@@ -1717,16 +1717,20 @@ public:
1717 } 1717 }
1718 1718
1719 // Ticks per second of the timestamps EndQuery writes: one tick is timestampPeriod nanoseconds. Every D3D12 1719 // Ticks per second of the timestamps EndQuery writes: one tick is timestampPeriod nanoseconds. Every D3D12
1720 // queue of the device shares one VkQueue, so they share one frequency. E_FAIL when that queue has no 1720 // device has one timestamp period, but individual queue families may not write timestamps.
1721 // timestamps (timestampValidBits 0), as D3D12 reports for a queue that does not support them.
1722 HRESULT STDMETHODCALLTYPE GetTimestampFrequency(UINT64* frequency) override { 1721 HRESULT STDMETHODCALLTYPE GetTimestampFrequency(UINT64* frequency) override {
1723 if (!frequency) return E_INVALIDARG; 1722 if (!frequency) return E_INVALIDARG;
1724 const double period = context_.timestamp_period(); 1723 const double period = context_.timestamp_period();
1725 if (!(period > 0)) return E_FAIL; 1724 if (!(period > 0) || !timestamp_family_supported()) return E_FAIL;
1726 *frequency = static_cast<UINT64>(1e9 / period + 0.5); 1725 *frequency = static_cast<UINT64>(1e9 / period + 0.5);
1727 return S_OK; 1726 return S_OK;
1728 } 1727 }
1729 1728
1729 bool timestamp_family_supported() const {
1730 // The low-level queue factory also accepts caller-owned queues without a QueueClock.
1731 return !clock_.get_device_proc || clock_.timestamp_valid_bits != 0;
1732 }
1733
1730 // Queue labels, in order with the submissions around them. 1734 // Queue labels, in order with the submissions around them.
1731 void STDMETHODCALLTYPE SetMarker(UINT metadata, const void* data, UINT size) override { 1735 void STDMETHODCALLTYPE SetMarker(UINT metadata, const void* data, UINT size) override {
1732 d3d12_trace::record("ID3D12CommandQueue::SetMarker"); 1736 d3d12_trace::record("ID3D12CommandQueue::SetMarker");