Skip to content

feat(layers) Port SolidPolygonLayer to WebGPU#10142

Draft
ibgreen wants to merge 4 commits intomasterfrom
ib/webgpu-solid-polygon-layer
Draft

feat(layers) Port SolidPolygonLayer to WebGPU#10142
ibgreen wants to merge 4 commits intomasterfrom
ib/webgpu-solid-polygon-layer

Conversation

@ibgreen
Copy link
Copy Markdown
Collaborator

@ibgreen ibgreen commented Mar 30, 2026

Partial WIP port of SolidPolygonLayer

image

extrusions are not working.

Summary

This PR ports SolidPolygonLayer to WGSL/WebGPU and updates the GeoJSON polygons example so it can be exercised from the website’s device tabs.

Changes

SolidPolygonLayer WebGPU support

  • Added a WGSL shader implementation for SolidPolygonLayer.
  • Wired SolidPolygonLayer to provide WGSL shader source on WebGPU while keeping the existing GLSL path for WebGL.
  • Added WGSL uniform support for solidPolygon.
  • Added WebGPU-specific model setup and buffer-layout filtering for top, side, and wireframe models.
  • Updated picking color handling to work with the WebGPU path.

Core WebGPU plumbing fixes

  • Updated core attribute/buffer handling to better support WebGPU requirements in this path.
  • Adjusted lighting/shadow behavior so the example remains usable on WebGPU.
  • Kept shared layer rendering behavior aligned with the existing WebGL path rather than introducing global WebGPU polygon-offset changes.

Example updates

  • Enabled WebGL2/WebGPU device tabs for the GeoJSON polygons example.
  • Updated the GeoJSON website app to pass through the selected device and use WebGPU-specific premultiplied-alpha blend parameters.
  • Added the same device-tab support to the Globe and Trips examples.
  • Updated the playground Vite config to support the example/dev workflow used during this port.

Files changed

  • modules/layers/src/solid-polygon-layer/solid-polygon-layer.wgsl.ts
  • modules/layers/src/solid-polygon-layer/solid-polygon-layer.ts
  • modules/layers/src/solid-polygon-layer/solid-polygon-layer-uniforms.ts
  • modules/core/src/lib/attribute/attribute.ts
  • modules/core/src/lib/attribute/data-column.ts
  • modules/core/src/lib/attribute/attribute-manager.ts
  • modules/core/src/lib/layer.ts
  • modules/core/src/effects/lighting/lighting-effect.ts
  • examples/website/geojson/app.tsx
  • website/src/examples/geojson-layer-polygons.js
  • examples/website/globe/app.tsx
  • website/src/examples/globe-view.js
  • examples/website/trips/app.tsx
  • website/src/examples/trips-layer.js
  • examples/playground/vite.config.js

Validation

  • ./node_modules/.bin/tsc -p modules/layers/tsconfig.json --noEmit
  • ./node_modules/.bin/vitest run --project render test/render/test-cases/geojson-layer.spec.ts
  • npm run build-bundle --prefix modules/layers

Notes

  • Temporary debug screenshots were removed and are not part of the PR.
  • The remaining follow-up issue is WebGPU polygon z-fighting / extrusion behavior in the live example, which needs a layer-local fix rather than a shared Layer draw-state change.

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