diff options
author | reduz <reduzio@gmail.com> | 2021-07-02 20:14:19 -0300 |
---|---|---|
committer | reduz <reduzio@gmail.com> | 2021-07-03 10:15:04 -0300 |
commit | 6c55d2aad22cd5fc3a7f1499c4cb85779613a394 (patch) | |
tree | 13e55bfba5921dfa904b93830be058b2ca9cc175 /servers/rendering/renderer_rd/renderer_storage_rd.h | |
parent | ecf9ea740ef99afbfac94fc5da50988279fd9b9b (diff) |
Fix Render Info
* Fixed and redone the process to obtain render information from a viewport
* Some stats, such as material changes are too difficult to guess on Vulkan, were removed.
* Separated visible and shadow stats, which causes confusion.
* Texture, buffer and general video memory can be queried now.
* Fixed the performance metrics too.
Diffstat (limited to 'servers/rendering/renderer_rd/renderer_storage_rd.h')
-rw-r--r-- | servers/rendering/renderer_rd/renderer_storage_rd.h | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/servers/rendering/renderer_rd/renderer_storage_rd.h b/servers/rendering/renderer_rd/renderer_storage_rd.h index 26739b11da..80dea6e5ea 100644 --- a/servers/rendering/renderer_rd/renderer_storage_rd.h +++ b/servers/rendering/renderer_rd/renderer_storage_rd.h @@ -434,6 +434,7 @@ private: struct LOD { float edge_length = 0.0; + uint32_t index_count = 0; RID index_buffer; RID index_array; }; @@ -1524,10 +1525,18 @@ public: return s->lod_count > 0; } - _FORCE_INLINE_ uint32_t mesh_surface_get_lod(void *p_surface, float p_model_scale, float p_distance_threshold, float p_lod_threshold) const { + _FORCE_INLINE_ uint32_t mesh_surface_get_vertices_drawn_count(void *p_surface) const { + Mesh::Surface *s = reinterpret_cast<Mesh::Surface *>(p_surface); + return s->index_count ? s->index_count : s->vertex_count; + } + + _FORCE_INLINE_ uint32_t mesh_surface_get_lod(void *p_surface, float p_model_scale, float p_distance_threshold, float p_lod_threshold, uint32_t *r_index_count = nullptr) const { Mesh::Surface *s = reinterpret_cast<Mesh::Surface *>(p_surface); int32_t current_lod = -1; + if (r_index_count) { + *r_index_count = s->index_count; + } for (uint32_t i = 0; i < s->lod_count; i++) { float screen_size = s->lods[i].edge_length * p_model_scale / p_distance_threshold; if (screen_size > p_lod_threshold) { @@ -1538,6 +1547,9 @@ public: if (current_lod == -1) { return 0; } else { + if (r_index_count) { + *r_index_count = s->lods[current_lod].index_count; + } return current_lod + 1; } } @@ -2322,13 +2334,16 @@ public: void set_debug_generate_wireframes(bool p_generate) {} - void render_info_begin_capture() {} - void render_info_end_capture() {} - int get_captured_render_info(RS::RenderInfo p_info) { return 0; } + //keep cached since it can be called form any thread + uint64_t texture_mem_cache = 0; + uint64_t buffer_mem_cache = 0; + uint64_t total_mem_cache = 0; + + virtual void update_memory_info(); + virtual uint64_t get_rendering_info(RS::RenderingInfo p_info); - uint64_t get_render_info(RS::RenderInfo p_info) { return 0; } - String get_video_adapter_name() const { return String(); } - String get_video_adapter_vendor() const { return String(); } + String get_video_adapter_name() const; + String get_video_adapter_vendor() const; virtual void capture_timestamps_begin(); virtual void capture_timestamp(const String &p_name); |