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.h105
1 files changed, 63 insertions, 42 deletions
diff --git a/servers/rendering/rendering_server_default.h b/servers/rendering/rendering_server_default.h
index 4a8944ccdd..ea8e8aa056 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();
}
@@ -354,7 +362,7 @@ public:
FUNC2(light_directional_set_shadow_mode, RID, LightDirectionalShadowMode)
FUNC2(light_directional_set_blend_splits, RID, bool)
- FUNC2(light_directional_set_sky_only, RID, bool)
+ FUNC2(light_directional_set_sky_mode, RID, LightDirectionalSkyMode)
/* PROBE API */
@@ -377,6 +385,12 @@ public:
/* DECAL API */
+#undef ServerName
+#undef server_name
+
+#define ServerName RendererDecalAtlasStorage
+#define server_name RSG::decal_atlas_storage
+
FUNCRIDSPLIT(decal)
FUNC2(decal_set_extents, RID, const Vector3 &)
@@ -391,6 +405,13 @@ public:
/* BAKED LIGHT API */
+//from now on, calls forwarded to this singleton
+#undef ServerName
+#undef server_name
+
+#define ServerName RendererStorage
+#define server_name RSG::storage
+
FUNCRIDSPLIT(voxel_gi)
FUNC8(voxel_gi_allocate_data, RID, const Transform3D &, const AABB &, const Vector3i &, const Vector<uint8_t> &, const Vector<uint8_t> &, const Vector<uint8_t> &, const Vector<int> &)