Skip to content
4 changes: 4 additions & 0 deletions modules/core/src/lib/deck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,10 @@ export default class Deck<ViewsT extends ViewOrViews = null> {
const userOnResize = this.props.deviceProps?.onResize;

deviceOrPromise = webgl2Adapter.attach(props.gl, {
// Enable shader and pipeline caching for attached devices (matches _createDevice defaults)
// Without this, interleaved mode (e.g., MapboxOverlay) creates new pipelines every frame
_cacheShaders: true,
_cachePipelines: true,
Copy link

Choose a reason for hiding this comment

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

Duplicated caching defaults across device creation paths

Low Severity

The _cacheShaders: true and _cachePipelines: true default values are now duplicated in two separate locations: the webgl2Adapter.attach() call and the _createDevice() method. While the comment notes it "matches _createDevice defaults," this relies on manual synchronization. Extracting these defaults to a shared constant would ensure consistent behavior if defaults need to change.

Additional Locations (1)

Fix in Cursor Fix in Web

Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's put this below the spread in case a user wants to customize their device props. By default deviceProps is a {} so the caching will still apply

Copy link
Author

@michaelsaily michaelsaily Jan 29, 2026

Choose a reason for hiding this comment

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

Awesome, thank you so much @chrisgervang! That's a great catch: I've gone ahead and made the required change. I've also gone ahead and manually verified the changes via the examples/basemap-browser that you had recommended, and can confirm that no regressions were found, having tested it across all integrations.

Just as a slight note for anyone else wanting to verify the change: I believe that the performance impact scales with scene complexity and interaction frequency. As the examples/basemap-browser are quite simple, the problem doesn't always seem apparent, though this quickly changes in production applications with greater complexity and data.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh my apologies, I misread your code. Your original code allowed the user to customize the props and now it forces the caching. Let's revert to your original version, please.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Good to hear the example is working!

Copy link
Author

Choose a reason for hiding this comment

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

Hahaha, no worries! Changes reverted and pushed.

...this.props.deviceProps,
onResize: (canvasContext, info) => {
// Manually sync drawing buffer dimensions (canvas is externally managed)
Expand Down
Loading