fix: MSAA resolve no longer overwrites widget backgrounds

MSAA and depth textures are now sized to the shader widget's clip
bounds instead of the full surface. The resolve writes to a matching
clip-sized intermediate texture; a blit pass (blit.wgsl, viewport
trick) then copies the result to the exact clip region of the surface
target, leaving all other widgets untouched.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Sonnet 4.6 committed 2026-04-08 12:20:47 +03:00
1 parent c12b30ad3d
commit 42048362e2
3 files changed
+235 -47

No files matched your search

+10 -3
View File
@@ -132,9 +132,16 @@ impl shader::Primitive for Primitive {
viewport: &Viewport,
) {
let phys = viewport.physical_size();
let size = Size::new(phys.width, phys.height);
pipeline.ensure_depth_texture(device, size);
pipeline.viewcube.ensure_depth_texture(device, size);
let full_size = Size::new(phys.width, phys.height);
// MSAA and depth textures are sized to the shader widget's clip bounds,
// not the full surface — so the MSAA resolve can't overwrite other widgets.
let scale = viewport.scale_factor() as f32;
let clip_size = Size::new(
(_bounds.width * scale).ceil() as u32,
(_bounds.height * scale).ceil() as u32,
);
pipeline.ensure_depth_texture(device, clip_size);
pipeline.viewcube.ensure_depth_texture(device, full_size);
pipeline.upload_uniforms(queue, &self.uniforms);
pipeline.upload_hatches(device, &self.hatches);
pipeline.upload_wipeouts(device, &self.wipeout_hatches);