From c4ed0bd44b1dc4ee2e73d914120edc6c49554f4a Mon Sep 17 00:00:00 2001 From: Yahia Date: Mon, 9 Nov 2026 17:36:22 +0200 Subject: [PATCH 1/2] render: a draw recorded again draws through its own scissor rectangles Upstream a96bd76fe (Keep a draw's shape across scissor rectangle changes) moved the encoder's scissor rectangles out of EncoderState into RenderLowering::scissors. The reroute path keeps each draw's state (Held) to record the draw again into a new instance (record_again), but Held carried only EncoderState, so a draw recorded again took the encoder's latest rectangles instead of its own. A compositor that sets a rectangle before each draw then clips every earlier draw of a rerouted pass to the last draw's rectangle: on an iOS 26 guest about half the home-screen icons lost their background layer and mask (dark squares) or kept only stripes of tiles. Held now carries the rectangles beside the state and swaps them in and out with it. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01N89PWgUk6UZA5XLsSpPvFY --- crates/metal2vulkan-runtime/src/render/reroute.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/metal2vulkan-runtime/src/render/reroute.rs b/crates/metal2vulkan-runtime/src/render/reroute.rs index 6e2fb01fd..19e9b279d 100644 --- a/crates/metal2vulkan-runtime/src/render/reroute.rs +++ b/crates/metal2vulkan-runtime/src/render/reroute.rs @@ -41,7 +41,7 @@ use crate::argument_table::ArgumentTable; use crate::draw_source::{DrawSource, KeptSource}; use crate::error::Error; use crate::pipeline::{GraphicsState as DrawingState, RenderPipelineState}; -use crate::render_state::EncoderState; +use crate::render_state::{EncoderState, ScissorRects}; use crate::render_target::PassShape; use crate::residency::Residency; use metal2vulkan::bind::{DrawCall, ViewSetup}; @@ -66,6 +66,9 @@ pub(super) struct Rerecord { struct Held { pipeline: Option, state: EncoderState, + /// The scissor rectangles, which live apart from `state` (`ScissorRects`): a draw recorded + /// again draws through the rectangles it was drawn through, not the encoder's latest. + scissors: ScissorRects, vertex: ArgumentTable, fragment: ArgumentTable, residency: Residency, @@ -237,6 +240,7 @@ impl RenderLowering { Held { pipeline: self.pipeline.clone(), state: self.state.clone(), + scissors: self.scissors.clone(), vertex: self.vertex.clone(), fragment: self.fragment.clone(), residency: self.residency.clone(), @@ -248,6 +252,7 @@ impl RenderLowering { fn swap_held(&mut self, held: &mut Held) { std::mem::swap(&mut self.pipeline, &mut held.pipeline); std::mem::swap(&mut *self.state, &mut held.state); + std::mem::swap(&mut self.scissors, &mut held.scissors); std::mem::swap(&mut self.vertex, &mut held.vertex); std::mem::swap(&mut self.fragment, &mut held.fragment); std::mem::swap(&mut self.residency, &mut held.residency); From 54cc4f817c7495a1656e0c5de71f37e9915ecf3a Mon Sep 17 00:00:00 2001 From: Yahia Date: Mon, 9 Nov 2026 22:15:31 +0200 Subject: [PATCH 2/2] cache: RUNTIME_VERSION 1776 for a rerouted draw's own scissor rectangles The previous commit changes what a run records: a draw recorded again into a new pass instance draws through the scissor rectangles it was drawn through, not the encoder's latest. Bump the runtime version and pin the runtime sources' new hash. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01N89PWg24VJrcxX3MuUo4uM --- crates/metal2vulkan-validation/runtime-sources.sha256 | 2 +- crates/metal2vulkan/src/cache/mod.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/metal2vulkan-validation/runtime-sources.sha256 b/crates/metal2vulkan-validation/runtime-sources.sha256 index aae669461..6ff1fff6e 100644 --- a/crates/metal2vulkan-validation/runtime-sources.sha256 +++ b/crates/metal2vulkan-validation/runtime-sources.sha256 @@ -1 +1 @@ -9619c57fb359f9f0971921f343956fc35d11d17dc3b72e95fc58206843a83321 +451107a4d48d6b0e237f471a2bc792657e308ccff052909bd6cf657a01129445 diff --git a/crates/metal2vulkan/src/cache/mod.rs b/crates/metal2vulkan/src/cache/mod.rs index 25ca111f0..be1d86dc7 100644 --- a/crates/metal2vulkan/src/cache/mod.rs +++ b/crates/metal2vulkan/src/cache/mod.rs @@ -93,7 +93,7 @@ pub const ARTIFACT_FORMAT_VERSION: u32 = 489; /// changes no behaviour, and then updates that hash alone with the commit saying why, or changes /// behaviour and also bumps this version. The commit that bumps it says what changed; this comment /// keeps no history. -pub const RUNTIME_VERSION: u32 = 1775; +pub const RUNTIME_VERSION: u32 = 1776; /// The digest of the sources this build of the crate was compiled from: SHA-256, as lowercase hex, /// of the manifest, the build script, and exactly the files the crate roots' module tree compiles