diff options
| author | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-25 18:36:19 -0500 |
|---|---|---|
| committer | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-25 18:36:19 -0500 |
| commit | 3a2820b3bff812ff3cff6a4d4087912edb0541bb (patch) | |
| tree | ab2522760b3930781a3531f7ded56ba449041e77 /runtime/src/dev_status.h | |
| parent | 75f6890bb98214d5112c7eb1126f67f9e2948a0a (diff) | |
| parent | c1e1ef0b81234ac46ca25a810ab81219408ea6ba (diff) | |
Merge main c1e1ef0b8 into RT-POST-LOAD-GPU-MEMORY (#2098)
Two conflicts:
- d3d12_com.cpp, note_direct_heap_indexing: main's console_descriptor_table_va(cbv_srv_uav_base_) for the tracked
table, with this branch's per-site once() flag instead of note_once on every draw.
- d3d12_vulkan_device.cpp, PipelineState::build_compute: this branch's body (build_compute_pipeline, journal, compile
helper). main's dev_status::Build around the compute create moves into build_compute_pipeline, next to the
pipeline_profile::DriverCall, so the status line still names the compute pipeline in the driver.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src/dev_status.h')
| -rw-r--r-- | runtime/src/dev_status.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/runtime/src/dev_status.h b/runtime/src/dev_status.h new file mode 100644 index 000000000..3efc9bf4f --- /dev/null +++ b/runtime/src/dev_status.h | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | #pragma once | ||
| 2 | // What the runtime is building now, for the dev overlay (dev_overlay.h). Always on: two relaxed atomics a build, and a | ||
| 3 | // short copy under a lock for the name. | ||
| 4 | #include <algorithm> | ||
| 5 | #include <atomic> | ||
| 6 | #include <cstdint> | ||
| 7 | #include <cstring> | ||
| 8 | #include <mutex> | ||
| 9 | #include <string> | ||
| 10 | |||
| 11 | namespace leonida::dev_status { | ||
| 12 | |||
| 13 | struct Builds { | ||
| 14 | std::atomic<unsigned> active{0}; | ||
| 15 | std::atomic<std::uint64_t> done{0}; | ||
| 16 | |||
| 17 | std::string last() { | ||
| 18 | std::lock_guard lock(mutex_); | ||
| 19 | return name_; | ||
| 20 | } | ||
| 21 | void name(const char* text) { | ||
| 22 | std::lock_guard lock(mutex_); | ||
| 23 | const std::size_t n = std::min(std::strlen(text), sizeof name_ - 1); | ||
| 24 | std::memcpy(name_, text, n); | ||
| 25 | name_[n] = 0; | ||
| 26 | } | ||
| 27 | |||
| 28 | private: | ||
| 29 | std::mutex mutex_; | ||
| 30 | char name_[96]{}; | ||
| 31 | }; | ||
| 32 | inline Builds& builds() { | ||
| 33 | static Builds instance; | ||
| 34 | return instance; | ||
| 35 | } | ||
| 36 | |||
| 37 | // One pipeline build, from construction to destruction. | ||
| 38 | struct Build { | ||
| 39 | explicit Build(const char* name) { | ||
| 40 | builds().name(name); | ||
| 41 | builds().active.fetch_add(1, std::memory_order_relaxed); | ||
| 42 | } | ||
| 43 | ~Build() { | ||
| 44 | builds().active.fetch_sub(1, std::memory_order_relaxed); | ||
| 45 | builds().done.fetch_add(1, std::memory_order_relaxed); | ||
| 46 | } | ||
| 47 | Build(const Build&) = delete; | ||
| 48 | Build& operator=(const Build&) = delete; | ||
| 49 | }; | ||
| 50 | |||
| 51 | } // namespace leonida::dev_status | ||