1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-28 16:07:14 +00:00

Fix transparent viewport backgrounds with custom clear color

This commit is contained in:
LRFLEW
2023-07-25 04:20:07 -05:00
parent da81ca62a5
commit 6effd3cde7
4 changed files with 14 additions and 15 deletions

View File

@@ -908,13 +908,19 @@ void RenderForwardMobile::_render_scene(RenderDataRD *p_render_data, const Color
{
// regular forward for now
Vector<Color> c;
c.push_back(clear_color.srgb_to_linear()); // our render buffer
if (rb_data.is_valid()) {
if (p_render_data->render_buffers->get_msaa_3d() != RS::VIEWPORT_MSAA_DISABLED) {
c.push_back(clear_color.srgb_to_linear()); // our resolve buffer
{
Color cc = clear_color.srgb_to_linear();
if (rb_data.is_valid()) {
cc.a = 0; // For transparent viewport backgrounds.
}
if (using_subpass_post_process) {
c.push_back(Color()); // our 2D buffer we're copying into
c.push_back(cc); // Our render buffer.
if (rb_data.is_valid()) {
if (p_render_data->render_buffers->get_msaa_3d() != RS::VIEWPORT_MSAA_DISABLED) {
c.push_back(clear_color.srgb_to_linear()); // Our resolve buffer.
}
if (using_subpass_post_process) {
c.push_back(Color()); // Our 2D buffer we're copying into.
}
}
}