Repository navigation
perf(deck.gl-raster): drop MeshTextureLayer's unused lighting modules - #874
Merged
Merged
Conversation
#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]>
kylebarron
marked this pull request as ready for review
November 9, 2026 23:58
kylebarron
commented
Nov 10, 2026
kylebarron
left a comment
Member
Author
There was a problem hiding this comment.
✅
a small performance improvement
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 inheritsSimpleMeshLayer'sphongMaterialshader module, which pulls inlighting. 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()dropsphongMaterialfrom the inherited modules.lightingwas only there as its dependency, so it goes too. The vertex and fragment shaders don't reference either module.deck.gl's
LightingEffectstill sendslightingandphongMaterialprops to every layer. luma.gl'sShaderInputswould warnModule lighting not foundfor them, but deck.gl'sLayer.getShaders()setsdisableWarnings: trueon every model. That's the same path that already silences theshadowandgouraudMaterialpropsLightingEffectsends to everySimpleMeshLayer. I checked this with luma.gl's realShaderInputs, the layer's shaders, and the propsLightingEffectand 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:
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.getShadersat runtime in the built app to filter out the same two modules, then rebuilding the tiles. It was not measured with this exact diff.phongMaterial+lightingThat's about 29% less draw time.
Tests
MeshTextureLayercontain neitherphongMaterialnorlighting. It fails without the change.pnpm -r --filter="!docs" typecheck,biome ci .and thedeck.gl-rastertests pass locally.No visible change: the shader already ignored lighting, so there are no screenshots.
🤖 Written by Claude Code