Merge pull request #89398 from clayjohn/visual-debugger-coverage

Increase coverage of timestamps for visual profiler
This commit is contained in:
Rémi Verschelde 2024-04-04 14:31:19 +02:00
commit a28be933ee
No known key found for this signature in database
GPG Key ID: C3336907360768E1
5 changed files with 61 additions and 34 deletions

View File

@ -1011,6 +1011,12 @@ void ParticlesStorage::_particles_update_instance_buffer(Particles *particles, c
}
void ParticlesStorage::update_particles() {
if (!particle_update_list.first()) {
// Return early to avoid unnecessary state changes.
return;
}
RENDER_TIMESTAMP("Update GPUParticles");
glEnable(GL_RASTERIZER_DISCARD);
glBindFramebuffer(GL_FRAMEBUFFER, GLES3::TextureStorage::system_fbo);

View File

@ -1132,6 +1132,7 @@ void RenderForwardClustered::_update_sdfgi(RenderDataRD *p_render_data) {
}
if (rb.is_valid() && rb->has_custom_data(RB_SCOPE_SDFGI)) {
RENDER_TIMESTAMP("Render SDFGI");
Ref<RendererRD::GI::SDFGI> sdfgi = rb->get_custom_data(RB_SCOPE_SDFGI);
float exposure_normalization = 1.0;
@ -1403,7 +1404,8 @@ void RenderForwardClustered::_pre_opaque_render(RenderDataRD *p_render_data, boo
}
}
//cube shadows are rendered in their own way
RENDER_TIMESTAMP("Render OmniLight Shadows");
// Cube shadows are rendered in their own way.
for (const int &index : p_render_data->cube_shadows) {
_render_shadow_pass(p_render_data->render_shadows[index].light, p_render_data->shadow_atlas, p_render_data->render_shadows[index].pass, p_render_data->render_shadows[index].instances, camera_plane, lod_distance_multiplier, p_render_data->scene_data->screen_mesh_lod_threshold, true, true, true, p_render_data->render_info, viewport_size, p_render_data->scene_data->cam_transform);
}
@ -1459,6 +1461,7 @@ void RenderForwardClustered::_pre_opaque_render(RenderDataRD *p_render_data, boo
// drawcalls per eye/view. It will all sync up at the barrier.
if (p_use_ssao || p_use_ssil) {
RENDER_TIMESTAMP("Prepare Depth for SSAO/SSIL");
// Convert our depth buffer data to linear data in
for (uint32_t v = 0; v < rb->get_view_count(); v++) {
ss_effects->downsample_depth(rb, v, p_render_data->scene_data->view_projection[v]);
@ -1474,6 +1477,8 @@ void RenderForwardClustered::_pre_opaque_render(RenderDataRD *p_render_data, boo
}
}
RENDER_TIMESTAMP("Pre Opaque Render");
if (current_cluster_builder) {
// Note: when rendering stereoscopic (multiview) we are using our combined frustum projection to create
// our cluster data. We use reprojection in the shader to adjust for our left/right eye.
@ -1506,6 +1511,7 @@ void RenderForwardClustered::_pre_opaque_render(RenderDataRD *p_render_data, boo
}
if (rb_data.is_valid()) {
RENDER_TIMESTAMP("Update Volumetric Fog");
bool directional_shadows = RendererRD::LightStorage::get_singleton()->has_directional_shadows(directional_light_count);
_update_volumetric_fog(rb, p_render_data->environment, p_render_data->scene_data->cam_projection, p_render_data->scene_data->cam_transform, p_render_data->scene_data->prev_cam_transform.affine_inverse(), p_render_data->shadow_atlas, directional_light_count, directional_shadows, positional_light_count, p_render_data->voxel_gi_count, *p_render_data->fog_volumes);
}
@ -1967,6 +1973,7 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
WARN_PRINT_ONCE("Pre opaque rendering effects can't access resolved depth buffers.");
}
RENDER_TIMESTAMP("Process Pre Opaque Compositor Effects");
_process_compositor_effects(RS::COMPOSITOR_EFFECT_CALLBACK_TYPE_PRE_OPAQUE, p_render_data);
}
@ -1978,6 +1985,8 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
}
_pre_opaque_render(p_render_data, using_ssao, using_ssil, using_sdfgi || using_voxelgi, normal_roughness_views, rb_data.is_valid() && rb_data->has_voxelgi() ? rb_data->get_voxelgi() : RID());
RENDER_TIMESTAMP("Render Opaque Pass");
RD::get_singleton()->draw_command_begin_label("Render Opaque Pass");
p_render_data->scene_data->directional_light_count = p_render_data->directional_light_count;
@ -1988,8 +1997,6 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
_setup_environment(p_render_data, is_reflection_probe, screen_size, !is_reflection_probe, p_default_bg_color, true, using_motion_pass);
RENDER_TIMESTAMP("Render Opaque Pass");
RID rp_uniform_set = _setup_render_pass_uniform_set(RENDER_LIST_OPAQUE, p_render_data, radiance_texture, samplers, true);
{
@ -2053,6 +2060,7 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
}
}
RENDER_TIMESTAMP("Process Post Opaque Compositor Effects");
_process_compositor_effects(RS::COMPOSITOR_EFFECT_CALLBACK_TYPE_POST_OPAQUE, p_render_data);
}
@ -2113,6 +2121,7 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
}
{
RENDER_TIMESTAMP("Process Post Sky Compositor Effects");
// Don't need to check for depth or color resolve here, we've already triggered it.
_process_compositor_effects(RS::COMPOSITOR_EFFECT_CALLBACK_TYPE_POST_SKY, p_render_data);
}
@ -2190,6 +2199,7 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
}
}
RENDER_TIMESTAMP("Process Pre Transparent Compositor Effects");
_process_compositor_effects(RS::COMPOSITOR_EFFECT_CALLBACK_TYPE_PRE_TRANSPARENT, p_render_data);
}
@ -2234,6 +2244,7 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
RD::get_singleton()->draw_command_end_label();
{
RENDER_TIMESTAMP("Process Post Transparent Compositor Effects");
_process_compositor_effects(RS::COMPOSITOR_EFFECT_CALLBACK_TYPE_POST_TRANSPARENT, p_render_data);
}

