def _update_stats(self): """ Updates the stats overlay """ clock = Globals.clock self._debug_lines[0].set_text("{:3.0f} fps | {:3.1f} ms | {:3.1f} ms max".format( clock.get_average_frame_rate(), 1000.0 / max(0.001, clock.get_average_frame_rate()), clock.get_max_frame_duration() * 1000.0)) text = "{:4d} render states | {:4d} transforms" text += " | {:4d} commands | {:6d} lights | {:5d} shadow sources" self._debug_lines[1].set_text(text.format( RenderState.get_num_states(), TransformState.get_num_states(), self._pipeline.light_mgr.get_cmd_queue().get_num_processed_commands(), self._pipeline.light_mgr.get_num_lights(), self._pipeline.light_mgr.get_num_shadow_sources(), )) text = "{:3.0f} MiB VRAM usage | {:5d} images | {:5d} textures | " text += "{:5d} render targets | {:3d} plugins" tex_info = self._buffer_viewer.get_stage_information() self._debug_lines[2].set_text(text.format( tex_info["memory"] / (1024**2) , Image._NUM_IMAGES, tex_info["count"], RenderTarget._NUM_BUFFERS_ALLOCATED, self._pipeline.plugin_mgr.get_interface().get_active_plugin_count() )) text = "{} ({:1.3f}) | {:3d} active constraints" self._debug_lines[3].set_text(text.format( self._pipeline.daytime_mgr.get_time_str(), self._pipeline.daytime_mgr.get_time(), self._pipeline.daytime_mgr.get_num_constraints() ))
def _update_stats(self, task=None): """ Updates the stats overlay """ clock = Globals.clock self._debug_lines[0].text = "{:3.0f} fps | {:3.1f} ms | {:3.1f} ms max".format( clock.get_average_frame_rate(), 1000.0 / max(0.001, clock.get_average_frame_rate()), clock.get_max_frame_duration() * 1000.0) text = "{:4d} render states | {:4d} transforms" text += " | {:4d} commands | {:4d} lights | {:5d} shadow sources " text += "| {:3.1f}% atlas usage" self._debug_lines[1].text = text.format( RenderState.get_num_states(), TransformState.get_num_states(), self._pipeline.light_mgr.cmd_queue.num_processed_commands, self._pipeline.light_mgr.num_lights, self._pipeline.light_mgr.num_shadow_sources, self._pipeline.light_mgr.shadow_atlas_coverage) text = "Pipeline: {:3.0f} MiB VRAM | {:5d} images | {:5d} textures | " text += "{:5d} render targets | {:3d} plugins" tex_memory, tex_count = self._buffer_viewer.stage_information self._debug_lines[2].text = text.format( tex_memory / (1024**2), len(Image.REGISTERED_IMAGES), tex_count, RenderTarget.NUM_ALLOCATED_BUFFERS, len(self._pipeline.plugin_mgr.enabled_plugins)) text = "Scene: {:4.0f} MiB VRAM | {:3d} textures | {:4d} geoms " text += "| {:4d} nodes | {:7,.0f} vertices | {:5.0f} MiB vTX data " scene_tex_size = 0 for tex in TexturePool.find_all_textures(): scene_tex_size += tex.estimate_texture_memory() self._debug_lines[3].text = text.format( scene_tex_size / (1024**2), len(TexturePool.find_all_textures()), self._analyzer.get_num_geoms(), self._analyzer.get_num_nodes(), self._analyzer.get_num_vertices(), self._analyzer.get_vertex_data_size() / (1024**2), ) text = "{} ({:1.3f}) | {:3d} daytime settings | X {:3.1f} Y {:3.1f} Z {:3.1f}" self._debug_lines[4].text = text.format( self._pipeline.daytime_mgr.formatted_time, self._pipeline.daytime_mgr.time, len(self._pipeline.plugin_mgr.day_settings), Globals.base.camera.get_x(Globals.base.render), Globals.base.camera.get_y(Globals.base.render), Globals.base.camera.get_z(Globals.base.render),) if task: return task.again
def update_stats(self, task=None): """ Updates the stats overlay """ clock = Globals.clock self.debug_lines[0].text = "{:3.0f} fps | {:3.1f} ms | {:3.1f} ms max".format( clock.get_average_frame_rate(), 1000.0 / max(0.001, clock.get_average_frame_rate()), clock.get_max_frame_duration() * 1000.0) if not self.advanced_info: return task.again if task else None text = "{:4d} states | {:4d} transforms " text += "| {:4d} cmds | {:4d} lights | {:4d} shadows " text += "| {:5.1f}% atlas usage" self.debug_lines[1].text = text.format( RenderState.get_num_states(), TransformState.get_num_states(), self.pipeline.light_mgr.cmd_queue.num_processed_commands, self.pipeline.light_mgr.num_lights, self.pipeline.light_mgr.num_shadow_sources, self.pipeline.light_mgr.shadow_atlas_coverage) text = "Internal: {:3.0f} MB VRAM | {:5d} img | {:5d} tex | " text += "{:5d} fbos | {:3d} plugins | {:2d} views ({:2d} active)" tex_memory, tex_count = self.buffer_viewer.stage_information views, active_views = 0, 0 for target in RenderTarget.REGISTERED_TARGETS: if not target.create_default_region: num_regions = target.internal_buffer.get_num_display_regions() for i, region in enumerate(target.internal_buffer.get_display_regions()): # Skip overlay display region if i == 0 and num_regions > 1: continue views += 1 active_views += 1 if target.active and region.active else 0 self.debug_lines[2].text = text.format( tex_memory / (1024**2), len(Image.REGISTERED_IMAGES), tex_count, RenderTarget.NUM_ALLOCATED_BUFFERS, len(self.pipeline.plugin_mgr.enabled_plugins), views, active_views) text = "Scene: {:4.0f} MB VRAM | {:3d} tex | {:4d} geoms " text += "| {:4d} nodes | {:7,.0f} vertices" scene_tex_size = 0 for tex in TexturePool.find_all_textures(): scene_tex_size += tex.estimate_texture_memory() self.debug_lines[3].text = text.format( scene_tex_size / (1024**2), len(TexturePool.find_all_textures()), self.analyzer.get_num_geoms(), self.analyzer.get_num_nodes(), self.analyzer.get_num_vertices(), ) sun_vector = Vec3(0) if self.pipeline.plugin_mgr.is_plugin_enabled("scattering"): sun_vector = self.pipeline.plugin_mgr.instances["scattering"].sun_vector text = "Time: {} ({:1.3f}) | Sun {:0.2f} {:0.2f} {:0.2f}" text += " | X {:3.1f} Y {:3.1f} Z {:3.1f}" text += " | {:2d} tasks | scheduled: {:2d}" self.debug_lines[4].text = text.format( self.pipeline.daytime_mgr.formatted_time, self.pipeline.daytime_mgr.time, sun_vector.x, sun_vector.y, sun_vector.z, Globals.base.camera.get_x(Globals.base.render), Globals.base.camera.get_y(Globals.base.render), Globals.base.camera.get_z(Globals.base.render), self.pipeline.task_scheduler.num_tasks, self.pipeline.task_scheduler.num_scheduled_tasks,) text = "Scene shadows: " if "pssm" in self.pipeline.plugin_mgr.enabled_plugins: focus = self.pipeline.plugin_mgr.instances["pssm"].scene_shadow_stage.last_focus if focus is not None: text += "{:3.1f} {:3.1f} {:3.1f} r {:3.1f}".format( focus[0].x, focus[0].y, focus[0].z, focus[1]) else: text += "none" else: text += "inactive" text += " | HPR ({:3.1f}, {:3.1f}, {:3.1f}) | {:4d} x {:4d} pixels @ {:3.1f} %" text += " | {:3d} x {:3d} tiles" self.debug_lines[5].text = text.format( Globals.base.camera.get_h(Globals.base.render), Globals.base.camera.get_p(Globals.base.render), Globals.base.camera.get_r(Globals.base.render), Globals.native_resolution.x, Globals.native_resolution.y, self.pipeline.settings["pipeline.resolution_scale"] * 100.0, self.pipeline.light_mgr.num_tiles.x, self.pipeline.light_mgr.num_tiles.y,) if task: return task.again