Commit Graph

68 Commits (a854a6e04a8437d74078906d1d1720c0649e4e6f)

Author SHA1 Message Date
Bo Svensson a854a6e04a
removes UnrefQueue (#3181)
Currently, we use an `UnrefQueue` which supposedly aims to transfer destruction costs to another thread. The implications of this unusual pattern can not be well understood because some allocators might free resources more efficiently if they are freed by the same thread that allocated them. In addition, `UnrefQueue` complicates the validation of thread safety in our engine. Lastly, our current usage of `UnrefQueue` triggers `ref()`, `unref()` atomic operations as objects are passed into the queue. These operations could be more expensive than the actual destruction.

With this PR we thus remove `UnrefQueue`. We can expect these changes to have a minor impact at most because we free most resources elsewhere in `ResourceSystem::updateCache`.
3 years ago
Bo Svensson 01cc61087b
improves paging preloader (#3126)
* Return check for distance when we try to reuse data

* [ci skip]

* [ci skip]

* [ci skip]

* [ci skip]

* [ci skip]

* cellpreloader.cpp

* [ci skip]

* [ci skip]

* [ci skip]

* [ci skip]

* [ci skip]

* [ci skip]

* [ci skip]

* [ci skip]

* quadtreeworld.cpp

* chunkmanager.cpp

* chunkmanager.cpp

* cellpreloader.cpp

* jvoisin

* whitespace

* whitespace
3 years ago
Bo Svensson f62adab43a
Avoid the terrain sync completely in most cases (#3103)
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.
3 years ago
Bo Svensson e2d0e86020
cellpreloader.cpp unused variable (#3102) 3 years ago
Bo Svensson 147ed39900
This PR solves a crash with Robert's bodies logged on your bugtracker. (#3095)
* attach.cpp [ci skip]

* attach.cpp [ci skip]

* attach.cpp [ci skip]

* npcanimation.cpp [ci skip]

* attach.hpp [ci skip]

* attach.cpp [ci skip]

* creatureanimation.cpp [ci skip]

* creatureanimation.cpp [ci skip]

* cellpreloader.cpp

* npcanimation.cpp

* attach.cpp

* make android adk happy

* make android adk happy

* changelog.md [ci skip]

* authors.md [ci skip]
3 years ago
elsid 605cb8db7c
Make sync terrain preloading sleep free
This reduces average time spent on in. 5 milliseconds as a base precision is
quite a lot considering that for 60 FPS frame time is 1000/16 = ~16.67 ms
when it's a cell loading frame and there is more important work to do rather
than sleeping.
3 years ago
elsid 153cd9a20c
Avoid redundant search for existing element 3 years ago
psi29a 9b017ef04d Merge branch 'internal_includes_openmw' into 'master'
Clean up some internal includes of the openmw component

See merge request OpenMW/openmw!796
3 years ago
jvoisin d45184a730 Sprinkle some const-ref to avoid unnecessary copies 3 years ago
jvoisin 998cc97a4f And done! 3 years ago
Andrei Kortunov 9647b670e4 Do not declare unused variables 3 years ago
Alexei Dobrohotov 53f91a3aa5
Merge pull request #3018 from akortunov/emplace
Use emplace_back instead of push_back
4 years ago
Andrei Kortunov 065ed5138e Use emplace_back instead of push_back 4 years ago
Andrei Kortunov 8ca3c3b123 Mark overrided methods by override keyword 4 years ago
bzzt lost a hitlab login b27b76e325 avoid pagerebuild when reloading a same save
Signed-off-by: Bret Curtis <psi29a@gmail.com>
4 years ago
bzzt lost a hitlab login 6fa12a6eb8 preload tweak
Signed-off-by: Bret Curtis <psi29a@gmail.com>
4 years ago
bzzt lost a hitlab login c7fda6d280 activegrid paging = 2xfps
Signed-off-by: Bret Curtis <psi29a@gmail.com>
4 years ago
bzzt lost a hitlab login b4af2ac672 avoid blocking on pagerebuild
Signed-off-by: Bret Curtis <psi29a@gmail.com>
4 years ago
bzzt lost a hitlab login ffbed7ee38 loadingscreen
Signed-off-by: Bret Curtis <psi29a@gmail.com>
4 years ago
bzzt d684f1a78f terrainbased objectpaging
Signed-off-by: Bret Curtis <psi29a@gmail.com>
4 years ago
Andrei Kortunov 2e7712a390 Fix C5204 warnings by adding default virtual destructors 4 years ago
Andrei Kortunov 489e5c6cce Store preloaded terrain view in the main thread 5 years ago
bzzt 63ab7345be Reuse traversal result for different traversal with same view point
Rename eyePoint to viewPoint to match OSG conventions (eyePoint is the camera position, viewPoint is for LOD handling)
5 years ago
Andrei Kortunov 12f9184d00 Allow to interrupt terrain preloading 5 years ago
Andrei Kortunov d23a0ce2ae Use C++11-style loops in the game world instead of iterators 5 years ago
Andrei Kortunov 3032b177a1 Remove redundant includes 5 years ago
Capostrophic a71cfca580 Get rid of some remaining instances of C limit macros 5 years ago
Ilya Zhuravlev 07e9ce84b3 Replace volatile bools with std::atomic<bool> 5 years ago
Andrei Kortunov e06f0b797a Replace all NULLs to nullptr 6 years ago
Andrei Kortunov 5a4d0cec3a Use new logging system for game itself 6 years ago
scrawl e987fe85d0 Add abort flag to TerrainPreloadItem 7 years ago
scrawl 42e9891504 Fix issues caused by loading multiple views into the same terrain View 7 years ago
scrawl 97ed999097 Fix cleanup issue 7 years ago
scrawl 6ccb6009ee Use the View-based preloading for TerrainGrid as well 7 years ago
scrawl 3c29e2dbeb Refactor ownership of terrain views 7 years ago
scrawl 4549196b31 Use the new way of terrain preloading in CellPreloader/Scene 7 years ago
scrawl 35d53acc65 Factor out terrain chunk loading/caching into a new resource manager 7 years ago
scrawl 9a3a64f0c4 Add resource manager for ESM::Land to allow data to be unloaded when no longer required 7 years ago
scrawl b898315962 cellpreloader: abort all tasks first before waiting 7 years ago
scrawl 804f873649 terrain: factor out texture caching into a separate class 7 years ago
scrawl 29556a1802 More consistent wording of errors/warnings
A Warning indicates a potential problem in the content file(s) that the user told OpenMW to load. E.g. this might cause an object to not display at all or as intended, however the rest of the game will run fine.

An Error, however, is more likely to be a bug with the engine itself - it means that basic assumptions have been violated and the engine might not run correctly anymore.

The above mostly applies to errors/warnings during game-play; startup issues are handled differently: when a file is completely invalid/corrupted to the point that the engine can not start, that might cause messages that are worded as Error due to the severity of the issue but are not necessarily the engine's fault.

Hopefully, being a little more consistent here will alleviate confusion among users as to when a log message should be reported and to whom.
7 years ago
scrawl 3f3d00ffc9 Add CellPreloader::clear to avoid potential dangling CellStore pointer and to more aggressively clear preload state from a previous game 7 years ago
scrawl a46593fa74 Add PreloadItem::abort() to avoid no longer required cells from blocking the work thread 7 years ago
scrawl d62c4259bd CellPreloader: load the terrain first to match the order in the main thread 7 years ago
scrawl eaeba4138b Move the deletion of PreloadItem to the worker thread 7 years ago
scrawl 0be811c519 Update the resource cache every second instead of every frame
A dry run takes about ~1.5ms. Even though it's all done in the worker thread, the locks used can stall loading operations that are about to happen in other threads, and just in general this CPU load is unnecessary.
7 years ago
scrawl e1dda9675d Add "preload instances" setting, disabling this may help if you are low on memory. 8 years ago
scrawl 5cda89c15d Don't attempt to preload more exterior cells than the cache can hold (Bug #3273) 8 years ago
scrawl 83f1ab6d25 Add a time threshold to the removing of preloaded cells when the maximum cache size is reached (Bug #3273) 8 years ago
scrawl 2f8be401cc Add the unref work items to the front of the workqueue (Bug #3273)
Ensures that memory still gets freed even if the workqueue is overloaded.
8 years ago