Skip to content

fix(layers): sdf text outline in webgpu - #10640

Merged
Pessimistress merged 1 commit into
masterfrom
x/webgpu-sdf-fix
Sep 3, 2026
Merged

Pessimistress merged 1 commit into
masterfrom
x/webgpu-sdf-fix

Conversation

@Pessimistress

Copy link
Copy Markdown
Collaborator

TextLayer draws the same model twice with different uniforms.

Change List

  • Use separate models for text fill / outline in WebGPU
  • Remove WebGPU override and match render test against WebGL golden image

@greptile-apps

greptile-apps Bot commented Sep 2, 2026

Copy link
Copy Markdown

Greptile Summary

The PR fixes WebGPU SDF text outlines by giving the fill and outline passes separate models, preventing one pass from overwriting the other’s uniforms.

  • Extracts IconLayer._drawModel so callers can draw a specified model with shared icon setup.
  • Creates and manages a dedicated WebGPU fill model in MultiIconLayer.
  • Removes the WebGPU-specific golden image so the render test uses the shared WebGL result.

Confidence Score: 5/5

The PR appears safe to merge; no concrete correctness, lifecycle, or rendering-state defect remains in the changed paths.

The dedicated fill model is created whenever the primary model is initialized or rebuilt, participates in shared model configuration, and is destroyed through the normal layer lifecycle, while WebGL retains the existing single-model behavior.

Important Files Changed

Filename Overview
modules/layers/src/icon-layer/icon-layer.ts Refactors the existing icon draw setup into a protected model-specific helper and allows callers to assign distinct model IDs.
modules/layers/src/text-layer/multi-icon-layer/multi-icon-layer.ts Adds lifecycle-managed WebGPU fill-model state and routes the second SDF pass through that separate model.
test/render/golden-images/platform-overrides/webgpu/text-layer-sdf-outline.png Removes the backend-specific expected image so WebGPU must match the shared text-outline visual contract.

Sequence Diagram

sequenceDiagram
  participant Layer as MultiIconLayer
  participant Outline as Outline Model
  participant Fill as Fill Model
  participant GPU as WebGPU Render Pass
  Layer->>Outline: Set outline SDF uniforms
  Layer->>Outline: Draw outlined glyphs
  Layer->>Fill: Set fill SDF uniforms
  Layer->>Fill: Draw glyph fill
  Outline->>GPU: Record outline pass
  Fill->>GPU: Record fill pass
Loading

Reviews (1): Last reviewed commit: "Fix sdf text outline in webgpu" | Re-trigger Greptile

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 82.497% (+0.02%) from 82.481% — x/webgpu-sdf-fix into master

@Pessimistress
Pessimistress merged commit b3099de into master Sep 3, 2026
7 checks passed
@Pessimistress
Pessimistress deleted the x/webgpu-sdf-fix branch September 3, 2026 17:31
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.

3 participants