diff --git a/apps/openmw/mwrender/pingpongcanvas.cpp b/apps/openmw/mwrender/pingpongcanvas.cpp index 285dde884a..54d8145fa9 100644 --- a/apps/openmw/mwrender/pingpongcanvas.cpp +++ b/apps/openmw/mwrender/pingpongcanvas.cpp @@ -278,25 +278,6 @@ namespace MWRender if (pass.mRenderTarget) { - if (mDirtyAttachments.size() > 0) - { - const auto [w, h] - = pass.mSize.get(mTextureScene->getTextureWidth(), mTextureScene->getTextureHeight()); - - // Custom render targets must be shared between frame ids, so it's impossible to double buffer - // without expensive copies. That means the only thread-safe place to resize is in the draw - // thread. - osg::Texture2D* texture = const_cast(dynamic_cast( - pass.mRenderTarget->getAttachment(osg::FrameBufferObject::BufferComponent::COLOR_BUFFER0) - .getTexture())); - - assert(texture != nullptr); - - texture->setTextureSize(w, h); - texture->setNumMipmapLevels(pass.mRenderTexture->getNumMipmapLevels()); - texture->dirtyTextureObject(); - } - pass.mRenderTarget->apply(state, osg::FrameBufferObject::DRAW_FRAMEBUFFER); if (pass.mRenderTexture->getNumMipmapLevels() > 0) diff --git a/apps/openmw/mwrender/postprocessor.cpp b/apps/openmw/mwrender/postprocessor.cpp index 59559d70e7..d998b9d9d1 100644 --- a/apps/openmw/mwrender/postprocessor.cpp +++ b/apps/openmw/mwrender/postprocessor.cpp @@ -650,13 +650,16 @@ namespace MWRender subPass.mRenderTexture = renderTarget.mTarget; subPass.mMipMap = renderTarget.mMipMap; + const auto [w, h] = renderTarget.mSize.get(renderWidth(), renderHeight()); + subPass.mStateSet->setAttributeAndModes(new osg::Viewport(0, 0, w, h)); + + subPass.mRenderTexture->setTextureSize(w, h); + subPass.mRenderTexture->dirtyTextureObject(); + subPass.mRenderTarget = new osg::FrameBufferObject; subPass.mRenderTarget->setAttachment(osg::FrameBufferObject::BufferComponent::COLOR_BUFFER0, osg::FrameBufferAttachment(subPass.mRenderTexture)); - const auto [w, h] = renderTarget.mSize.get(renderWidth(), renderHeight()); - subPass.mStateSet->setAttributeAndModes(new osg::Viewport(0, 0, w, h)); - if (std::find_if(attachmentsToDirty.cbegin(), attachmentsToDirty.cend(), [renderTarget](const auto& rt) { return renderTarget.mTarget == rt.mTarget; }) == attachmentsToDirty.cend())