Query resolves: never write results the host refused #1746

Closed
github-bot wants to merge 2 commits from gh-pr/1746/head into gh-pr/1746/base
Owner

@⁠kais7654 on GitHub · 2026-11-24 21:53 UTC · original
kais7654:query-resolve-range-fix → main · +354 −18 · 4 files · 2 commits · closed without merging

Stacked on #1731 (base branch is that PR's head, since this fixes it).

resolve_queries took the measured path without checking whether the
resolve's range fits the heap. A range ResolveQueryData refuses (past
the heap's count, or count == 0) leaves the read-back buffer untouched
with undefined contents, and those garbage u64s still went into the
title's memory — worse than the stubs' plausible values. The measured
path now also asks range_fits (first + count against the heap's
count), and a refused range keeps the stub path.

A failing Map of a read-back buffer also logs now, like the other
deferred failures, instead of dropping the results in silence.

Verified: cargo check, cargo clippy and cargo test -p victory-gpu
(51 passed, including #1731's occlusion test). The full workspace test
suite could not finish here for lack of disk space; nothing outside
victory-gpu is touched.

**@⁠kais7654** on GitHub · 2026-11-24 21:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/1746) `kais7654:query-resolve-range-fix` → `main` · +354 −18 · 4 files · 2 commits · closed without merging Stacked on #1731 (base branch is that PR's head, since this fixes it). `resolve_queries` took the measured path without checking whether the resolve's range fits the heap. A range `ResolveQueryData` refuses (past the heap's count, or count == 0) leaves the read-back buffer untouched with undefined contents, and those garbage u64s still went into the title's memory — worse than the stubs' plausible values. The measured path now also asks `range_fits` (first + count against the heap's count), and a refused range keeps the stub path. A failing `Map` of a read-back buffer also logs now, like the other deferred failures, instead of dropping the results in silence. Verified: `cargo check`, `cargo clippy` and `cargo test -p victory-gpu` (51 passed, including #1731's occlusion test). The full workspace test suite could not finish here for lack of disk space; nothing outside `victory-gpu` is touched.
BeginQuery and EndQuery both went to the same no-op, so the two could not be
told apart, and ResolveQueryData answered every occlusion query with a fixed
1<<20 samples (1 for the binary form): the title's occlusion culling and its
dynamic resolution therefore could not work, which costs overdraw in every
world frame.

An occlusion heap now also makes the host's own heap of the same count, the
list marks Begin/End on the host list, and ResolveQueryData resolves into a
read-back buffer whose contents are written into the title's memory once the
submission that filled it has finished. The other query kinds keep their
plausible-value path, since nothing measures them yet.

The test runs an occlusion query around no draws through our own heaps, list
and queue: the title's buffer receives zeros, where the old stub wrote
1048576.
A resolve whose range the heap refuses used to take the measured path
anyway, and the title's memory then received whatever the untouched
read-back buffer held, instead of the stubs' plausible values. The
range is now checked against the heap's count before the measured path
is taken, and a read-back buffer that fails to map is logged.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:43:30 +00:00
github-bot closed this pull request 2026-11-26 04:43:30 +00:00

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1746
No description provided.