Skip to content
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 crash due to undefined clipping planes texture #6576

Merged
merged 7 commits into from
May 25, 2018

Conversation

likangning93
Copy link
Contributor

Fixes #6566

@cesium-concierge
Copy link

Signed CLA is on file.

@likangning93, thanks for the pull request! Maintainers, we have a signed CLA from @likangning93, so you can review this at any time.


I am a bot who helps you make Cesium awesome! Contributions to my configuration are welcome.

🌍 🌎 🌏

@likangning93
Copy link
Contributor Author

Erm. I guess that's only "should fix" since I can't reproduce the specific behavior in that forum post/issue. So that's not great... but getClippingFunction definitely wasn't well-designed for this before, and this PR should help with that.

@hpinkos hpinkos requested a review from lilleyse May 8, 2018 20:33
@likangning93
Copy link
Contributor Author

likangning93 commented May 9, 2018

There was also a bug in here with partial texture updates for uint8 texture mode, and there wasn't a spec that caught it until I made a tweak to how double-texture allocation works. I'll add a more targeted test.

Who wrote this... hmmmm...

@likangning93
Copy link
Contributor Author

@lilleyse this is ready for review now.

@lilleyse
Copy link
Contributor

The code looks good and tests pass/demos work across browsers.

@lilleyse
Copy link
Contributor

Just a side note - I haven't been able to reproduce the bug myself but I asked the forum member who posted the bug to test it out if he is able. I'll be good to merge until then or otherwise within the next couple of days.

@lilleyse
Copy link
Contributor

}

var pixelsNeeded = ClippingPlaneCollection.useFloatTexture(context) ? clippingPlaneCollection.length : clippingPlaneCollection.length * 2;
var requiredResolution = computeTextureResolution(pixelsNeeded, result);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

From the error message it looks like this might be returning NaN because pixelsNeeded is 0.
Don't know how that's happening though, because the clipping plane shader regen shouldn't be called in that case. Wish we were able to reproduce the error for debugging... I'll keep trying to trace this in the meantime.

@likangning93
Copy link
Contributor Author

likangning93 commented May 23, 2018

User on the forum provided a Sandcastle using the AGI HQ model and steps to reproduce:

  1. Sandcastle
  2. remove
  3. add
  4. zoom in and out

@likangning93
Copy link
Contributor Author

likangning93 commented May 23, 2018

The Sandcastle was replacing the tileset's existing clipping plane collection with a new one, but some individual Tiles were retaining references to the old clipping plane collection, which had been destroyed.

@lilleyse
Copy link
Contributor

Ah good, that means #6599 is related.

@likangning93
Copy link
Contributor Author

@lilleyse updated!

@@ -513,6 +513,12 @@ define([
this._model._clippingPlanes = (tilesetClippingPlanes.enabled && this._tile._isClipped) ? tilesetClippingPlanes : undefined;
}

// If the model references a destroyed ClippingPlaneCollection due to the tileset's collection being replaced with a
// ClippingPlaneCollection that gives this tile the same clipping status, update the model to use the new ClippingPlaneCollection.
if (defined(tilesetClippingPlanes) && defined(this._model._clippingPlanes) && this._model._clippingPlanes.isDestroyed()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Alternatively could the check be tilesetClippingPlanes !== this._model._clippingPlanes?

Once #6599 is fixed we won't be destroying the collection anymore.

@likangning93
Copy link
Contributor Author

@lilleyse updated!

@@ -523,7 +523,7 @@ define([

// If the model references a destroyed ClippingPlaneCollection due to the tileset's collection being replaced with a
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix comment here as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

whoops

@likangning93
Copy link
Contributor Author

@lilleyse ready!

@lilleyse
Copy link
Contributor

Thanks!

@lilleyse lilleyse merged commit 679df9f into CesiumGS:master May 25, 2018
@cesium-concierge
Copy link

Congratulations on closing the issue! I found these Cesium forum links in the comments above:

https://groups.google.com/forum/#!searchin/cesium-dev/mr

If this issue affects any of these threads, please post a comment like the following:

The issue at #6576 has just been closed and may resolve your issue. Look for the change in the next stable release of Cesium or get it now in the master branch on GitHub https://github.com/AnalyticalGraphicsInc/cesium.


I am a bot who helps you make Cesium awesome! Contributions to my configuration are welcome.

🌍 🌎 🌏

@lilleyse lilleyse deleted the fixClippingPlaneCrash branch May 25, 2018 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants