Skip to content

Port FillStyleExtension patterns to WebGPU - #11024

Merged
ibgreen merged 2 commits into
masterfrom
codex/fill-style-webgpu
Nov 4, 2026
Merged

ibgreen merged 2 commits into
masterfrom
codex/fill-style-webgpu

Conversation

@ibgreen

@ibgreen ibgreen commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Background

FillStyle patterns use GLSL today. This adds the corresponding WebGPU shader plugin for atlas fills and procedural patterns.

Change List

  • Bind pattern attributes and varyings through luma.gl shader plugins
  • Sample atlas patterns with gradients before fragment discards
  • Render procedural hatches, cross-hatches, and dots
  • Preserve procedural parameters in a WebGPU integer texture

Verified: full build, lint, and diff check passed. WebGPU rendering and visual parity still need verification.


Note

Low Risk
Low risk, as changes are scoped to FillStyleExtension WebGPU shader definitions and maintain backward compatibility with the existing WebGL path.

Overview
Adds WebGPU support to FillStyleExtension, implementing texture atlas sampling and procedural fills (hatches, cross-hatches, and dots) via WGSL shaders.

The extension now selects between the existing GLSL shader plugin and a new WGSL plugin based on the device type. On WebGPU, procedural pattern uniforms are stored in an rg32uint texture and bitcast to f32 during vertex lookups, avoiding dependencies on optional floating-point filtering features.

Reviewed by Cursor Bugbot for commit 1554964. Bugbot is set up for automated code reviews on this repo. Configure here.

@coveralls

coveralls commented Nov 4, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 84.661% (-0.007%) from 84.668% — codex/fill-style-webgpu into master

@ibgreen
ibgreen marked this pull request as ready for review November 4, 2026 14:39
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-11-04T14:39:51.568891Z
We couldn’t complete this review. Comment @codex review to try again.
1554964 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@ibgreen
ibgreen merged commit f2dcaea into master Nov 4, 2026
9 checks passed
@ibgreen
ibgreen deleted the codex/fill-style-webgpu branch November 4, 2026 14:40
@greptile-apps

greptile-apps Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The change reaches fill layers that use FillStyleExtension for pattern rendering.

Fix the shader argument type and add the required release-note entry before merging.

Findings

  1. P1 Pattern shaders cannot compile ▶
  2. P2 Tests skip WebGPU patterns ▶
  3. P2 Release notes omit new support ▶

Summary

Adds WebGPU atlas fills and procedural hatches, cross-hatches, and dots to FillStyleExtension.

  • Fill layers can render atlas and procedural patterns on WebGPU.

No runtime or visual verification was performed.

Reviews (1) · Last reviewed commit: "Extract backend-aware float parameter te..." · Reviewed by Greptile

