Godot Engine – Multi-platform 2D and 3D game engine
Fix combination of MSAA 2D, screen-space AA and bilinear upscaling breaking 3D rendering.
Skyth35d5252d751d
diff --git a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_render_rd.cppindex 93f49c4b08b..bae15332315 100644--- a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp+++ b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp@@ -773,7 +773,7 @@ void RendererSceneRenderRD::_render_buffers_post_process_and_tonemap(const Rende// Note that this is cached so we only create the texture the first time.dest_fb_format = rb->get_base_data_format();RID dest_texture = rb->create_texture(SNAME("Tonemapper"), SNAME("destination"), dest_fb_format, RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT | RD::TEXTURE_USAGE_COLOR_ATTACHMENT_BIT, RD::TEXTURE_SAMPLES_1, color_size, 0, 1, true, true);- dest_fb = FramebufferCacheRD::get_singleton()->get_cache(dest_texture);+ dest_fb = FramebufferCacheRD::get_singleton()->get_cache_multiview(rb->get_view_count(), dest_texture);tonemap.dest_texture_size = color_size;} else {// If we do a nearest or bilinear upscale, we just render into our render target and our shader will upscale automatically.@@ -878,7 +878,12 @@ void RendererSceneRenderRD::_render_buffers_post_process_and_tonemap(const Rende// This is only necessary if screen-space antialiasing is active, otherwise this happens automatically during tonemapping.RID source_texture = rb->get_texture(use_smaa ? SNAME("SMAA") : SNAME("Tonemapper"), SNAME("destination"));RID dest_texture = texture_storage->render_target_get_rd_texture(render_target);- RID dest_fb = FramebufferCacheRD::get_singleton()->get_cache(dest_texture);++ // Create an explicit pass, since the automatic pass in "framebuffer_create" can incorrectly put the texture as a resolve attachment.+ RD::FramebufferPass pass;+ pass.color_attachments.push_back(0);++ RID dest_fb = FramebufferCacheRD::get_singleton()->get_cache_multipass(Vector<RID>{ dest_texture }, Vector<RD::FramebufferPass>{ pass }, rb->get_view_count());copy_effects->copy_to_fb_rect(source_texture, dest_fb, Rect2i(Point2i(), rb->get_target_size()), false, false, false, false, RID(), rb->get_view_count() > 1, false, false, false, Rect2(), 1.0, scale_mode != RSE::VIEWPORT_SCALING_3D_MODE_NEAREST);}