Replay refused SetPredication, predicated buffer copies and D24/RGB96 footprint conversions while a
pipeline-statistics query was active (#1624 added the last), because their compute dispatches would count in the
application's CSInvocations. They now get the segment split #1519 gave resolves: the statistics query ends its
current physical segment right before the helper dispatch and begins the next right after it, and its result is
the per-counter sum of the segments. Query resolves and these helpers share one segment numbering. The markers for
non-query commands live on detail::Prepared, and emit() places them around capture_predicate,
emit_predicated_copy and the depth24 conversion parts, outside any rendering scope.
Without a statistics segment pool (the single-list replay(), or a queue without the summation helper), the three
commands are still refused while statistics are active, before any helper scratch is allocated (prepare() takes
statistics_helpers, false by default) and again in QueryReplay::plan.
Tests (Khronos validation on): vk_predicated_copy and depth24_convert run their helpers inside an otherwise empty
statistics query. Their results stay byte-exact and all 11 counters are 0. d3d12_predicated_copy compares with
WARP the same way. replay_query_predication checks the emitted order for a capture, a predicated copy, a footprint
copy and a resolve in one query, and the refusal without a pool. predicated_copy and typeless_rtv check both
preparation modes.
Co-Authored-By: OpenAI Codex <noreply@openai.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replay refused binary occlusion resolves, and ordinary resolves that need a sum, while a pipeline-statistics
query was active: their compute helper would count in the application's CSInvocations.
A statistics query that contains a resolve (other than a timestamp copy) is now split. Its counters go to
physical PIPELINE_STATISTICS segments in a pool of the submission's own (flags 0x7ff, as the device creates
the heap). A segment ends before each such resolve and the next begins after it, so no helper dispatch runs
inside the application's query. The query's result is the sum of its segments: a new 11-counter compute shader
(statistics_sum.comp, encoded in statistics_sum_spirv.h like the occlusion helpers) adds them on the
occlusion-resolve scratch buffer. That sum is a helper dispatch too, and is kept out of any statistics query
still running by the same split. Whether a resolve dispatches is only known when the list is planned against
the heaps, so every such resolve splits the query.
The single-list replay() has no segment pool. It keeps refusing a resolve that dispatches inside statistics,
and now allows a binary resolve that only writes zeros. SetPredication and predicated copies are still refused
while statistics are active.
Tests, all with the Khronos validation layer on:
- vk_binary_occlusion: a binary resolve inside one statistics query, then the statistics sum of that query
inside a second one. Every counter of both is 0. With the split disabled, CSInvocations reads 64.
- vk_overlapping_occlusion: a 261-segment occlusion sum inside a statistics query, with a native draw in each
segment. The split query, and a second one split around the statistics sum, equal two unsplit queries with the
same draws on every counter, and CSInvocations is 0.
- replay_query_predication (CPU): the exact begin/end/dispatch order of a split query, and the refusal without a
segment pool.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>