Commit Graph

808 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
elsid d06e697356
Initialize RenderingManager fields before use
PostProcessor is constructed before mNearClip, mViewDistance, mFieldOfView are
initialized and the constructor calls updateProjectionMatrix that uses these
fields.

==16218== Conditional jump or move depends on uninitialised value(s)
==16218==    at 0x722EBE: min<float> (stl_algobase.h:235)
==16218==    by 0x722EBE: MWRender::RenderingManager::updateProjectionMatrix() (renderingmanager.cpp:1183)
==16218==    by 0x7D022F: MWRender::PostProcessor::PostProcessor(MWRender::RenderingManager&, osgViewer::Viewer*, osg::Group*) (postprocessor.cpp:144)
==16218==    by 0x728B41: MWRender::RenderingManager::RenderingManager(osgViewer::Viewer*, osg::ref_ptr<osg::Group>, Resource::ResourceSystem*, SceneUtil::WorkQueue*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, DetourNavigator::Navigator&) (renderingmanager.cpp:452)
==16218==    by 0xBB5E65: MWWorld::World::World(osgViewer::Viewer*, osg::ref_ptr<osg::Group>, Resource::ResourceSystem*, SceneUtil::WorkQueue*, Files::Collections const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, ToUTF8::Utf8Encoder*, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (worldimp.cpp:190)
==16218==    by 0xDEEA6F: OMW::Engine::prepareEngine(Settings::Manager&) (engine.cpp:789)
==16218==    by 0xDF2068: OMW::Engine::go() (engine.cpp:959)
==16218==    by 0xDE7B8F: runApplication(int, char**) (main.cpp:220)
==16218==    by 0x1006593: wrapApplication(int (*)(int, char**), int, char**, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (debugging.cpp:205)
==16218==    by 0x7152C3: main (main.cpp:232)
==16218==

==17455== Conditional jump or move depends on uninitialised value(s)
==17455==    at 0x4F8613F: osg::Matrixd::makeFrustum(double, double, double, double, double, double) (Matrix_implementation.cpp:916)
==17455==    by 0x4EC0E11: osg::Camera::setProjectionMatrixAsPerspective(double, double, double, double) (Matrixd:580)
==17455==    by 0x722DDA: MWRender::RenderingManager::updateProjectionMatrix() (renderingmanager.cpp:1167)
==17455==    by 0x7D01EF: MWRender::PostProcessor::PostProcessor(MWRender::RenderingManager&, osgViewer::Viewer*, osg::Group*) (postprocessor.cpp:144)
==17455==    by 0x728BA1: MWRender::RenderingManager::RenderingManager(osgViewer::Viewer*, osg::ref_ptr<osg::Group>, Resource::ResourceSystem*, SceneUtil::WorkQueue*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, DetourNavigator::Navigator&) (renderingmanager.cpp:453)
==17455==    by 0xBB5E25: MWWorld::World::World(osgViewer::Viewer*, osg::ref_ptr<osg::Group>, Resource::ResourceSystem*, SceneUtil::WorkQueue*, Files::Collections const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, ToUTF8::Utf8Encoder*, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (worldimp.cpp:190)
==17455==    by 0xDEEA3F: OMW::Engine::prepareEngine(Settings::Manager&) (engine.cpp:789)
==17455==    by 0xDF2038: OMW::Engine::go() (engine.cpp:959)
==17455==    by 0xDE7B5F: runApplication(int, char**) (main.cpp:220)
==17455==    by 0x1006563: wrapApplication(int (*)(int, char**), int, char**, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (debugging.cpp:205)
==17455==    by 0x7152C3: main (main.cpp:232)
==17455==
3 years ago
Bo Svensson 98f8295765
allows to skip ComputeLightSpaceBounds traversal (#3152)
Currently, we always traverse the scene graph an additional time with a ComputeLightSpaceBounds visitor during shadow casting. ComputeLightSpaceBounds is only useful when the shadow casting mask allows us to shrink the bounds of the rendered scene, so we guard its traversal with a check against getCastsShadowTraversalMask. In practice, this guard never works because we build the traversal mask inclusively.

With this PR we limit the getCastsShadowTraversalMask check to relevant masks. This new check allows us to skip a superfluous ComputeLightSpaceBounds traversal with most settings.
3 years ago
Bo Svensson 787f91211d resets state updater to apply light settings (#3141)
resets state updater to apply light settings

With this PR we achieve the same effect with fewer lines of code.
3 years ago
Bo Svensson 2568f119a4
reapplies PR without npe (#3137)
* avoids creating empty statesets on drawables

Currently, we attempt to skip creating state on drawable nodes when this state matches the default state. This attempt is incomplete because we still create an avoidable empty stateset in the default case.

* renderingmanager.cpp

* nifloader.cpp

* nifloader.cpp

* shadervisitor.cpp
3 years ago
Andrei Kortunov e109d86489 Revert "avoids creating empty statesets on drawables (#3132)"
This reverts commit 957c25a491.
3 years ago
Bo Svensson d8707a763f
fixes build (#3134)
* quadtreeworld.cpp

* renderingmanager.cpp [ci skip]

* quadtreeworld.hpp

* cellborder.hpp

* cellborder.cpp
3 years ago
Bo Svensson 8358418555
set the correct program link parameters (#3110)
* shadermanager.hpp setProgramTemplate

* shadermanager.hpp

* shadermanager.cpp setProgramTemplate

* shadervisitor.hpp setProgramTemplate

* shadervisitor.cpp setProgramTemplate

* scenemanager.cpp setProgramTemplate

* scenemanager.hpp setProgramTemplate

* renderingmanager.cpp

* groundcover.cpp setProgramTemplate

* groundcover.hpp

* groundcover.cpp

* shadervisitor.cpp

* util.cpp

* lightmanager.cpp

* scenemanager.cpp

* scenemanager.hpp

* lightmanager.cpp

* lightmanager.cpp

* lightmanager.cpp

* scenemanager.hpp [ci skip]

* water.cpp

* groundcover.cpp

* shadermanager.hpp
3 years ago
Bo Svensson 957c25a491
avoids creating empty statesets on drawables (#3132)
* avoids creating empty statesets on drawables

Currently, we attempt to skip creating state on drawable nodes when this state matches the default state. This attempt is incomplete because we still create an avoidable empty stateset in the default case.

* renderingmanager.cpp

* nifloader.cpp
3 years ago
Andrei Kortunov fc2076db1a
Fix MSVC warnings about local variables redeclaration (#3130) 3 years ago
Bo Svensson 5fde6867a2
removes unused code (#3129)
* scenemanager.cpp

* scenemanager.hpp

* scenemanager.cpp

* stats.cpp

* renderingmanager.cpp
3 years ago
Bo Svensson 99df1c695c
fixes wireframe is broken (#3123)
* renderingmanager.cpp [ci skip]

* groundcover.hpp [ci skip]

* groundcover.cpp

* renderingmanager.cpp [ci skip]

* renderingmanager.hpp
3 years ago
Bo Svensson 9d661359a1
Groundcover consolidation (#3096)
* chunkmanager.hpp viewdistance

* chunkmanager.cpp viewdistance

* chunkmanager.hpp viewdistance

* quadtreeworld.cpp viewdistance

* quadtreeworld.cpp consolidate

* quadtreeworld.hpp consolidate

* renderingmanager.cpp groundcover consolidate

* renderingmanager.hpp groundcover consolidate

* renderingmanager.cpp updater move

* renderingmanager.hpp updater move

* groundcover.hpp activegrid consolidation

* groundcover.cpp activegrid consolidation

* settings-default.cfg dead settings remove

* viewdata.cpp revert

* wrong file paste mistake

* wrong file paste mistake

* wrong file paste mistake

* renderingmanager.cpp updatecallback fix

* renderingmanager.cpp namespace fix

* groundcover.hpp redefinition fix

* groundcover.cpp redefinition fix

* renderingmanager.cpp crash fix

* renderingmanager.cpp euclidean groundcover distance

* viewdata.hpp getreusedistance

* quadtreeworld.cpp reusedistance

* groundcover.rst [ci skip]
3 years ago
glassmancody.info d63eb3325f fix coverity warning and build on some osg 3 years ago
glassmancody.info 09e03fde2e refactor and fix wobbly shores 3 years ago
glassmancody.info cad0b151cb enable shaders path and dehardcode depth formats 3 years ago
glassmancody.info d89e37d689 add framebuffer extension check and fix issues with manual screenshots 3 years ago
glassmancody.info 70fac33940 initial reverse-z depth implementation 3 years ago
glassmancody.info e8c6f31e0c add shader path for mygui (#6162) 3 years ago
elsid eece47f70e
Avoid copying osg::ref_ptr when adding or removing item from work queue
Copy constructor does refcounting, and move constructor doesn't.
3 years ago
Andrei Kortunov 49a744b65a Make groundcover to use rendering distance in units instead of cells 3 years ago
jvoisin 998cc97a4f And done! 3 years ago
Andrei Kortunov 2d869ca9ff Fix node masks signed/unsigned mismatch 3 years ago
Andrei Kortunov 7d5c5f8a24 Do not assign negative values to unsigned variables 3 years ago
AnyOldName3 ce3ed28403 Control stomping via settings. 3 years ago
glassmancody.info 16856d45c5 Lighting Patch
Fixes build errors with older OSG builds and some issues with 'shared' layout.
Bring back ambient in inventory through lightmodel instead of sun ambient, mirrors scene ambient/sunlight relationship.
Forces shaders when certain lighting methods are enabled and finalize settings.
Correctly override sun for localmap.
3 years ago
glassmancody.info 531a6e1979 Code review fixes, remove implicit GLSL casts 3 years ago
glassmancody.info 582f7b52cf Merge remote-tracking branch 'upstream/master' into why_are_the_christmas_lights_still_up 3 years ago
glassmancody.info 9e80091aff clear up force shaders and make it less convoluted 3 years ago
glassmancody.info 16f80ec6f3 Update settings when using fallback 3 years ago
glassmancody.info 4ba473b684 Finalize settings, torch fix 3 years ago
glassmancody.info 71c30a31df in-game settings, some require restart 3 years ago
glassmancody.info 3d713e8602 Fix incorrect minimum ambient 3 years ago
glassmancody.info cc31e1eea1 Ambient luminance threshold setting 3 years ago
glassmancody.info 690995988b More formatting, OpenCS cells are unbroken 3 years ago
glassmancody.info 43ac32921c Rewrite, support different lighting methods 3 years ago
glassmancody.info 9d9074c244 Add shared UBO 3 years ago
glassmancody.info dda735c54a initial commit 3 years ago
Andrei Kortunov 124a33d8a3 Fix uninitialized variables 3 years ago
psi29a cc6f08930b Merge branch 'alpha-meddling' into 'master'
Replace deprecated alpha test in shader visitor

Closes #4899

See merge request OpenMW/openmw!473
3 years ago
AnyOldName3 0431ba4c87 Merge branch 'alpha-meddling-shader-side-mip-meddling' into alpha-meddling 3 years ago
AnyOldName3 f09b0fc1bd Put groundcover alphafunc where shader visitor can see it
I'd already made this change so don't know why it disappeared instead of
being included in b8ee32e3
3 years ago
Andrei Kortunov 38679013fe Give meaningful name to the mEffectFade 3 years ago
Andrei Kortunov d805886de7 Double-buffer shader water stateset (bug #5026) 3 years ago
AnyOldName3 4ed67d8597 Improve A2C setting name 3 years ago
AnyOldName3 4f510d85ba Merge remote-tracking branch 'upstream/master' into alpha-meddling 3 years ago
Nelsson Huotari 3194520dcd Move base_anim settings to settings-default.cfg 3 years ago
Andrei Kortunov f40e227686 Remove redundant formatting changes 3 years ago
Andrei Kortunov 8874e88ff1 Drop fading setting 3 years ago
Andrei Kortunov 1a6c06f7b5 Do not allow to set distance to non-positive values 3 years ago