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

we can avoid the terrain sync completely in most cases #3103

Merged
merged 12 commits into from
Sep 16, 2021

Conversation

bosvensson1
Copy link
Contributor

We can take elsid's commit 605cb8d further by avoiding the terrain sync completely in most cases. Currently in changeCellGrid we wait for a new preloading task to ensure the getPagedRefnums for the new active cells have been filled in by object paging. This is usually not necessary because we have already completed a preload in the past containing these active cells. With this PR we remember what we preloaded and skip the terrain sync if it is not needed.

How to test this PR:
[ ] Check that syncTerrainLoad will no longer be called in the usual case, moving slowly
[ ] Check that syncTerrainLoad will still be called in unusual cases, e.g. abruptly changing direction at high speed

@psi29a psi29a requested a review from elsid September 11, 2021 19:07
Copy link
Collaborator

@elsid elsid left a comment

Choose a reason for hiding this comment

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

From the logic point of view this change is ok but need to fix comments. Benchmark I used for https://gitlab.com/OpenMW/openmw/-/merge_requests/1193 shows improvement. Flying over 21 cells doesn't cause more than 2 ms spent on terrain preloading in Scene::changeCellGrid vs 64 ms before.

apps/openmw/mwworld/cellpreloader.cpp Outdated Show resolved Hide resolved
apps/openmw/mwworld/cellpreloader.cpp Show resolved Hide resolved
@elsid elsid merged commit f62adab into OpenMW:master Sep 16, 2021
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.

2 participants