Tidy-ups: replay event, timeline after end, VICTORY_WATCH, validator status

- Replay: a Worker closes its fence event when dropped (one leaked per
  256 MiB upload batch in diagnostics builds).
- Timeline: put_of and stack write nothing once recording has ended, so
  events that straddle end() no longer land in the next recording.
- VICTORY_WATCH: rva + 4 is checked, as VICTORY_CRASH_SAVE's ranges are
  (a huge RVA in the list wrapped instead of being dropped).
- Validator: a failed GetStatus is an error, not a pass, and an error blob
  with a null pointer reads as empty instead of building a slice from null.

Port of avatarmanz/VIctory-7900XTX#319 (its issue #227).

(cherry picked from commit 8db88ce6fe40cdd03bc9f9b66fb5d31c92bd246d)
This commit is contained in:
illuminatedfellow authored and trustno1-coder committed 2026-11-27 17:29:35 -08:00
1 parent 0dd34bdbe6
commit c12c4959a5
4 files changed
+28 -3

No files matched your search

+9
View File
@@ -23,6 +23,15 @@ pub(super) struct Worker {
// at a time (`&mut self`).
unsafe impl Send for Worker {}
impl Drop for Worker {
fn drop(&mut self) {
// SAFETY: our event.
unsafe {
let _ = windows::Win32::Foundation::CloseHandle(self.event);
}
}
}
impl Worker {
pub(super) fn new(device: &ID3D12Device, queue: &ID3D12CommandQueue) -> Result<Worker> {
// SAFETY: plain object creation.
@@ -117,6 +117,10 @@ pub(super) fn put(kind: Kind, name: &'static str, t: (u64, u64), a: u64, b: u64,
/// Records an event of `thread`.
fn put_of(thread: u32, kind: Kind, name: &'static str, (t0, t1): (u64, u64), a: u64, b: u64, stack: u32) {
// After `end`, a place would be one of the next recording's.
if !on() {
return;
}
let slots = SLOTS.load(Ordering::Acquire);
if slots.is_null() {
return;
@@ -138,6 +142,9 @@ fn put_of(thread: u32, kind: Kind, name: &'static str, (t0, t1): (u64, u64), a:
/// The caller's stack: its place, plus one.
fn stack() -> u32 {
if !on() {
return 0;
}
let stacks = STACK.load(Ordering::Acquire);
if stacks.is_null() {
return 0;