From 3f5c8bfa27debecdeb8fa2b3f64a503b95cd0222 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Sat, 7 Nov 2026 23:38:48 -0800 Subject: [PATCH] Record no coverage query in an instance of views A precise occlusion query begun in a subpass with a view mask uses one query of the pool for each view (VUID-vkCmdBeginQuery-query-00808), which would overlap the next reader's query. The snapshot path refuses passes of more than one layer, so no measured reader draws views today; the filter makes the query's recording not depend on that. (cherry picked from commit d7b0e5652610fb46d5288d53e7c514c8258860cf) --- crates/metal2vulkan-runtime/src/render.rs | 10 ++++++---- crates/metal2vulkan-runtime/src/render/coverage.rs | 5 +++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/crates/metal2vulkan-runtime/src/render.rs b/crates/metal2vulkan-runtime/src/render.rs index 461325ef2..b75739253 100644 --- a/crates/metal2vulkan-runtime/src/render.rs +++ b/crates/metal2vulkan-runtime/src/render.rs @@ -10392,10 +10392,12 @@ impl RenderLowering { }; // A measured reader's drawing commands record inside its query, into its instance or // kept with its draws where the instance is kept (`render/inline_splits.rs`); not - // those of a pipeline still being made, which a later step records, nor a replay's - // (`render/coverage.rs`). A query never recorded reads as never run. - let covered_query = - covered_query.filter(|_| made_now.is_some() && self.replayed.is_none()); + // those of a pipeline still being made, which a later step records, nor a replay's, + // nor in an instance of views, whose query would take a query of the pool for each + // view (`render/coverage.rs`). A query never recorded reads as never run. + let covered_query = covered_query.filter(|_| { + made_now.is_some() && self.replayed.is_none() && self.current.shape.view_mask == 0 + }); for &phase in phases { let counted = covered_query.filter(|_| phase != Some(snapshot::Phase::Snapshot)); if let Some((pool, query)) = counted { diff --git a/crates/metal2vulkan-runtime/src/render/coverage.rs b/crates/metal2vulkan-runtime/src/render/coverage.rs index 8e434f5a2..c5fab3f14 100644 --- a/crates/metal2vulkan-runtime/src/render/coverage.rs +++ b/crates/metal2vulkan-runtime/src/render/coverage.rs @@ -32,8 +32,9 @@ //! device, `gpu_time.rs`): its readers are weighed by the area rule alone. Nor while a //! visibility query of the program's is active, which the rule's checks already refuse the //! snapshot for (one occlusion query is active at a time); nor a reader whose pipeline was still -//! being made (a later step records its draw) or that a replay records, nor past [`MEASURED`] -//! readers of a pass. An instance recorded inline after a split keeps the query's begin and end +//! being made (a later step records its draw), that a replay records or that draws views (a +//! query in a subpass of views takes one of the pool for each), nor past [`MEASURED`] readers of +//! a pass. An instance recorded inline after a split keeps the query's begin and end //! with its draws (`render/inline_splits.rs`), recorded once with them. A query whose commands //! never ran (an instance a reroute replaced, `render/reroute.rs`) reads as unavailable and //! teaches nothing. A draw that is no such reader records nothing and makes no pool.