-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Fix picks on clipped regions #12856
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
base: main
Are you sure you want to change the base?
Fix picks on clipped regions #12856
Conversation
Thank you for the pull request, @ggetz! ✅ We can confirm we have a CLA on file for you. |
@mzschwartz5 Could you please review? It'd be great to get this fix into Tuesday's release for the ion team. |
You have seen in the issue that I did go down the rabbit hole a bit, but didn't bother to look for the "Drink me" bottle. Two small comments: For me, the issue only happened when the debug console was open. One can shrug this off: "It's a browser, not a VM 🤷". But is there any convincing reason for that? The change here prevents the crash. Let's hit "Merge" 😉 return (
// When [something happens] then [in some cases] and [when the browser console is open(!?)]
// this may be called by [some function], at a point in time where this texture is not yet initialized.
// Using the default texture is a workaound for https://github.com/CesiumGS/cesium/issues/12725
clippingPolygons.clippingTexture ?? frameState.context.defaultTexture
); And... it's indeed only a workaround to prevent the crash. Whatever this |
My comment might end up boiling down to this, but... Thanks for for flagging the nuances @javagl — you’re right that this is more of a workaround than a root-cause fix, and your notes about the fallback texture are valid. That said, since this crash is currently blocking ion, I’d suggest we move forward with this patch as an immediate safeguard. To your points:
So my recommendation is: let’s merge this as a stopgap, and if there are still concerns on the underlying issue, let's file a follow-up issue to better re-evaluate timing of texture initialization. |
Taking a review pass now - just noticed right off the bat, though, that I'm unable to replicate this in Firefox. No problem in Chrome though. Don't know if that's worth anything but I hadn't seen it mentioned anywhere yet. |
return ( | ||
clippingPolygons.clippingTexture ?? frameState.context.defaultTexture | ||
); |
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.
The issue description said part of the problem is the lack of an available WebGL context until the Update
function in ClippingPolygonCollection
. Clearly though, we have a valid context here, at least.
Question - rather than returning the defaultTexture
, could we call a function on the clippingPolygons
object here to create the clippingTexture
if it's undefined at this point? (This function I'm referring to doesn't exist yet, but could we just refactor the code in Update
that creates the texture into a callable function?)
If that seems like a big refactor / we need this sooner and it works as is, I'm fine shipping it.
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.
(Regardless, I'll hold off merging any code changes until people are back in office)
Description
This PR fixes a uniform error which can arise when picking 3D Tilesets that have a region clipped by
ClippingPolygonCollection
.As @javagl helpfully pointed out, the
ClippingPolygonCollection._extentsTexture
property is set during the collection update (the webgl context, required to create the Texture, is not available until then). The error can manifest during picking, particularlyclampToHeight
, which attempts to render sooner than expected in the process. This leads to an uniform error.Instead, this PR simply defaults to the default empty texture in the case where the texture has not yet had the chance to initialize.
Issue number and link
Fixes #12725
Testing plan
You will need to open the developer tools in order to replicate the bug.
main
, with error when you drag and move the polygonI did not add a unit test since this is an edge case that is difficult to construct a sensible test for.
Author checklist
CONTRIBUTORS.md
CHANGES.md
with a short summary of my changeI have updated the inline documentation, and included code examples where relevant