summaryrefslogtreecommitdiff
path: root/servers/rendering/renderer_rd/renderer_storage_rd.h
diff options
context:
space:
mode:
Diffstat (limited to 'servers/rendering/renderer_rd/renderer_storage_rd.h')
-rw-r--r--servers/rendering/renderer_rd/renderer_storage_rd.h29
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);