From 1adc4e5875782c064759bf810c511ac42b0f2d05 Mon Sep 17 00:00:00 2001 From: clayjohn Date: Thu, 2 Mar 2023 18:15:21 -0800 Subject: [PATCH] Add a few more rendering timestamps --- .../render_forward_clustered.cpp | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp index e0128bfe259..91789201c6c 100644 --- a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp +++ b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp @@ -1972,22 +1972,25 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co RD::get_singleton()->draw_list_end(); RD::get_singleton()->draw_command_end_label(); } + if (rb->get_msaa_3d() != RS::VIEWPORT_MSAA_DISABLED) { + RENDER_TIMESTAMP("Resolve MSAA"); - if (!can_continue_color && rb->get_msaa_3d() != RS::VIEWPORT_MSAA_DISABLED) { - // Handle views individual, might want to look at rewriting our resolve to do both layers in one pass. - for (uint32_t v = 0; v < rb->get_view_count(); v++) { - RD::get_singleton()->texture_resolve_multisample(rb_data->get_color_msaa(v), rb->get_internal_texture(v)); - } - if (using_separate_specular) { + if (!can_continue_color) { + // Handle views individual, might want to look at rewriting our resolve to do both layers in one pass. for (uint32_t v = 0; v < rb->get_view_count(); v++) { - RD::get_singleton()->texture_resolve_multisample(rb_data->get_specular_msaa(v), rb_data->get_specular(v)); + RD::get_singleton()->texture_resolve_multisample(rb_data->get_color_msaa(v), rb->get_internal_texture(v)); + } + if (using_separate_specular) { + for (uint32_t v = 0; v < rb->get_view_count(); v++) { + RD::get_singleton()->texture_resolve_multisample(rb_data->get_specular_msaa(v), rb_data->get_specular(v)); + } } } - } - if (!can_continue_depth && rb->get_msaa_3d() != RS::VIEWPORT_MSAA_DISABLED) { - for (uint32_t v = 0; v < rb->get_view_count(); v++) { - resolve_effects->resolve_depth(rb_data->get_depth_msaa(v), rb->get_depth_texture(v), rb->get_internal_size(), texture_multisamples[rb->get_msaa_3d()]); + if (!can_continue_depth) { + for (uint32_t v = 0; v < rb->get_view_count(); v++) { + resolve_effects->resolve_depth(rb_data->get_depth_msaa(v), rb->get_depth_texture(v), rb->get_internal_size(), texture_multisamples[rb->get_msaa_3d()]); + } } } @@ -2016,11 +2019,15 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co } if (scene_state.used_screen_texture) { + RENDER_TIMESTAMP("Copy Screen Texture"); + // Copy screen texture to backbuffer so we can read from it _render_buffers_copy_screen_texture(p_render_data); } if (scene_state.used_depth_texture) { + RENDER_TIMESTAMP("Copy Depth Texture"); + // Copy depth texture to backbuffer so we can read from it _render_buffers_copy_depth_texture(p_render_data); }