'wgsl:vs:DECKGL_FILTER_GL_POSITION': /* wgsl */ `
if (fill.patternEnabled != 0) {
let cameraFlatX = project_common_position_to_flat(project.cameraPosition).x;
let flatPosition = project_common_position_to_flat_continuous(geometry.position, cameraFlatX);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Pattern shaders cannot compile

project_common_position_to_flat_continuous takes a vec3<f32>, but this call passes geometry.position, which is a vec4<f32>. WGSL does not convert between these types automatically. Any WebGPU layer using the pattern plugin will fail shader validation, for both atlas and procedural patterns. Pass geometry.position.xyz instead.

Suggested change
let flatPosition = project_common_position_to_flat_continuous(geometry.position, cameraFlatX);
let flatPosition = project_common_position_to_flat_continuous(geometry.position.xyz, cameraFlatX);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Still on master (shader-module.wgsl.ts:131). A WebGPU layer with FillStyleExtension({pattern: true}) or proceduralPattern: true fails shader validation. webgpu.md still marks FillStyle ❌, so no page promises it yet.

  • A reduced shader with this call and the WGSL VertexGeometry struct fails in Chrome WebGPU: "type mismatch for argument 1 ... expected 'vec3', got 'vec4'". With .xyz it compiles.
  • Every fill-pattern render case still skips WebGPU (fill-pattern.spec.ts:101-341), so CI can't catch it.

Could we apply the suggestion above and enable one atlas case and one procedural case on WebGPU?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes—both are warranted. The .xyz change addresses the shader-validation error. The existing fill-style.spec.ts cases are guarded by webglTest, so they won’t exercise the WGSL plugin; add targeted WebGPU smoke cases that compile and render one atlas pattern and one procedural pattern. For the procedural case, account for the WebGPU texture format (rg32uint), rather than the current WebGL-only rg32float assertion.

Suggested change
let flatPosition = project_common_position_to_flat_continuous(geometry.position, cameraFlatX);
let flatPosition = project_common_position_to_flat_continuous(geometry.position.xyz, cameraFlatX);

I can’t apply the changes or run the tests from this read-only review thread.

Comment on lines +140 to +142
plugins: extension.opts.pattern
? [this.context.device.type === 'webgpu' ? patternPluginWGSL : patternPlugin]
: [],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Tests skip WebGPU patterns

The new WebGPU path has no enabled fill-pattern render coverage. The existing atlas, procedural, orientation, and globe cases still skip WebGPU, and the layer tests also run only on WebGL. Enable representative atlas and procedural render cases for WebGPU so shader failures and visual differences are caught automatically.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!


The `FillStyleExtension` adds selected features to layers that render a "fill", such as the `PolygonLayer` and `ScatterplotLayer`.

The WebGPU port covers texture atlas patterns and procedural hatches, cross-hatches, and dots.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Release notes omit new support

This adds a new-support announcement to the API reference without adding it to docs/whats-new.md. The repository rule requires newly added support to be documented in docs/whats-new.md. Add an entry under Unreleased before merging so readers can discover the WebGPU support.

Rule Used: In the deck.gl repository, use Remarks sections only for user-facing, actionable limitations; document newly added support in docs/whats-new.md instead. (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@chrisgervang chrisgervang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1554964 after merge; follow-ups below. One P1: WebGPU pattern shaders fail validation (reply in the existing thread on shader-module.wgsl.ts:131).

P2: developer-guide/webgpu.md is stale for the extension ports. Line 93 says "Most remain WebGL-only". Row 98 says countItems requires WebGL (#11035 added it). Row 103 marks CollisionFilter ❌ (#11026 ported it), and row 121 says other extensions still need migration. Row 101 (FillStyle ❌) is right until the shader fix lands. Line 78 says text backgrounds need WebGL, but most text-layer background render cases run on WebGPU. Could one pass on the page use the text below? whats-new "Extension updates" lists only the Mask port, and one bullet linking to this table would cover the rest.

The table below covers the public extensions in `@deck.gl/extensions`. Custom layers support them on WebGPU by calling the [extension injection targets](./custom-layers/layer-extensions.md#webgpu-shader-plugins). ScreenGridLayer and GridLayer apply `DataFilterExtension` and `ClipExtension` to input points before aggregating.

| `@deck.gl/extensions` | `DataFilterExtension` | ✅ | ✅ |
| `@deck.gl/extensions` | `FillStyleExtension` | ✅ | ✅ |
| `@deck.gl/extensions` | `CollisionFilterExtension` | ✅ | ✅ |

| Shader injection targets / layer extensions | ✅ | Standard primitives call the shared injection targets on WebGPU. |

Labels: P1 settle before this is merged, P2 can follow, Non-blocking optional.

'wgsl:vs:DECKGL_FILTER_GL_POSITION': /* wgsl */ `
if (fill.patternEnabled != 0) {
let cameraFlatX = project_common_position_to_flat(project.cameraPosition).x;
let flatPosition = project_common_position_to_flat_continuous(geometry.position, cameraFlatX);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Still on master (shader-module.wgsl.ts:131). A WebGPU layer with FillStyleExtension({pattern: true}) or proceduralPattern: true fails shader validation. webgpu.md still marks FillStyle ❌, so no page promises it yet.

  • A reduced shader with this call and the WGSL VertexGeometry struct fails in Chrome WebGPU: "type mismatch for argument 1 ... expected 'vec3', got 'vec4'". With .xyz it compiles.
  • Every fill-pattern render case still skips WebGPU (fill-pattern.spec.ts:101-341), so CI can't catch it.

Could we apply the suggestion above and enable one atlas case and one procedural case on WebGPU?

@ibgreen ibgreen mentioned this pull request Nov 19, 2026
42 of 61 tasks
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