diff --git a/apps/openmw/mwrender/postprocessor.cpp b/apps/openmw/mwrender/postprocessor.cpp index b24a083fbf..9ddae99950 100644 --- a/apps/openmw/mwrender/postprocessor.cpp +++ b/apps/openmw/mwrender/postprocessor.cpp @@ -340,7 +340,6 @@ namespace MWRender mTransparentDepthPostPass->mFbo[frameId] = mFbos[frameId][FBO_Primary]; mTransparentDepthPostPass->mMsaaFbo[frameId] = mFbos[frameId][FBO_Multisample]; mTransparentDepthPostPass->mOpaqueFbo[frameId] = mFbos[frameId][FBO_OpaqueDepth]; - mTransparentDepthPostPass->dirtyFrame(frameId); } size_t frame = cv->getTraversalNumber(); diff --git a/apps/openmw/mwrender/transparentpass.cpp b/apps/openmw/mwrender/transparentpass.cpp index 7973575f47..a2cbb54ed3 100644 --- a/apps/openmw/mwrender/transparentpass.cpp +++ b/apps/openmw/mwrender/transparentpass.cpp @@ -80,6 +80,11 @@ namespace MWRender mMultiviewResolve[frameId] = std::make_unique( msaaFbo ? msaaFbo : fbo, opaqueFbo, GL_DEPTH_BUFFER_BIT); } + else + { + mMultiviewResolve[frameId]->setResolveFbo(opaqueFbo); + mMultiviewResolve[frameId]->setMsaaFbo(msaaFbo ? msaaFbo : fbo); + } mMultiviewResolve[frameId]->resolveImplementation(state); } else @@ -133,11 +138,4 @@ namespace MWRender : fbo->apply(state, osg::FrameBufferObject::DRAW_FRAMEBUFFER); state.checkGLErrors("after TransparentDepthBinCallback::drawImplementation"); } - - void TransparentDepthBinCallback::dirtyFrame(int frameId) - { - if (mMultiviewResolve[frameId]) - mMultiviewResolve[frameId]->dirty(); - } - } diff --git a/apps/openmw/mwrender/transparentpass.hpp b/apps/openmw/mwrender/transparentpass.hpp index 3af6eb5abd..9d727cf08d 100644 --- a/apps/openmw/mwrender/transparentpass.hpp +++ b/apps/openmw/mwrender/transparentpass.hpp @@ -28,7 +28,6 @@ namespace MWRender void drawImplementation( osgUtil::RenderBin* bin, osg::RenderInfo& renderInfo, osgUtil::RenderLeaf*& previous) override; - void dirtyFrame(int frameId); std::array, 2> mFbo; std::array, 2> mMsaaFbo; diff --git a/components/stereo/multiview.cpp b/components/stereo/multiview.cpp index f12e2ed5a0..e3bcb7b479 100644 --- a/components/stereo/multiview.cpp +++ b/components/stereo/multiview.cpp @@ -735,6 +735,20 @@ namespace Stereo { } + void MultiviewFramebufferResolve::setResolveFbo(osg::FrameBufferObject* resolveFbo) + { + if (resolveFbo != mResolveFbo) + dirty(); + mResolveFbo = resolveFbo; + } + + void MultiviewFramebufferResolve::setMsaaFbo(osg::FrameBufferObject* msaaFbo) + { + if (msaaFbo != mMsaaFbo) + dirty(); + mMsaaFbo = msaaFbo; + } + void MultiviewFramebufferResolve::resolveImplementation(osg::State& state) { if (mDirtyLayers) diff --git a/components/stereo/multiview.hpp b/components/stereo/multiview.hpp index 684d998f7a..2c82666262 100644 --- a/components/stereo/multiview.hpp +++ b/components/stereo/multiview.hpp @@ -125,6 +125,9 @@ namespace Stereo const osg::FrameBufferObject* resolveFbo() const { return mResolveFbo; } const osg::FrameBufferObject* msaaFbo() const { return mMsaaFbo; } + void setResolveFbo(osg::FrameBufferObject* resolveFbo); + void setMsaaFbo(osg::FrameBufferObject* msaaFbo); + private: void setupLayers(); diff --git a/files/shaders/lib/core/vertex_multiview.glsl b/files/shaders/lib/core/vertex_multiview.glsl index 0447730e49..2d1d410532 100644 --- a/files/shaders/lib/core/vertex_multiview.glsl +++ b/files/shaders/lib/core/vertex_multiview.glsl @@ -1,4 +1,5 @@ -#version 330 +#version 330 compatibility +// Note: compatibility profile required to access gl_ModelViewMatrix #extension GL_OVR_multiview : require #extension GL_OVR_multiview2 : require