Add RENDERING_INFO parameters to GL Compatibility renderer
This also fixes RENDERING_INFO_TOTAL_PRIMITIVES_IN_FRAME for the RD renderers as it was incorrectly reporting vertex/index count at times This also adds memory tracking to textures and buffers to catch memory leaks. This also cleans up some memory leaks that the new system caught.
This commit is contained in:
committed by
Rémi Verschelde
parent
9c41c4ecb6
commit
36a005fafc
@ -984,9 +984,9 @@ void RenderForwardClustered::_fill_render_list(RenderListType p_render_list, con
|
||||
to_draw = _indices_to_primitives(surf->primitive, to_draw);
|
||||
to_draw *= inst->instance_count;
|
||||
if (p_render_list == RENDER_LIST_OPAQUE) { //opaque
|
||||
p_render_data->render_info->info[RS::VIEWPORT_RENDER_INFO_TYPE_VISIBLE][RS::VIEWPORT_RENDER_INFO_PRIMITIVES_IN_FRAME] += mesh_storage->mesh_surface_get_vertices_drawn_count(surf->surface);
|
||||
p_render_data->render_info->info[RS::VIEWPORT_RENDER_INFO_TYPE_VISIBLE][RS::VIEWPORT_RENDER_INFO_PRIMITIVES_IN_FRAME] += to_draw;
|
||||
} else if (p_render_list == RENDER_LIST_SECONDARY) { //shadow
|
||||
p_render_data->render_info->info[RS::VIEWPORT_RENDER_INFO_TYPE_SHADOW][RS::VIEWPORT_RENDER_INFO_PRIMITIVES_IN_FRAME] += mesh_storage->mesh_surface_get_vertices_drawn_count(surf->surface);
|
||||
p_render_data->render_info->info[RS::VIEWPORT_RENDER_INFO_TYPE_SHADOW][RS::VIEWPORT_RENDER_INFO_PRIMITIVES_IN_FRAME] += to_draw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1884,9 +1884,9 @@ void RenderForwardMobile::_fill_render_list(RenderListType p_render_list, const
|
||||
to_draw = _indices_to_primitives(surf->primitive, to_draw);
|
||||
to_draw *= inst->instance_count;
|
||||
if (p_render_list == RENDER_LIST_OPAQUE) { //opaque
|
||||
p_render_data->render_info->info[RS::VIEWPORT_RENDER_INFO_TYPE_VISIBLE][RS::VIEWPORT_RENDER_INFO_PRIMITIVES_IN_FRAME] += mesh_storage->mesh_surface_get_vertices_drawn_count(surf->surface);
|
||||
p_render_data->render_info->info[RS::VIEWPORT_RENDER_INFO_TYPE_VISIBLE][RS::VIEWPORT_RENDER_INFO_PRIMITIVES_IN_FRAME] += to_draw;
|
||||
} else if (p_render_list == RENDER_LIST_SECONDARY) { //shadow
|
||||
p_render_data->render_info->info[RS::VIEWPORT_RENDER_INFO_TYPE_SHADOW][RS::VIEWPORT_RENDER_INFO_PRIMITIVES_IN_FRAME] += mesh_storage->mesh_surface_get_vertices_drawn_count(surf->surface);
|
||||
p_render_data->render_info->info[RS::VIEWPORT_RENDER_INFO_TYPE_SHADOW][RS::VIEWPORT_RENDER_INFO_PRIMITIVES_IN_FRAME] += to_draw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1403,7 +1403,7 @@ void RendererViewport::call_set_vsync_mode(DisplayServer::VSyncMode p_mode, Disp
|
||||
int RendererViewport::get_total_objects_drawn() const {
|
||||
return total_objects_drawn;
|
||||
}
|
||||
int RendererViewport::get_total_vertices_drawn() const {
|
||||
int RendererViewport::get_total_primitives_drawn() const {
|
||||
return total_vertices_drawn;
|
||||
}
|
||||
int RendererViewport::get_total_draw_calls_used() const {
|
||||
|
||||
@ -297,7 +297,7 @@ public:
|
||||
bool free(RID p_rid);
|
||||
|
||||
int get_total_objects_drawn() const;
|
||||
int get_total_vertices_drawn() const;
|
||||
int get_total_primitives_drawn() const;
|
||||
int get_total_draw_calls_used() const;
|
||||
|
||||
// Workaround for setting this on thread.
|
||||
|
||||
@ -251,7 +251,7 @@ uint64_t RenderingServerDefault::get_rendering_info(RenderingInfo p_info) {
|
||||
if (p_info == RENDERING_INFO_TOTAL_OBJECTS_IN_FRAME) {
|
||||
return RSG::viewport->get_total_objects_drawn();
|
||||
} else if (p_info == RENDERING_INFO_TOTAL_PRIMITIVES_IN_FRAME) {
|
||||
return RSG::viewport->get_total_vertices_drawn();
|
||||
return RSG::viewport->get_total_primitives_drawn();
|
||||
} else if (p_info == RENDERING_INFO_TOTAL_DRAW_CALLS_IN_FRAME) {
|
||||
return RSG::viewport->get_total_draw_calls_used();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user