1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-20 19:41:36 +00:00

Fix anti-aliasing on macOS

Blitting to the resolve FBO in OSG::RenderStage was causing a GL_INVALID_FRAMEBUFFER_OPERATION due to a mismatch in attached colorbuffers between the FBOs bound in read and draw slots. This was because the normal attachment was invariantly attached to FBO_Interrupt, but not to other FBOs.
This commit is contained in:
thagberg 2025-05-07 16:31:22 -04:00
parent 1f724cc336
commit 883f9e5049

View file

@ -503,6 +503,7 @@ namespace MWRender
if (mSamples > 1) if (mSamples > 1)
{ {
fbos[FBO_Multisample] = new osg::FrameBufferObject; fbos[FBO_Multisample] = new osg::FrameBufferObject;
fbos[FBO_Intercept] = new osg::FrameBufferObject;
auto colorRB = createFrameBufferAttachmentFromTemplate( auto colorRB = createFrameBufferAttachmentFromTemplate(
Usage::RENDER_BUFFER, width, height, textures[Tex_Scene], mSamples); Usage::RENDER_BUFFER, width, height, textures[Tex_Scene], mSamples);
if (mNormals && mNormalsSupported) if (mNormals && mNormalsSupported)
@ -511,6 +512,8 @@ namespace MWRender
Usage::RENDER_BUFFER, width, height, textures[Tex_Normal], mSamples); Usage::RENDER_BUFFER, width, height, textures[Tex_Normal], mSamples);
fbos[FBO_Multisample]->setAttachment(osg::FrameBufferObject::BufferComponent::COLOR_BUFFER1, normalRB); fbos[FBO_Multisample]->setAttachment(osg::FrameBufferObject::BufferComponent::COLOR_BUFFER1, normalRB);
fbos[FBO_FirstPerson]->setAttachment(osg::FrameBufferObject::BufferComponent::COLOR_BUFFER1, normalRB); fbos[FBO_FirstPerson]->setAttachment(osg::FrameBufferObject::BufferComponent::COLOR_BUFFER1, normalRB);
fbos[FBO_Intercept]->setAttachment(osg::FrameBufferObject::BufferComponent::COLOR_BUFFER1,
Stereo::createMultiviewCompatibleAttachment(textures[Tex_Normal]));
} }
auto depthRB = createFrameBufferAttachmentFromTemplate( auto depthRB = createFrameBufferAttachmentFromTemplate(
Usage::RENDER_BUFFER, width, height, textures[Tex_Depth], mSamples); Usage::RENDER_BUFFER, width, height, textures[Tex_Depth], mSamples);
@ -519,11 +522,8 @@ namespace MWRender
osg::FrameBufferObject::BufferComponent::PACKED_DEPTH_STENCIL_BUFFER, depthRB); osg::FrameBufferObject::BufferComponent::PACKED_DEPTH_STENCIL_BUFFER, depthRB);
fbos[FBO_FirstPerson]->setAttachment(osg::FrameBufferObject::BufferComponent::COLOR_BUFFER0, colorRB); fbos[FBO_FirstPerson]->setAttachment(osg::FrameBufferObject::BufferComponent::COLOR_BUFFER0, colorRB);
fbos[FBO_Intercept] = new osg::FrameBufferObject;
fbos[FBO_Intercept]->setAttachment(osg::FrameBufferObject::BufferComponent::COLOR_BUFFER0, fbos[FBO_Intercept]->setAttachment(osg::FrameBufferObject::BufferComponent::COLOR_BUFFER0,
Stereo::createMultiviewCompatibleAttachment(textures[Tex_Scene])); Stereo::createMultiviewCompatibleAttachment(textures[Tex_Scene]));
fbos[FBO_Intercept]->setAttachment(osg::FrameBufferObject::BufferComponent::COLOR_BUFFER1,
Stereo::createMultiviewCompatibleAttachment(textures[Tex_Normal]));
} }
else else
{ {