-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(layers): Fix MVTLayer + pickMultipleObjects #9246
Conversation
modules/core/src/lib/layer.ts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes in this file can be reverted before submitting the PR — they're not required for the fix — but I wanted to highlight one place where the 3 vs 4 component issue came up. Here colors
had one size and externalColorAttribute
had another, to the indices didn't map correctly.
If we did prefer to support both 3-component and 4-component instance picking colors, though, this isn't enough, there'd be at least 1-2 more places requiring similar fixes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel regardless of how we address it, the fix should go in the Attribute class:
getVertexOffset
should use the "real size"- there should be an alignment check when size is overridden by an external binary attribute. We moved to 4-component picking color because WebGPU will not support 3-byte colors.
Since these are not required to patch this bug, they should be made against master and the next minor release?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok - for now I've reverted the change to layer.ts
, so only the change from 3-component to 4-component picking colors is included in the PR.
The
instancePickingColors
attribute has some hard-coded assumptions about size, such as...deck.gl/modules/core/src/lib/layer.ts
Lines 879 to 882 in 27d2010
... but MVTLayer currently initializes the buffer with 3, not 4, components. This leads to a bug in
pickMultipleObjects
wheredisablePickingIndex
fails to disable the previously selected object index (or goes out of bounds) and the operation just returnsdepth
duplicate references to the top hit.While we could try to handle multiple attribute sizes, I think it's probably preferable to just have one way to represent things. Here I've switched MVTLayer to 4-component picking colors, following WebGL's 4-byte alignment best practices.
Change List