Skip to content

runtime(zones,#804): Metal — MODE_ZONES composite, binary wish, opt-in feather - #811

Open
dfattal wants to merge 1 commit into
mainfrom
zones-804-metal
Open

runtime(zones,#804): Metal — MODE_ZONES composite, binary wish, opt-in feather#811
dfattal wants to merge 1 commit into
mainfrom
zones-804-metal

Conversation

@dfattal

@dfattal dfattal commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Metal leg of #804 (leg 4; legs 1-3 = #808/#809/#810). Mirrors the VK reference (#801/#803) onto comp_metal_compositor.m.

#801

  • masked_composite_fragment: alpha_overcomposite_mode (2 = MODE_ZONES: twod + (1−a)·(M·weave)).
  • Auto wish CPU raster goes binary (no 16px distance ramp).
  • Composite mask is always the binary zone raster; an explicit frame wish stages and routes to the DP publish only.

#803

  • New metal_update_zone_feather_mask (own CPU buffer + texture): per-zone hard or true per-pixel inward distance ramp clamp(dist_inside/radius) — the Metal CPU idiom (smoother profile than the GPU legs' stepped rings), max() across overlapping zones. Published wish stays binary; failure falls back binary.

One-shot Metal Local2D composite … (mode=N) log.

Verification

  • Compile: macOS CI (this branch was authored on the win box).
  • Hardware/eyeball: cube_zones_texture_metal_macos on the mac box — expected deltas: hard zone edges unless feather requested; Local2D overlays composite by alpha inside zones. Legacy frames pixel-identical (zones_frame-gated).

⚠️ HW-behavior change — needs the mac-box eyeball before merge.

Refs #800 #801 #803 #804.

🤖 Generated with Claude Code

…one opt-in feather

Metal leg of the #801/#803 backend-parity port (mirrors the VK reference
and the D3D11/D3D12 legs, #809/#810):

#801:
- masked_composite_fragment: alpha_over -> composite_mode (0 hard M-lerp /
  1 #491 premul over / 2 MODE_ZONES: final = twod + (1-a)*(M*weave)).
- The auto wish CPU raster goes BINARY (memset 255 per zone rect, no 16px
  distance ramp) - the wish is HARDWARE-only (ADR-027), hard by default
  (#800).
- The composite mask is ALWAYS the binary zone raster; an explicit frame
  wish stages (replaceRegion of current authored bytes) and routes to the
  DP publish only - never a compositor blend gate.

#803 (XrDisplayZoneFeatherDXR):
- New metal_update_zone_feather_mask into its own CPU buffer + texture:
  per-zone hard (255) or TRUE per-pixel inward distance ramp
  clamp(dist_inside/radius) - the Metal CPU idiom, smoother profile than
  the GPU legs' stepped rings - max() across overlapping zones.
  Dirty-checked on rects + radii + dims; published wish stays binary;
  raster failure falls back to the binary mask.

One-shot "Metal Local2D composite ... (mode=N)" log. Legacy frames
byte-identical (zones_frame-gated; LERP/ALPHA_OVER semantics unchanged).

Compile check rides the macOS CI (no Metal toolchain on this box);
hardware eyeball on the mac box with cube_zones_texture_metal_macos.

Refs #800, #801, #803.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant