1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-31 06:45:35 +00:00

\#5534 remove OSG 3.4 support and require at least 3.6.5 support

This commit is contained in:
Bret Curtis 2022-08-01 11:34:43 +02:00
parent 0a16d54865
commit 231d60995b
8 changed files with 84 additions and 199 deletions

View file

@ -407,10 +407,7 @@ if(NOT HAVE_STDINT_H)
endif()
if(OPENMW_USE_SYSTEM_OSG)
find_package(OpenSceneGraph 3.4.0 REQUIRED ${USED_OSG_COMPONENTS})
if (${OPENSCENEGRAPH_VERSION} VERSION_GREATER 3.6.2 AND ${OPENSCENEGRAPH_VERSION} VERSION_LESS 3.6.5)
message(FATAL_ERROR "OpenSceneGraph version ${OPENSCENEGRAPH_VERSION} has critical regressions which cause crashes. Please upgrade to 3.6.5 or later. We strongly recommend using the tip of the official 'OpenSceneGraph-3.6' branch or the tip of '3.6' OpenMW/osg (OSGoS).")
endif()
find_package(OpenSceneGraph 3.6.5 REQUIRED ${USED_OSG_COMPONENTS})
if(OSG_STATIC)
find_package(OSGPlugins REQUIRED COMPONENTS ${USED_OSG_PLUGINS})

View file

@ -12,7 +12,6 @@
#include <osgViewer/ViewerEventHandlers>
#include <osg/LightModel>
#include <osg/Material>
#include <osg/Version>
#include <components/debug/debuglog.hpp>
#include <components/resource/scenemanager.hpp>
@ -97,14 +96,6 @@ RenderWidget::~RenderWidget()
try
{
CompositeViewer::get().removeView(mView);
#if OSG_VERSION_LESS_THAN(3,6,5)
// before OSG 3.6.4, the default font was a static object, and if it wasn't attached to the scene when a graphics context was destroyed, it's program wouldn't be released.
// 3.6.4 moved it into the object cache, which meant it usually got released, but not here.
// 3.6.5 improved cleanup with osgViewer::CompositeViewer::removeView so it more reliably released associated state for objects in the object cache.
osg::ref_ptr<osg::GraphicsContext> graphicsContext = mView->getCamera()->getGraphicsContext();
osgText::Font::getDefaultFont()->releaseGLObjects(graphicsContext->getState());
#endif
}
catch(const std::exception& e)
{
@ -146,9 +137,7 @@ CompositeViewer::CompositeViewer()
// https://gitlab.com/OpenMW/openmw/-/issues/5481
setThreadingModel(osgViewer::ViewerBase::SingleThreaded);
#if OSG_VERSION_GREATER_OR_EQUAL(3,5,5)
setUseConfigureAffinity(false);
#endif
// disable the default setting of viewer.done() by pressing Escape.
setKeyEventSetsDone(0);

View file

@ -1032,10 +1032,8 @@ void OMW::Engine::go()
mViewer = new osgViewer::Viewer;
mViewer->setReleaseContextAtEndOfFrameHint(false);
#if OSG_VERSION_GREATER_OR_EQUAL(3,5,5)
// Do not try to outsmart the OS thread scheduler (see bug #4785).
mViewer->setUseConfigureAffinity(false);
#endif
mEnvironment.setFrameRateLimit(Settings::Manager::getFloat("framerate limit", "Video"));

View file

@ -1,12 +1,10 @@
#include "loadingscreen.hpp"
#include <array>
#include <condition_variable>
#include <osgViewer/Viewer>
#include <osg/Texture2D>
#include <osg/Version>
#include <MyGUI_ScrollBar.h>
#include <MyGUI_Gui.h>
@ -305,12 +303,8 @@ namespace MWGui
mCopyFramebufferToTextureCallback = new CopyFramebufferToTextureCallback(mTexture);
}
#if OSG_VERSION_GREATER_OR_EQUAL(3, 5, 10)
mViewer->getCamera()->removeInitialDrawCallback(mCopyFramebufferToTextureCallback);
mViewer->getCamera()->addInitialDrawCallback(mCopyFramebufferToTextureCallback);
#else
mViewer->getCamera()->setInitialDrawCallback(mCopyFramebufferToTextureCallback);
#endif
mCopyFramebufferToTextureCallback->reset();
mSplashImage->setBackgroundImage("");

View file

@ -12,7 +12,6 @@
#include <osg/ColorMask>
#include <osg/BlendFunc>
#include <osg/AlphaFunc>
#include <osg/Version>
#include <osg/observer_ptr>
#include <osg/PositionAttitudeTransform>
@ -855,12 +854,8 @@ namespace MWRender
osg::ref_ptr<osg::OcclusionQueryNode> oqn = new osg::OcclusionQueryNode;
oqn->setQueriesEnabled(true);
#if OSG_VERSION_GREATER_OR_EQUAL(3, 6, 5)
// With OSG 3.6.5, the method of providing user defined query geometry has been completely replaced
osg::ref_ptr<osg::QueryGeometry> queryGeom = new osg::QueryGeometry(oqn->getName());
#else
osg::ref_ptr<osg::QueryGeometry> queryGeom = oqn->getQueryGeometry();
#endif
// Make it fast! A DYNAMIC query geometry means we can't break frame until the flare is rendered (which is rendered after all the other geometry,
// so that would be pretty bad). STATIC should be safe, since our node's local bounds are static, thus computeBounds() which modifies the queryGeometry
@ -881,9 +876,7 @@ namespace MWRender
// Still need a proper bounding sphere.
oqn->setInitialBound(queryGeom->getBound());
#if OSG_VERSION_GREATER_OR_EQUAL(3, 6, 5)
oqn->setQueryGeometry(queryGeom.release());
#endif
osg::StateSet* queryStateSet = new osg::StateSet;
if (queryVisible)

View file

@ -1,70 +0,0 @@
version: "{build}"
branches:
only:
- master
- /openmw-.*$/
- appveyor
environment:
matrix:
- msvc: 2017
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- msvc: 2019
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
platform:
- x64
configuration:
# - Debug
- Release
# - RelWithDebInfo
# We want the git revision for versioning,
# so shallow clones don't work.
clone_depth: 1
cache:
- C:\projects\openmw\deps\Bullet-2.89-msvc2017-win64-double.7z
- C:\projects\openmw\deps\MyGUI-3.4.1-msvc2017-win64.7z
- C:\projects\openmw\deps\MyGUI-3.4.1-msvc2019-win64.7z
- C:\projects\openmw\deps\OSGoS-3.6.5-b02abe2-msvc2017-win64.7z
- C:\projects\openmw\deps\OSGoS-3.6.5-b02abe2-msvc2019-win64.7z
- C:\projects\openmw\deps\ffmpeg-4.2.2-dev-win64.zip
- C:\projects\openmw\deps\ffmpeg-4.2.2-win64.zip
- C:\projects\openmw\deps\OpenAL-Soft-1.20.1.zip
- C:\projects\openmw\deps\SDL2-2.0.18.zip
clone_folder: C:\projects\openmw
install:
- set PATH=C:\Program Files\Git\mingw64\bin;%PATH%
before_build:
- cmd: git submodule update --init --recursive
- cmd: sh %APPVEYOR_BUILD_FOLDER%\CI\before_script.msvc.sh -c %configuration% -p %PLATFORM% -v %msvc% -V -i %APPVEYOR_BUILD_FOLDER%\install
build_script:
- cmd: if %PLATFORM%==x64 set build=MSVC%msvc%_64
- cmd: msbuild %build%\OpenMW.sln /t:Build /p:Configuration=%configuration% /m:2 /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
- cmd: cmake --install %build% --config %configuration%
after_build:
- cmd: if %PLATFORM%==x64 7z a OpenMW_MSVC%msvc%_%platform%_%appveyor_pull_request_number%_%appveyor_pull_request_head_commit%.zip %APPVEYOR_BUILD_FOLDER%\install -xr"!*.pdb"
#- cmd: if %PLATFORM%==x64 7z a OpenMW_MSVC%msvc%_%platform%_%appveyor_pull_request_number%_%appveyor_pull_request_head_commit%_pdb.zip %APPVEYOR_BUILD_FOLDER%\MSVC%msvc%_64\%configuration%\*.pdb
test: off
#notifications:
# - provider: Email
# to:
# -
# on_build_failure: true
# on_build_status_changed: true
artifacts:
- path: OpenMW_MSVC%msvc%_%platform%_%appveyor_pull_request_number%_%appveyor_pull_request_head_commit%.zip
name: OpenMW_MSVC%msvc%_%platform%_%appveyor_pull_request_number%_%appveyor_pull_request_head_commit%
#- path: OpenMW_MSVC%msvc%_%platform%_%appveyor_pull_request_number%_%appveyor_pull_request_head_commit%_pdb.zip
# name: OpenMW_MSVC%msvc%_%platform%_%appveyor_pull_request_number%_%appveyor_pull_request_head_commit%_pdb

View file

@ -8,7 +8,6 @@
#include <osg/BufferObject>
#include <osg/BufferIndexBinding>
#include <osg/Endian>
#include <osg/Version>
#include <osg/ValueObject>
#include <osgUtil/CullVisitor>
@ -302,11 +301,7 @@ namespace SceneUtil
osg::ref_ptr<osg::UniformBufferObject> ubo = new osg::UniformBufferObject;
buffer->getData()->setBufferObject(ubo);
#if OSG_VERSION_GREATER_OR_EQUAL(3,5,7)
osg::ref_ptr<osg::UniformBufferBinding> ubb = new osg::UniformBufferBinding(static_cast<int>(Resource::SceneManager::UBOBinding::LightBuffer), buffer->getData(), 0, buffer->getData()->getTotalDataSize());
#else
osg::ref_ptr<osg::UniformBufferBinding> ubb = new osg::UniformBufferBinding(static_cast<int>(Resource::SceneManager::UBOBinding::LightBuffer), ubo, 0, buffer->getData()->getTotalDataSize());
#endif
stateset->setAttributeAndModes(ubb, mode);
break;
@ -614,11 +609,7 @@ namespace SceneUtil
for (size_t i = 0; i < mStateSet.size(); ++i)
{
auto& buffer = lightManager->getUBOManager()->getLightBuffer(i);
#if OSG_VERSION_GREATER_OR_EQUAL(3,5,7)
osg::ref_ptr<osg::UniformBufferBinding> ubb = new osg::UniformBufferBinding(static_cast<int>(Resource::SceneManager::UBOBinding::LightBuffer), buffer->getData(), 0, buffer->getData()->getTotalDataSize());
#else
osg::ref_ptr<osg::UniformBufferBinding> ubb = new osg::UniformBufferBinding(static_cast<int>(Resource::SceneManager::UBOBinding::LightBuffer), buffer->getData()->getBufferObject(), 0, buffer->getData()->getTotalDataSize());
#endif
mStateSet[i]->setAttributeAndModes(ubb, osg::StateAttribute::ON);
}
}

View file

@ -1,6 +1,5 @@
#include "sdlcursormanager.hpp"
#include <cassert>
#include <stdexcept>
#include <cstdlib>
@ -13,14 +12,13 @@
#include <osg/Geometry>
#include <osg/Texture2D>
#include <osg/TexMat>
#include <osg/Version>
#include <osgViewer/GraphicsWindow>
#include <components/debug/debuglog.hpp>
#include "imagetosurface.hpp"
#if defined(OSG_LIBRARY_STATIC) && (!defined(ANDROID) || OSG_VERSION_GREATER_THAN(3, 6, 5))
#if defined(OSG_LIBRARY_STATIC) && !defined(ANDROID)
// Sets the default windowing system interface according to the OS.
// Necessary for OpenSceneGraph to do some things, like decompression.
USE_GRAPHICSWINDOW()
@ -28,12 +26,7 @@ USE_GRAPHICSWINDOW()
namespace CursorDecompression
{
// macOS builds use the OSG fork that includes DXTC commit
#if OSG_VERSION_GREATER_OR_EQUAL(3, 5, 8) || defined(__APPLE__)
static const bool DXTCSupported = true;
#else
static const bool DXTCSupported = false;
#endif
class MyGraphicsContext {
public: