Skip to content

perf(deck.gl-raster): drop MeshTextureLayer's unused lighting modules - #874

Merged
kylebarron merged 1 commit into
mainfrom
kyle/mesh-drop-lighting-modules
Nov 10, 2026
Merged

kylebarron merged 1 commit into
mainfrom
kyle/mesh-drop-lighting-modules

Conversation

@kylebarron

Copy link
Copy Markdown
Member

Note

This PR was written by Claude (Claude Code), not by @kylebarron.

Follows up #670.

Problem

#670 removed the lighting call from MeshTextureLayer's fragment shader, but the layer still inherits SimpleMeshLayer's phongMaterial shader module, which pulls in lighting. Nothing in the shaders reads them, yet deck.gl still computes and uploads both modules' uniforms on every draw. Every raster tile pays for lighting it never applies.

Change

MeshTextureLayer.getShaders() drops phongMaterial from the inherited modules. lighting was only there as its dependency, so it goes too. The vertex and fragment shaders don't reference either module.

deck.gl's LightingEffect still sends lighting and phongMaterial props to every layer. luma.gl's ShaderInputs would warn Module lighting not found for them, but deck.gl's Layer.getShaders() sets disableWarnings: true on every model. That's the same path that already silences the shadow and gouraudMaterial props LightingEffect sends to every SimpleMeshLayer. I checked this with luma.gl's real ShaderInputs, the layer's shaders, and the props LightingEffect and the picking pass send: nothing is logged.

Measurement

This was measured in an app with about 300 COG tile meshes in view, in a production build:

  • View: 288 tile meshes at zoom 12.
  • Browser: headless Chrome at 2× DPR.
  • Metric: deck's draw time (renderLayers) per frame, averaged over 120 frames. The zoom was nudged every frame so the view uniforms change. Two runs each.

It was measured by patching MeshTextureLayer.prototype.getShaders at runtime in the built app to filter out the same two modules, then rebuilding the tiles. It was not measured with this exact diff.

draw time per frame per tile mesh
with phongMaterial + lighting 4.5 ms 15.6 µs
without them 3.2 ms 11.1 µs

That's about 29% less draw time.

Tests

  • New test: the resolved shader modules of a MeshTextureLayer contain neither phongMaterial nor lighting. It fails without the change.
  • pnpm -r --filter="!docs" typecheck, biome ci . and the deck.gl-raster tests pass locally.

No visible change: the shader already ignored lighting, so there are no screenshots.

🤖 Written by Claude Code

#670 removed the lighting call from MeshTextureLayer's fragment shader but
kept the `phongMaterial` module it inherits from SimpleMeshLayer, which
pulls in `lighting`. deck.gl still computes and uploads both modules'
uniforms on every draw, so each raster tile pays for lighting it never
applies. Drop them from the shader modules.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the perf label Nov 9, 2026
@kylebarron
kylebarron marked this pull request as ready for review November 9, 2026 23:58

@kylebarron kylebarron left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

✅

a small performance improvement

@kylebarron
kylebarron merged commit 42741f6 into main Nov 10, 2026
3 checks passed
@kylebarron
kylebarron deleted the kyle/mesh-drop-lighting-modules branch November 10, 2026 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant