From f999f52f0af98ad37f0a837f25786513e2862f79 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Fri, 5 Aug 2022 11:59:58 +0200 Subject: Add a Framebuffer cache Adds a FramebufferCache singletion that operates the same way as UniformSetCache. Allows creating framebuffers on the fly (and keep them cached if re-requested) such as: ```C++ RID fb = FramebufferCache::get_singleton()->get_cache(texture1,texture2); ``` --- core/templates/rid_owner.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'core/templates/rid_owner.h') diff --git a/core/templates/rid_owner.h b/core/templates/rid_owner.h index 9c74b41818..320faebe98 100644 --- a/core/templates/rid_owner.h +++ b/core/templates/rid_owner.h @@ -79,7 +79,7 @@ class RID_Alloc : public RID_AllocBase { const char *description = nullptr; - SpinLock spin_lock; + mutable SpinLock spin_lock; _FORCE_INLINE_ RID _allocate_rid() { if (THREAD_SAFE) { @@ -220,7 +220,7 @@ public: memnew_placement(mem, T(p_value)); } - _FORCE_INLINE_ bool owns(const RID &p_rid) { + _FORCE_INLINE_ bool owns(const RID &p_rid) const { if (THREAD_SAFE) { spin_lock.lock(); } @@ -292,7 +292,7 @@ public: _FORCE_INLINE_ uint32_t get_rid_count() const { return alloc_count; } - void get_owned_list(List *p_owned) { + void get_owned_list(List *p_owned) const { if (THREAD_SAFE) { spin_lock.lock(); } @@ -308,7 +308,7 @@ public: } //used for fast iteration in the elements or RIDs - void fill_owned_buffer(RID *p_rid_buffer) { + void fill_owned_buffer(RID *p_rid_buffer) const { if (THREAD_SAFE) { spin_lock.lock(); } @@ -402,7 +402,7 @@ public: *ptr = p_new_ptr; } - _FORCE_INLINE_ bool owns(const RID &p_rid) { + _FORCE_INLINE_ bool owns(const RID &p_rid) const { return alloc.owns(p_rid); } @@ -414,11 +414,11 @@ public: return alloc.get_rid_count(); } - _FORCE_INLINE_ void get_owned_list(List *p_owned) { + _FORCE_INLINE_ void get_owned_list(List *p_owned) const { return alloc.get_owned_list(p_owned); } - void fill_owned_buffer(RID *p_rid_buffer) { + void fill_owned_buffer(RID *p_rid_buffer) const { alloc.fill_owned_buffer(p_rid_buffer); } @@ -458,7 +458,7 @@ public: return alloc.get_or_null(p_rid); } - _FORCE_INLINE_ bool owns(const RID &p_rid) { + _FORCE_INLINE_ bool owns(const RID &p_rid) const { return alloc.owns(p_rid); } @@ -470,10 +470,10 @@ public: return alloc.get_rid_count(); } - _FORCE_INLINE_ void get_owned_list(List *p_owned) { + _FORCE_INLINE_ void get_owned_list(List *p_owned) const { return alloc.get_owned_list(p_owned); } - void fill_owned_buffer(RID *p_rid_buffer) { + void fill_owned_buffer(RID *p_rid_buffer) const { alloc.fill_owned_buffer(p_rid_buffer); } -- cgit v1.2.3