CesiumGS / cesium-native

Apache License 2.0
402 stars 205 forks source link

Fix Tileset::ComputeLoadProgress incorrectly reporting done, when main thread loading exists #831

Closed csciguy8 closed 4 months ago

csciguy8 commented 5 months ago

Fixes performance tests reporting completion times that are a little too early (1 second in some warm cache tests).

Could also fix any bugs in user applications where they use ::computeLoadProgress to determine loading completion. Ex. waiting for loading before taking a screenshot, some parts of the screenshot might not have loaded to final detail

This fixes a bug in the mentioned function, where this->_workerThreadLoadQueue.size() is being used to calculate tile completion, but it's always 0, because it is cleared at the end of every ::update_view. The fix is to use the saved value in _updateResult.

Discovered while working on PR #779.

Also relates to PR #733, which has a similar fix. I wouldn't be surprised if this was the original cause, but that PR just happened to fix it too. Regardless, the older PR is still valuable. Counting "tiles kicked" as current progress sounds reasonable.

j9liu commented 4 months ago

Thanks @csciguy8 !