View File

@ -1388,6 +1388,11 @@ void ParticlesStorage::_particles_update_buffers(Particles *particles) {
}
}
void ParticlesStorage::update_particles() {
if (!particle_update_list.first()) {
return;
}
RENDER_TIMESTAMP("Update GPUParticles");
uint32_t frame = RSG::rasterizer->get_frame_number();
bool uses_motion_vectors = RSG::viewport->get_num_viewports_with_motion_vectors() > 0;
while (particle_update_list.first()) {

View File

@ -3568,43 +3568,47 @@ void RendererSceneCull::render_probes() {
bool busy = false;
while (ref_probe) {
SelfList<InstanceReflectionProbeData> *next = ref_probe->next();
RID base = ref_probe->self()->owner->base;
if (ref_probe) {
RENDER_TIMESTAMP("Render ReflectionProbes");
switch (RSG::light_storage->reflection_probe_get_update_mode(base)) {
case RS::REFLECTION_PROBE_UPDATE_ONCE: {
if (busy) { //already rendering something
break;
}
while (ref_probe) {
SelfList<InstanceReflectionProbeData> *next = ref_probe->next();
RID base = ref_probe->self()->owner->base;
switch (RSG::light_storage->reflection_probe_get_update_mode(base)) {
case RS::REFLECTION_PROBE_UPDATE_ONCE: {
if (busy) { // Already rendering something.
break;
}
bool done = _render_reflection_probe_step(ref_probe->self()->owner, ref_probe->self()->render_step);
if (done) {
done_list.push_back(ref_probe);
} else {
ref_probe->self()->render_step++;
}
busy = true; // Do not render another one of this kind.
} break;
case RS::REFLECTION_PROBE_UPDATE_ALWAYS: {
int step = 0;
bool done = false;
while (!done) {
done = _render_reflection_probe_step(ref_probe->self()->owner, step);
step++;
}
bool done = _render_reflection_probe_step(ref_probe->self()->owner, ref_probe->self()->render_step);
if (done) {
done_list.push_back(ref_probe);
} else {
ref_probe->self()->render_step++;
}
} break;
}
busy = true; //do not render another one of this kind
} break;
case RS::REFLECTION_PROBE_UPDATE_ALWAYS: {
int step = 0;
bool done = false;
while (!done) {
done = _render_reflection_probe_step(ref_probe->self()->owner, step);
step++;
}
done_list.push_back(ref_probe);
} break;
ref_probe = next;
}
ref_probe = next;
}
// Now remove from our list
for (SelfList<InstanceReflectionProbeData> *rp : done_list) {
reflection_probe_render_list.remove(rp);
// Now remove from our list
for (SelfList<InstanceReflectionProbeData> *rp : done_list) {
reflection_probe_render_list.remove(rp);
}
}
/* VOXEL GIS */

View File

@ -80,6 +80,7 @@ void RenderingServerDefault::_draw(bool p_swap_buffers, double frame_step) {
uint64_t time_usec = OS::get_singleton()->get_ticks_usec();
RENDER_TIMESTAMP("Prepare Render Frame");
RSG::scene->update(); //update scenes stuff before updating instances
frame_setup_time = double(OS::get_singleton()->get_ticks_usec() - time_usec) / 1000.0;