summaryrefslogtreecommitdiff
path: root/servers/rendering/rendering_server_default.h
diff options
context:
space:
mode:
Diffstat (limited to 'servers/rendering/rendering_server_default.h')
-rw-r--r--servers/rendering/rendering_server_default.h90
1 files changed, 49 insertions, 41 deletions
diff --git a/servers/rendering/rendering_server_default.h b/servers/rendering/rendering_server_default.h
index 4a8944ccdd..8c93308e38 100644
--- a/servers/rendering/rendering_server_default.h
+++ b/servers/rendering/rendering_server_default.h
@@ -126,54 +126,53 @@ public:
#include "servers/server_wrap_mt_common.h"
-//from now on, calls forwarded to this singleton
-#define ServerName RendererStorage
-#define server_name RSG::storage
-
/* TEXTURE API */
-#define FUNCRIDTEX0(m_type) \
- virtual RID m_type##_create() override { \
- RID ret = RSG::storage->texture_allocate(); \
- if (Thread::get_caller_id() == server_thread || RSG::storage->can_create_resources_async()) { \
- RSG::storage->m_type##_initialize(ret); \
- } else { \
- command_queue.push(RSG::storage, &RendererStorage::m_type##_initialize, ret); \
- } \
- return ret; \
+#define ServerName RendererTextureStorage
+#define server_name RSG::texture_storage
+
+#define FUNCRIDTEX0(m_type) \
+ virtual RID m_type##_create() override { \
+ RID ret = RSG::texture_storage->texture_allocate(); \
+ if (Thread::get_caller_id() == server_thread || RSG::texture_storage->can_create_resources_async()) { \
+ RSG::texture_storage->m_type##_initialize(ret); \
+ } else { \
+ command_queue.push(RSG::texture_storage, &RendererTextureStorage::m_type##_initialize, ret); \
+ } \
+ return ret; \
}
-#define FUNCRIDTEX1(m_type, m_type1) \
- virtual RID m_type##_create(m_type1 p1) override { \
- RID ret = RSG::storage->texture_allocate(); \
- if (Thread::get_caller_id() == server_thread || RSG::storage->can_create_resources_async()) { \
- RSG::storage->m_type##_initialize(ret, p1); \
- } else { \
- command_queue.push(RSG::storage, &RendererStorage::m_type##_initialize, ret, p1); \
- } \
- return ret; \
+#define FUNCRIDTEX1(m_type, m_type1) \
+ virtual RID m_type##_create(m_type1 p1) override { \
+ RID ret = RSG::texture_storage->texture_allocate(); \
+ if (Thread::get_caller_id() == server_thread || RSG::texture_storage->can_create_resources_async()) { \
+ RSG::texture_storage->m_type##_initialize(ret, p1); \
+ } else { \
+ command_queue.push(RSG::texture_storage, &RendererTextureStorage::m_type##_initialize, ret, p1); \
+ } \
+ return ret; \
}
-#define FUNCRIDTEX2(m_type, m_type1, m_type2) \
- virtual RID m_type##_create(m_type1 p1, m_type2 p2) override { \
- RID ret = RSG::storage->texture_allocate(); \
- if (Thread::get_caller_id() == server_thread || RSG::storage->can_create_resources_async()) { \
- RSG::storage->m_type##_initialize(ret, p1, p2); \
- } else { \
- command_queue.push(RSG::storage, &RendererStorage::m_type##_initialize, ret, p1, p2); \
- } \
- return ret; \
+#define FUNCRIDTEX2(m_type, m_type1, m_type2) \
+ virtual RID m_type##_create(m_type1 p1, m_type2 p2) override { \
+ RID ret = RSG::texture_storage->texture_allocate(); \
+ if (Thread::get_caller_id() == server_thread || RSG::texture_storage->can_create_resources_async()) { \
+ RSG::texture_storage->m_type##_initialize(ret, p1, p2); \
+ } else { \
+ command_queue.push(RSG::texture_storage, &RendererTextureStorage::m_type##_initialize, ret, p1, p2); \
+ } \
+ return ret; \
}
-#define FUNCRIDTEX6(m_type, m_type1, m_type2, m_type3, m_type4, m_type5, m_type6) \
- virtual RID m_type##_create(m_type1 p1, m_type2 p2, m_type3 p3, m_type4 p4, m_type5 p5, m_type6 p6) override { \
- RID ret = RSG::storage->texture_allocate(); \
- if (Thread::get_caller_id() == server_thread || RSG::storage->can_create_resources_async()) { \
- RSG::storage->m_type##_initialize(ret, p1, p2, p3, p4, p5, p6); \
- } else { \
- command_queue.push(RSG::storage, &RendererStorage::m_type##_initialize, ret, p1, p2, p3, p4, p5, p6); \
- } \
- return ret; \
+#define FUNCRIDTEX6(m_type, m_type1, m_type2, m_type3, m_type4, m_type5, m_type6) \
+ virtual RID m_type##_create(m_type1 p1, m_type2 p2, m_type3 p3, m_type4 p4, m_type5 p5, m_type6 p6) override { \
+ RID ret = RSG::texture_storage->texture_allocate(); \
+ if (Thread::get_caller_id() == server_thread || RSG::texture_storage->can_create_resources_async()) { \
+ RSG::texture_storage->m_type##_initialize(ret, p1, p2, p3, p4, p5, p6); \
+ } else { \
+ command_queue.push(RSG::texture_storage, &RendererTextureStorage::m_type##_initialize, ret, p1, p2, p3, p4, p5, p6); \
+ } \
+ return ret; \
}
//these go pass-through, as they can be called from any thread
@@ -214,6 +213,13 @@ public:
FUNC2(texture_set_force_redraw_if_visible, RID, bool)
+//from now on, calls forwarded to this singleton
+#undef ServerName
+#undef server_name
+
+#define ServerName RendererStorage
+#define server_name RSG::storage
+
/* SHADER API */
FUNCRIDSPLIT(shader)
@@ -246,7 +252,9 @@ public:
virtual RID mesh_create_from_surfaces(const Vector<SurfaceData> &p_surfaces, int p_blend_shape_count = 0) override {
RID mesh = RSG::storage->mesh_allocate();
- if (Thread::get_caller_id() == server_thread || RSG::storage->can_create_resources_async()) {
+ // TODO once we have RSG::mesh_storage, add can_create_resources_async and call here instead of texture_storage!!
+
+ if (Thread::get_caller_id() == server_thread || RSG::texture_storage->can_create_resources_async()) {
if (Thread::get_caller_id() == server_thread) {
command_queue.flush_if_pending();
}