2
0

rendering_server_default.h 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210
  1. /**************************************************************************/
  2. /* rendering_server_default.h */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /**************************************************************************/
  30. #pragma once
  31. #include "core/object/worker_thread_pool.h"
  32. #include "core/os/thread.h"
  33. #include "core/templates/command_queue_mt.h"
  34. #include "core/templates/hash_map.h"
  35. #include "renderer_canvas_cull.h"
  36. #include "renderer_viewport.h"
  37. #include "rendering_server_globals.h"
  38. #include "servers/rendering/renderer_compositor.h"
  39. #include "servers/rendering/rendering_server.h"
  40. #include "servers/server_wrap_mt_common.h"
  41. class RenderingServerDefault : public RenderingServer {
  42. GDSOFTCLASS(RenderingServerDefault, RenderingServer);
  43. enum {
  44. MAX_INSTANCE_CULL = 8192,
  45. MAX_INSTANCE_LIGHTS = 4,
  46. LIGHT_CACHE_DIRTY = -1,
  47. MAX_LIGHTS_CULLED = 256,
  48. MAX_ROOM_CULL = 32,
  49. MAX_EXTERIOR_PORTALS = 128,
  50. MAX_LIGHT_SAMPLERS = 256,
  51. INSTANCE_ROOMLESS_MASK = (1 << 20)
  52. };
  53. static int changes;
  54. RID test_cube;
  55. List<Callable> frame_drawn_callbacks;
  56. static void _changes_changed() {}
  57. uint64_t frame_profile_frame = 0;
  58. Vector<FrameProfileArea> frame_profile;
  59. double frame_setup_time = 0;
  60. //for printing
  61. bool print_gpu_profile = false;
  62. HashMap<String, float> print_gpu_profile_task_time;
  63. uint64_t print_frame_profile_ticks_from = 0;
  64. uint32_t print_frame_profile_frame_count = 0;
  65. mutable CommandQueueMT command_queue;
  66. Thread::ID server_thread = Thread::MAIN_ID;
  67. WorkerThreadPool::TaskID server_task_id = WorkerThreadPool::INVALID_TASK_ID;
  68. bool exit = false;
  69. bool create_thread = false;
  70. void _assign_mt_ids(WorkerThreadPool::TaskID p_pump_task_id);
  71. void _thread_exit();
  72. void _thread_loop();
  73. void _draw(bool p_swap_buffers, double frame_step);
  74. void _run_post_draw_steps();
  75. void _init();
  76. void _finish();
  77. void _free(RID p_rid);
  78. void _call_on_render_thread(const Callable &p_callable);
  79. public:
  80. //if editor is redrawing when it shouldn't, enable this and put a breakpoint in _changes_changed()
  81. //#define DEBUG_CHANGES
  82. #ifdef DEBUG_CHANGES
  83. _FORCE_INLINE_ static void redraw_request() {
  84. changes++;
  85. _changes_changed();
  86. }
  87. #else
  88. _FORCE_INLINE_ static void redraw_request() {
  89. changes++;
  90. }
  91. #endif
  92. #define WRITE_ACTION redraw_request();
  93. #define ASYNC_COND_PUSH (Thread::get_caller_id() != server_thread)
  94. #define ASYNC_COND_PUSH_AND_RET (Thread::get_caller_id() != server_thread)
  95. #define ASYNC_COND_PUSH_AND_SYNC (Thread::get_caller_id() != server_thread)
  96. #ifdef DEBUG_SYNC
  97. #define SYNC_DEBUG print_line("sync on: " + String(__FUNCTION__));
  98. #else
  99. #define SYNC_DEBUG
  100. #endif
  101. #ifdef DEBUG_ENABLED
  102. #define MAIN_THREAD_SYNC_WARN WARN_PRINT("Call to " + String(__FUNCTION__) + " causing RenderingServer synchronizations on every frame. This significantly affects performance.");
  103. #endif
  104. /* TEXTURE API */
  105. #define ServerName RendererTextureStorage
  106. #define server_name RSG::texture_storage
  107. #define FUNCRIDTEX0(m_type) \
  108. virtual RID m_type##_create() override { \
  109. RID ret = RSG::texture_storage->texture_allocate(); \
  110. if (Thread::get_caller_id() == server_thread || RSG::rasterizer->can_create_resources_async()) { \
  111. RSG::texture_storage->m_type##_initialize(ret); \
  112. } else { \
  113. command_queue.push(RSG::texture_storage, &RendererTextureStorage::m_type##_initialize, ret); \
  114. } \
  115. return ret; \
  116. }
  117. #define FUNCRIDTEX1(m_type, m_type1) \
  118. virtual RID m_type##_create(m_type1 p1) override { \
  119. RID ret = RSG::texture_storage->texture_allocate(); \
  120. if (Thread::get_caller_id() == server_thread || RSG::rasterizer->can_create_resources_async()) { \
  121. RSG::texture_storage->m_type##_initialize(ret, p1); \
  122. } else { \
  123. command_queue.push(RSG::texture_storage, &RendererTextureStorage::m_type##_initialize, ret, p1); \
  124. } \
  125. return ret; \
  126. }
  127. #define FUNCRIDTEX2(m_type, m_type1, m_type2) \
  128. virtual RID m_type##_create(m_type1 p1, m_type2 p2) override { \
  129. RID ret = RSG::texture_storage->texture_allocate(); \
  130. if (Thread::get_caller_id() == server_thread || RSG::rasterizer->can_create_resources_async()) { \
  131. RSG::texture_storage->m_type##_initialize(ret, p1, p2); \
  132. } else { \
  133. command_queue.push(RSG::texture_storage, &RendererTextureStorage::m_type##_initialize, ret, p1, p2); \
  134. } \
  135. return ret; \
  136. }
  137. #define FUNCRIDTEX3(m_type, m_type1, m_type2, m_type3) \
  138. virtual RID m_type##_create(m_type1 p1, m_type2 p2, m_type3 p3) override { \
  139. RID ret = RSG::texture_storage->texture_allocate(); \
  140. if (Thread::get_caller_id() == server_thread || RSG::rasterizer->can_create_resources_async()) { \
  141. RSG::texture_storage->m_type##_initialize(ret, p1, p2, p3); \
  142. } else { \
  143. command_queue.push(RSG::texture_storage, &RendererTextureStorage::m_type##_initialize, ret, p1, p2, p3); \
  144. } \
  145. return ret; \
  146. }
  147. #define FUNCRIDTEX6(m_type, m_type1, m_type2, m_type3, m_type4, m_type5, m_type6) \
  148. virtual RID m_type##_create(m_type1 p1, m_type2 p2, m_type3 p3, m_type4 p4, m_type5 p5, m_type6 p6) override { \
  149. RID ret = RSG::texture_storage->texture_allocate(); \
  150. if (Thread::get_caller_id() == server_thread || RSG::rasterizer->can_create_resources_async()) { \
  151. RSG::texture_storage->m_type##_initialize(ret, p1, p2, p3, p4, p5, p6); \
  152. } else { \
  153. command_queue.push(RSG::texture_storage, &RendererTextureStorage::m_type##_initialize, ret, p1, p2, p3, p4, p5, p6); \
  154. } \
  155. return ret; \
  156. }
  157. //these go pass-through, as they can be called from any thread
  158. FUNCRIDTEX1(texture_2d, const Ref<Image> &)
  159. FUNCRIDTEX2(texture_2d_layered, const Vector<Ref<Image>> &, TextureLayeredType)
  160. FUNCRIDTEX6(texture_3d, Image::Format, int, int, int, bool, const Vector<Ref<Image>> &)
  161. FUNCRIDTEX3(texture_external, int, int, uint64_t)
  162. FUNCRIDTEX1(texture_proxy, RID)
  163. // Called directly, not through the command queue.
  164. virtual RID texture_create_from_native_handle(TextureType p_type, Image::Format p_format, uint64_t p_native_handle, int p_width, int p_height, int p_depth, int p_layers = 1, TextureLayeredType p_layered_type = TEXTURE_LAYERED_2D_ARRAY) override {
  165. return RSG::texture_storage->texture_create_from_native_handle(p_type, p_format, p_native_handle, p_width, p_height, p_depth, p_layers, p_layered_type);
  166. }
  167. //these go through command queue if they are in another thread
  168. FUNC3(texture_2d_update, RID, const Ref<Image> &, int)
  169. FUNC2(texture_3d_update, RID, const Vector<Ref<Image>> &)
  170. FUNC4(texture_external_update, RID, int, int, uint64_t)
  171. FUNC2(texture_proxy_update, RID, RID)
  172. //these also go pass-through
  173. FUNCRIDTEX0(texture_2d_placeholder)
  174. FUNCRIDTEX1(texture_2d_layered_placeholder, TextureLayeredType)
  175. FUNCRIDTEX0(texture_3d_placeholder)
  176. FUNC1RC(Ref<Image>, texture_2d_get, RID)
  177. FUNC2RC(Ref<Image>, texture_2d_layer_get, RID, int)
  178. FUNC1RC(Vector<Ref<Image>>, texture_3d_get, RID)
  179. FUNC2(texture_replace, RID, RID)
  180. FUNC3(texture_set_size_override, RID, int, int)
  181. // FIXME: Disabled during Vulkan refactoring, should be ported.
  182. #if 0
  183. FUNC2(texture_bind, RID, uint32_t)
  184. #endif
  185. FUNC3(texture_set_detect_3d_callback, RID, TextureDetectCallback, void *)
  186. FUNC3(texture_set_detect_normal_callback, RID, TextureDetectCallback, void *)
  187. FUNC3(texture_set_detect_roughness_callback, RID, TextureDetectRoughnessCallback, void *)
  188. FUNC2(texture_set_path, RID, const String &)
  189. FUNC1RC(String, texture_get_path, RID)
  190. FUNC1RC(Image::Format, texture_get_format, RID)
  191. FUNC1(texture_debug_usage, List<TextureInfo> *)
  192. FUNC2(texture_set_force_redraw_if_visible, RID, bool)
  193. FUNCRIDTEX2(texture_rd, const RID &, const RS::TextureLayeredType)
  194. FUNC2RC(RID, texture_get_rd_texture, RID, bool)
  195. FUNC2RC(uint64_t, texture_get_native_handle, RID, bool)
  196. /* SHADER API */
  197. #undef ServerName
  198. #undef server_name
  199. #define ServerName RendererMaterialStorage
  200. #define server_name RSG::material_storage
  201. virtual RID shader_create() override {
  202. RID ret = RSG::material_storage->shader_allocate();
  203. if (Thread::get_caller_id() == server_thread) {
  204. RSG::material_storage->shader_initialize(ret, false);
  205. } else {
  206. command_queue.push(RSG::material_storage, &ServerName::shader_initialize, ret, false);
  207. }
  208. return ret;
  209. }
  210. virtual RID shader_create_from_code(const String &p_code, const String &p_path_hint = String()) override {
  211. RID shader = RSG::material_storage->shader_allocate();
  212. bool using_server_thread = Thread::get_caller_id() == server_thread;
  213. if (using_server_thread || RSG::rasterizer->can_create_resources_async()) {
  214. if (using_server_thread) {
  215. command_queue.flush_if_pending();
  216. }
  217. RSG::material_storage->shader_initialize(shader, false);
  218. RSG::material_storage->shader_set_path_hint(shader, p_path_hint);
  219. RSG::material_storage->shader_set_code(shader, p_code);
  220. } else {
  221. command_queue.push(RSG::material_storage, &RendererMaterialStorage::shader_initialize, shader, false);
  222. command_queue.push(RSG::material_storage, &RendererMaterialStorage::shader_set_code, shader, p_code);
  223. command_queue.push(RSG::material_storage, &RendererMaterialStorage::shader_set_path_hint, shader, p_path_hint);
  224. }
  225. return shader;
  226. }
  227. FUNC2(shader_set_code, RID, const String &)
  228. FUNC2(shader_set_path_hint, RID, const String &)
  229. FUNC1RC(String, shader_get_code, RID)
  230. FUNC2SC(get_shader_parameter_list, RID, List<PropertyInfo> *)
  231. FUNC4(shader_set_default_texture_parameter, RID, const StringName &, RID, int)
  232. FUNC3RC(RID, shader_get_default_texture_parameter, RID, const StringName &, int)
  233. FUNC2RC(Variant, shader_get_parameter_default, RID, const StringName &)
  234. FUNC1RC(ShaderNativeSourceCode, shader_get_native_source_code, RID)
  235. /* COMMON MATERIAL API */
  236. FUNCRIDSPLIT(material)
  237. virtual RID material_create_from_shader(RID p_next_pass, int p_render_priority, RID p_shader) override {
  238. RID material = RSG::material_storage->material_allocate();
  239. bool using_server_thread = Thread::get_caller_id() == server_thread;
  240. if (using_server_thread || RSG::rasterizer->can_create_resources_async()) {
  241. if (using_server_thread) {
  242. command_queue.flush_if_pending();
  243. }
  244. RSG::material_storage->material_initialize(material);
  245. RSG::material_storage->material_set_next_pass(material, p_next_pass);
  246. RSG::material_storage->material_set_render_priority(material, p_render_priority);
  247. RSG::material_storage->material_set_shader(material, p_shader);
  248. } else {
  249. command_queue.push(RSG::material_storage, &RendererMaterialStorage::material_initialize, material);
  250. command_queue.push(RSG::material_storage, &RendererMaterialStorage::material_set_next_pass, material, p_next_pass);
  251. command_queue.push(RSG::material_storage, &RendererMaterialStorage::material_set_render_priority, material, p_render_priority);
  252. command_queue.push(RSG::material_storage, &RendererMaterialStorage::material_set_shader, material, p_shader);
  253. }
  254. return material;
  255. }
  256. FUNC2(material_set_shader, RID, RID)
  257. FUNC3(material_set_param, RID, const StringName &, const Variant &)
  258. FUNC2RC(Variant, material_get_param, RID, const StringName &)
  259. FUNC2(material_set_render_priority, RID, int)
  260. FUNC2(material_set_next_pass, RID, RID)
  261. /* MESH API */
  262. //from now on, calls forwarded to this singleton
  263. #undef ServerName
  264. #undef server_name
  265. #define ServerName RendererMeshStorage
  266. #define server_name RSG::mesh_storage
  267. virtual RID mesh_create_from_surfaces(const Vector<SurfaceData> &p_surfaces, int p_blend_shape_count = 0) override {
  268. RID mesh = RSG::mesh_storage->mesh_allocate();
  269. bool using_server_thread = Thread::get_caller_id() == server_thread;
  270. if (using_server_thread || RSG::rasterizer->can_create_resources_async()) {
  271. if (using_server_thread) {
  272. command_queue.flush_if_pending();
  273. }
  274. RSG::mesh_storage->mesh_initialize(mesh);
  275. RSG::mesh_storage->mesh_set_blend_shape_count(mesh, p_blend_shape_count);
  276. for (int i = 0; i < p_surfaces.size(); i++) {
  277. RSG::mesh_storage->mesh_add_surface(mesh, p_surfaces[i]);
  278. }
  279. RSG::scene->mesh_generate_pipelines(mesh, using_server_thread);
  280. } else {
  281. command_queue.push(RSG::mesh_storage, &RendererMeshStorage::mesh_initialize, mesh);
  282. command_queue.push(RSG::mesh_storage, &RendererMeshStorage::mesh_set_blend_shape_count, mesh, p_blend_shape_count);
  283. for (int i = 0; i < p_surfaces.size(); i++) {
  284. command_queue.push(RSG::mesh_storage, &RendererMeshStorage::mesh_add_surface, mesh, p_surfaces[i]);
  285. }
  286. command_queue.push(RSG::scene, &RenderingMethod::mesh_generate_pipelines, mesh, true);
  287. }
  288. return mesh;
  289. }
  290. FUNC2(mesh_set_blend_shape_count, RID, int)
  291. FUNCRIDSPLIT(mesh)
  292. FUNC2(mesh_add_surface, RID, const SurfaceData &)
  293. FUNC1RC(int, mesh_get_blend_shape_count, RID)
  294. FUNC2(mesh_set_blend_shape_mode, RID, BlendShapeMode)
  295. FUNC1RC(BlendShapeMode, mesh_get_blend_shape_mode, RID)
  296. FUNC4(mesh_surface_update_vertex_region, RID, int, int, const Vector<uint8_t> &)
  297. FUNC4(mesh_surface_update_attribute_region, RID, int, int, const Vector<uint8_t> &)
  298. FUNC4(mesh_surface_update_skin_region, RID, int, int, const Vector<uint8_t> &)
  299. FUNC4(mesh_surface_update_index_region, RID, int, int, const Vector<uint8_t> &)
  300. FUNC3(mesh_surface_set_material, RID, int, RID)
  301. FUNC2RC(RID, mesh_surface_get_material, RID, int)
  302. FUNC2RC(SurfaceData, mesh_get_surface, RID, int)
  303. FUNC1RC(int, mesh_get_surface_count, RID)
  304. FUNC2(mesh_set_custom_aabb, RID, const AABB &)
  305. FUNC1RC(AABB, mesh_get_custom_aabb, RID)
  306. FUNC2(mesh_set_path, RID, const String &)
  307. FUNC1RC(String, mesh_get_path, RID)
  308. FUNC2(mesh_set_shadow_mesh, RID, RID)
  309. FUNC2(mesh_surface_remove, RID, int)
  310. FUNC1(mesh_clear, RID)
  311. FUNC1(mesh_debug_usage, List<MeshInfo> *)
  312. /* MULTIMESH API */
  313. FUNCRIDSPLIT(multimesh)
  314. FUNC6(multimesh_allocate_data, RID, int, MultimeshTransformFormat, bool, bool, bool)
  315. FUNC1RC(int, multimesh_get_instance_count, RID)
  316. FUNC2(multimesh_set_mesh, RID, RID)
  317. FUNC3(multimesh_instance_set_transform, RID, int, const Transform3D &)
  318. FUNC3(multimesh_instance_set_transform_2d, RID, int, const Transform2D &)
  319. FUNC3(multimesh_instance_set_color, RID, int, const Color &)
  320. FUNC3(multimesh_instance_set_custom_data, RID, int, const Color &)
  321. FUNC2(multimesh_set_custom_aabb, RID, const AABB &)
  322. FUNC1RC(AABB, multimesh_get_custom_aabb, RID)
  323. FUNC1RC(RID, multimesh_get_mesh, RID)
  324. FUNC1RC(AABB, multimesh_get_aabb, RID)
  325. FUNC2RC(Transform3D, multimesh_instance_get_transform, RID, int)
  326. FUNC2RC(Transform2D, multimesh_instance_get_transform_2d, RID, int)
  327. FUNC2RC(Color, multimesh_instance_get_color, RID, int)
  328. FUNC2RC(Color, multimesh_instance_get_custom_data, RID, int)
  329. FUNC2(multimesh_set_buffer, RID, const Vector<float> &)
  330. FUNC1RC(RID, multimesh_get_command_buffer_rd_rid, RID)
  331. FUNC1RC(RID, multimesh_get_buffer_rd_rid, RID)
  332. FUNC1RC(Vector<float>, multimesh_get_buffer, RID)
  333. FUNC3(multimesh_set_buffer_interpolated, RID, const Vector<float> &, const Vector<float> &)
  334. FUNC2(multimesh_set_physics_interpolated, RID, bool)
  335. FUNC2(multimesh_set_physics_interpolation_quality, RID, MultimeshPhysicsInterpolationQuality)
  336. FUNC2(multimesh_instance_reset_physics_interpolation, RID, int)
  337. FUNC1(multimesh_instances_reset_physics_interpolation, RID)
  338. FUNC2(multimesh_set_visible_instances, RID, int)
  339. FUNC1RC(int, multimesh_get_visible_instances, RID)
  340. /* SKELETON API */
  341. FUNCRIDSPLIT(skeleton)
  342. FUNC3(skeleton_allocate_data, RID, int, bool)
  343. FUNC1RC(int, skeleton_get_bone_count, RID)
  344. FUNC3(skeleton_bone_set_transform, RID, int, const Transform3D &)
  345. FUNC2RC(Transform3D, skeleton_bone_get_transform, RID, int)
  346. FUNC3(skeleton_bone_set_transform_2d, RID, int, const Transform2D &)
  347. FUNC2RC(Transform2D, skeleton_bone_get_transform_2d, RID, int)
  348. FUNC2(skeleton_set_base_transform_2d, RID, const Transform2D &)
  349. /* Light API */
  350. #undef ServerName
  351. #undef server_name
  352. #define ServerName RendererLightStorage
  353. #define server_name RSG::light_storage
  354. FUNCRIDSPLIT(directional_light)
  355. FUNCRIDSPLIT(omni_light)
  356. FUNCRIDSPLIT(spot_light)
  357. FUNC2(light_set_color, RID, const Color &)
  358. FUNC3(light_set_param, RID, LightParam, float)
  359. FUNC2(light_set_shadow, RID, bool)
  360. FUNC2(light_set_projector, RID, RID)
  361. FUNC2(light_set_negative, RID, bool)
  362. FUNC2(light_set_cull_mask, RID, uint32_t)
  363. FUNC5(light_set_distance_fade, RID, bool, float, float, float)
  364. FUNC2(light_set_reverse_cull_face_mode, RID, bool)
  365. FUNC2(light_set_shadow_caster_mask, RID, uint32_t)
  366. FUNC2(light_set_bake_mode, RID, LightBakeMode)
  367. FUNC2(light_set_max_sdfgi_cascade, RID, uint32_t)
  368. FUNC2(light_omni_set_shadow_mode, RID, LightOmniShadowMode)
  369. FUNC2(light_directional_set_shadow_mode, RID, LightDirectionalShadowMode)
  370. FUNC2(light_directional_set_blend_splits, RID, bool)
  371. FUNC2(light_directional_set_sky_mode, RID, LightDirectionalSkyMode)
  372. /* PROBE API */
  373. FUNCRIDSPLIT(reflection_probe)
  374. FUNC2(reflection_probe_set_update_mode, RID, ReflectionProbeUpdateMode)
  375. FUNC2(reflection_probe_set_intensity, RID, float)
  376. FUNC2(reflection_probe_set_blend_distance, RID, float)
  377. FUNC2(reflection_probe_set_ambient_color, RID, const Color &)
  378. FUNC2(reflection_probe_set_ambient_energy, RID, float)
  379. FUNC2(reflection_probe_set_ambient_mode, RID, ReflectionProbeAmbientMode)
  380. FUNC2(reflection_probe_set_max_distance, RID, float)
  381. FUNC2(reflection_probe_set_size, RID, const Vector3 &)
  382. FUNC2(reflection_probe_set_origin_offset, RID, const Vector3 &)
  383. FUNC2(reflection_probe_set_as_interior, RID, bool)
  384. FUNC2(reflection_probe_set_enable_box_projection, RID, bool)
  385. FUNC2(reflection_probe_set_enable_shadows, RID, bool)
  386. FUNC2(reflection_probe_set_cull_mask, RID, uint32_t)
  387. FUNC2(reflection_probe_set_reflection_mask, RID, uint32_t)
  388. FUNC2(reflection_probe_set_resolution, RID, int)
  389. FUNC2(reflection_probe_set_mesh_lod_threshold, RID, float)
  390. /* LIGHTMAP */
  391. FUNCRIDSPLIT(lightmap)
  392. FUNC3(lightmap_set_textures, RID, RID, bool)
  393. FUNC2(lightmap_set_probe_bounds, RID, const AABB &)
  394. FUNC2(lightmap_set_probe_interior, RID, bool)
  395. FUNC5(lightmap_set_probe_capture_data, RID, const PackedVector3Array &, const PackedColorArray &, const PackedInt32Array &, const PackedInt32Array &)
  396. FUNC2(lightmap_set_baked_exposure_normalization, RID, float)
  397. FUNC1RC(PackedVector3Array, lightmap_get_probe_capture_points, RID)
  398. FUNC1RC(PackedColorArray, lightmap_get_probe_capture_sh, RID)
  399. FUNC1RC(PackedInt32Array, lightmap_get_probe_capture_tetrahedra, RID)
  400. FUNC1RC(PackedInt32Array, lightmap_get_probe_capture_bsp_tree, RID)
  401. FUNC1(lightmap_set_probe_capture_update_speed, float)
  402. FUNC2(lightmap_set_shadowmask_textures, RID, RID)
  403. FUNC1R(ShadowmaskMode, lightmap_get_shadowmask_mode, RID)
  404. FUNC2(lightmap_set_shadowmask_mode, RID, ShadowmaskMode)
  405. /* Shadow Atlas */
  406. FUNC0R(RID, shadow_atlas_create)
  407. FUNC3(shadow_atlas_set_size, RID, int, bool)
  408. FUNC3(shadow_atlas_set_quadrant_subdivision, RID, int, int)
  409. FUNC2(directional_shadow_atlas_set_size, int, bool)
  410. /* DECAL API */
  411. #undef ServerName
  412. #undef server_name
  413. #define ServerName RendererTextureStorage
  414. #define server_name RSG::texture_storage
  415. FUNCRIDSPLIT(decal)
  416. FUNC2(decal_set_size, RID, const Vector3 &)
  417. FUNC3(decal_set_texture, RID, DecalTexture, RID)
  418. FUNC2(decal_set_emission_energy, RID, float)
  419. FUNC2(decal_set_albedo_mix, RID, float)
  420. FUNC2(decal_set_modulate, RID, const Color &)
  421. FUNC2(decal_set_cull_mask, RID, uint32_t)
  422. FUNC4(decal_set_distance_fade, RID, bool, float, float)
  423. FUNC3(decal_set_fade, RID, float, float)
  424. FUNC2(decal_set_normal_fade, RID, float)
  425. /* BAKED LIGHT API */
  426. //from now on, calls forwarded to this singleton
  427. #undef ServerName
  428. #undef server_name
  429. #define ServerName RendererGI
  430. #define server_name RSG::gi
  431. FUNCRIDSPLIT(voxel_gi)
  432. 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> &)
  433. FUNC1RC(AABB, voxel_gi_get_bounds, RID)
  434. FUNC1RC(Vector3i, voxel_gi_get_octree_size, RID)
  435. FUNC1RC(Vector<uint8_t>, voxel_gi_get_octree_cells, RID)
  436. FUNC1RC(Vector<uint8_t>, voxel_gi_get_data_cells, RID)
  437. FUNC1RC(Vector<uint8_t>, voxel_gi_get_distance_field, RID)
  438. FUNC1RC(Vector<int>, voxel_gi_get_level_counts, RID)
  439. FUNC1RC(Transform3D, voxel_gi_get_to_cell_xform, RID)
  440. FUNC2(voxel_gi_set_dynamic_range, RID, float)
  441. FUNC2(voxel_gi_set_propagation, RID, float)
  442. FUNC2(voxel_gi_set_energy, RID, float)
  443. FUNC2(voxel_gi_set_baked_exposure_normalization, RID, float)
  444. FUNC2(voxel_gi_set_bias, RID, float)
  445. FUNC2(voxel_gi_set_normal_bias, RID, float)
  446. FUNC2(voxel_gi_set_interior, RID, bool)
  447. FUNC2(voxel_gi_set_use_two_bounces, RID, bool)
  448. FUNC0(sdfgi_reset)
  449. /* PARTICLES */
  450. #undef ServerName
  451. #undef server_name
  452. #define ServerName RendererParticlesStorage
  453. #define server_name RSG::particles_storage
  454. FUNCRIDSPLIT(particles)
  455. FUNC2(particles_set_mode, RID, ParticlesMode)
  456. FUNC2(particles_set_emitting, RID, bool)
  457. FUNC1R(bool, particles_get_emitting, RID)
  458. FUNC2(particles_set_amount, RID, int)
  459. FUNC2(particles_set_amount_ratio, RID, float)
  460. FUNC2(particles_set_lifetime, RID, double)
  461. FUNC2(particles_set_one_shot, RID, bool)
  462. FUNC2(particles_set_pre_process_time, RID, double)
  463. FUNC2(particles_request_process_time, RID, real_t)
  464. FUNC2(particles_set_explosiveness_ratio, RID, float)
  465. FUNC2(particles_set_randomness_ratio, RID, float)
  466. FUNC2(particles_set_seed, RID, uint32_t)
  467. FUNC2(particles_set_custom_aabb, RID, const AABB &)
  468. FUNC2(particles_set_speed_scale, RID, double)
  469. FUNC2(particles_set_use_local_coordinates, RID, bool)
  470. FUNC2(particles_set_process_material, RID, RID)
  471. FUNC2(particles_set_fixed_fps, RID, int)
  472. FUNC2(particles_set_interpolate, RID, bool)
  473. FUNC2(particles_set_fractional_delta, RID, bool)
  474. FUNC1R(bool, particles_is_inactive, RID)
  475. FUNC3(particles_set_trails, RID, bool, float)
  476. FUNC2(particles_set_trail_bind_poses, RID, const Vector<Transform3D> &)
  477. FUNC1(particles_request_process, RID)
  478. FUNC1(particles_restart, RID)
  479. FUNC6(particles_emit, RID, const Transform3D &, const Vector3 &, const Color &, const Color &, uint32_t)
  480. FUNC2(particles_set_subemitter, RID, RID)
  481. FUNC2(particles_set_collision_base_size, RID, float)
  482. FUNC2(particles_set_transform_align, RID, RS::ParticlesTransformAlign)
  483. FUNC2(particles_set_draw_order, RID, RS::ParticlesDrawOrder)
  484. FUNC2(particles_set_draw_passes, RID, int)
  485. FUNC3(particles_set_draw_pass_mesh, RID, int, RID)
  486. FUNC1R(AABB, particles_get_current_aabb, RID)
  487. FUNC2(particles_set_emission_transform, RID, const Transform3D &)
  488. FUNC2(particles_set_emitter_velocity, RID, const Vector3 &)
  489. FUNC2(particles_set_interp_to_end, RID, float)
  490. /* PARTICLES COLLISION */
  491. FUNCRIDSPLIT(particles_collision)
  492. FUNC2(particles_collision_set_collision_type, RID, ParticlesCollisionType)
  493. FUNC2(particles_collision_set_cull_mask, RID, uint32_t)
  494. FUNC2(particles_collision_set_sphere_radius, RID, real_t)
  495. FUNC2(particles_collision_set_box_extents, RID, const Vector3 &)
  496. FUNC2(particles_collision_set_attractor_strength, RID, real_t)
  497. FUNC2(particles_collision_set_attractor_directionality, RID, real_t)
  498. FUNC2(particles_collision_set_attractor_attenuation, RID, real_t)
  499. FUNC2(particles_collision_set_field_texture, RID, RID)
  500. FUNC1(particles_collision_height_field_update, RID)
  501. FUNC2(particles_collision_set_height_field_mask, RID, uint32_t)
  502. FUNC2(particles_collision_set_height_field_resolution, RID, ParticlesCollisionHeightfieldResolution)
  503. /* FOG VOLUME */
  504. #undef ServerName
  505. #undef server_name
  506. #define ServerName RendererFog
  507. #define server_name RSG::fog
  508. FUNCRIDSPLIT(fog_volume)
  509. FUNC2(fog_volume_set_shape, RID, FogVolumeShape)
  510. FUNC2(fog_volume_set_size, RID, const Vector3 &)
  511. FUNC2(fog_volume_set_material, RID, RID)
  512. /* VISIBILITY_NOTIFIER */
  513. #undef ServerName
  514. #undef server_name
  515. #define ServerName RendererUtilities
  516. #define server_name RSG::utilities
  517. FUNCRIDSPLIT(visibility_notifier)
  518. FUNC2(visibility_notifier_set_aabb, RID, const AABB &)
  519. FUNC3(visibility_notifier_set_callbacks, RID, const Callable &, const Callable &)
  520. #undef server_name
  521. #undef ServerName
  522. //from now on, calls forwarded to this singleton
  523. #define ServerName RenderingMethod
  524. #define server_name RSG::scene
  525. /* CAMERA API */
  526. FUNCRIDSPLIT(camera)
  527. FUNC4(camera_set_perspective, RID, float, float, float)
  528. FUNC4(camera_set_orthogonal, RID, float, float, float)
  529. FUNC5(camera_set_frustum, RID, float, Vector2, float, float)
  530. FUNC2(camera_set_transform, RID, const Transform3D &)
  531. FUNC2(camera_set_cull_mask, RID, uint32_t)
  532. FUNC2(camera_set_environment, RID, RID)
  533. FUNC2(camera_set_camera_attributes, RID, RID)
  534. FUNC2(camera_set_compositor, RID, RID)
  535. FUNC2(camera_set_use_vertical_aspect, RID, bool)
  536. /* OCCLUDER */
  537. FUNCRIDSPLIT(occluder)
  538. FUNC3(occluder_set_mesh, RID, const PackedVector3Array &, const PackedInt32Array &)
  539. #undef server_name
  540. #undef ServerName
  541. //from now on, calls forwarded to this singleton
  542. #define ServerName RendererViewport
  543. #define server_name RSG::viewport
  544. /* VIEWPORT TARGET API */
  545. FUNCRIDSPLIT(viewport)
  546. #ifndef XR_DISABLED
  547. FUNC2(viewport_set_use_xr, RID, bool)
  548. #endif // XR_DISABLED
  549. FUNC3(viewport_set_size, RID, int, int)
  550. FUNC2(viewport_set_active, RID, bool)
  551. FUNC2(viewport_set_parent_viewport, RID, RID)
  552. FUNC2(viewport_set_clear_mode, RID, ViewportClearMode)
  553. FUNC3(viewport_attach_to_screen, RID, const Rect2 &, int)
  554. FUNC2(viewport_set_render_direct_to_screen, RID, bool)
  555. FUNC2(viewport_set_scaling_3d_mode, RID, ViewportScaling3DMode)
  556. FUNC2(viewport_set_scaling_3d_scale, RID, float)
  557. FUNC2(viewport_set_fsr_sharpness, RID, float)
  558. FUNC2(viewport_set_texture_mipmap_bias, RID, float)
  559. FUNC2(viewport_set_anisotropic_filtering_level, RID, ViewportAnisotropicFiltering)
  560. FUNC2(viewport_set_update_mode, RID, ViewportUpdateMode)
  561. FUNC1RC(ViewportUpdateMode, viewport_get_update_mode, RID)
  562. FUNC1RC(RID, viewport_get_render_target, RID)
  563. FUNC1RC(RID, viewport_get_texture, RID)
  564. FUNC2(viewport_set_disable_2d, RID, bool)
  565. FUNC2(viewport_set_environment_mode, RID, ViewportEnvironmentMode)
  566. FUNC2(viewport_set_disable_3d, RID, bool)
  567. FUNC2(viewport_set_canvas_cull_mask, RID, uint32_t)
  568. FUNC2(viewport_attach_camera, RID, RID)
  569. FUNC2(viewport_set_scenario, RID, RID)
  570. FUNC2(viewport_attach_canvas, RID, RID)
  571. FUNC2(viewport_remove_canvas, RID, RID)
  572. FUNC3(viewport_set_canvas_transform, RID, RID, const Transform2D &)
  573. FUNC2(viewport_set_transparent_background, RID, bool)
  574. FUNC2(viewport_set_use_hdr_2d, RID, bool)
  575. FUNC1RC(bool, viewport_is_using_hdr_2d, RID)
  576. FUNC2(viewport_set_snap_2d_transforms_to_pixel, RID, bool)
  577. FUNC2(viewport_set_snap_2d_vertices_to_pixel, RID, bool)
  578. FUNC2(viewport_set_default_canvas_item_texture_filter, RID, CanvasItemTextureFilter)
  579. FUNC2(viewport_set_default_canvas_item_texture_repeat, RID, CanvasItemTextureRepeat)
  580. FUNC2(viewport_set_global_canvas_transform, RID, const Transform2D &)
  581. FUNC4(viewport_set_canvas_stacking, RID, RID, int, int)
  582. FUNC3(viewport_set_positional_shadow_atlas_size, RID, int, bool)
  583. FUNC3(viewport_set_sdf_oversize_and_scale, RID, ViewportSDFOversize, ViewportSDFScale)
  584. FUNC3(viewport_set_positional_shadow_atlas_quadrant_subdivision, RID, int, int)
  585. FUNC2(viewport_set_msaa_2d, RID, ViewportMSAA)
  586. FUNC2(viewport_set_msaa_3d, RID, ViewportMSAA)
  587. FUNC2(viewport_set_screen_space_aa, RID, ViewportScreenSpaceAA)
  588. FUNC2(viewport_set_use_taa, RID, bool)
  589. FUNC2(viewport_set_use_debanding, RID, bool)
  590. FUNC2(viewport_set_force_motion_vectors, RID, bool)
  591. FUNC2(viewport_set_use_occlusion_culling, RID, bool)
  592. FUNC1(viewport_set_occlusion_rays_per_thread, int)
  593. FUNC1(viewport_set_occlusion_culling_build_quality, ViewportOcclusionCullingBuildQuality)
  594. FUNC2(viewport_set_mesh_lod_threshold, RID, float)
  595. FUNC3R(int, viewport_get_render_info, RID, ViewportRenderInfoType, ViewportRenderInfo)
  596. FUNC2(viewport_set_debug_draw, RID, ViewportDebugDraw)
  597. FUNC2(viewport_set_measure_render_time, RID, bool)
  598. FUNC1RC(double, viewport_get_measured_render_time_cpu, RID)
  599. FUNC1RC(double, viewport_get_measured_render_time_gpu, RID)
  600. FUNC1RC(RID, viewport_find_from_screen_attachment, DisplayServer::WindowID)
  601. FUNC2(call_set_vsync_mode, DisplayServer::VSyncMode, DisplayServer::WindowID)
  602. FUNC2(viewport_set_vrs_mode, RID, ViewportVRSMode)
  603. FUNC2(viewport_set_vrs_update_mode, RID, ViewportVRSUpdateMode)
  604. FUNC2(viewport_set_vrs_texture, RID, RID)
  605. /* COMPOSITOR EFFECT */
  606. #undef server_name
  607. #undef ServerName
  608. //from now on, calls forwarded to this singleton
  609. #define ServerName RenderingMethod
  610. #define server_name RSG::scene
  611. FUNCRIDSPLIT(compositor_effect)
  612. FUNC2(compositor_effect_set_enabled, RID, bool)
  613. FUNC3(compositor_effect_set_callback, RID, CompositorEffectCallbackType, const Callable &)
  614. FUNC3(compositor_effect_set_flag, RID, CompositorEffectFlags, bool)
  615. /* COMPOSITOR */
  616. FUNC2(compositor_set_compositor_effects, RID, const TypedArray<RID> &)
  617. FUNCRIDSPLIT(compositor)
  618. /* ENVIRONMENT API */
  619. FUNC1(voxel_gi_set_quality, VoxelGIQuality)
  620. /* SKY API */
  621. FUNCRIDSPLIT(sky)
  622. FUNC2(sky_set_radiance_size, RID, int)
  623. FUNC2(sky_set_mode, RID, SkyMode)
  624. FUNC2(sky_set_material, RID, RID)
  625. FUNC4R(Ref<Image>, sky_bake_panorama, RID, float, bool, const Size2i &)
  626. /* ENVIRONMENT */
  627. FUNCRIDSPLIT(environment)
  628. FUNC2(environment_set_background, RID, EnvironmentBG)
  629. FUNC2(environment_set_sky, RID, RID)
  630. FUNC2(environment_set_sky_custom_fov, RID, float)
  631. FUNC2(environment_set_sky_orientation, RID, const Basis &)
  632. FUNC2(environment_set_bg_color, RID, const Color &)
  633. FUNC3(environment_set_bg_energy, RID, float, float)
  634. FUNC2(environment_set_canvas_max_layer, RID, int)
  635. FUNC6(environment_set_ambient_light, RID, const Color &, EnvironmentAmbientSource, float, float, EnvironmentReflectionSource)
  636. FUNC2(environment_set_camera_feed_id, RID, int)
  637. FUNC6(environment_set_ssr, RID, bool, int, float, float, float)
  638. FUNC1(environment_set_ssr_half_size, bool)
  639. FUNC1(environment_set_ssr_roughness_quality, EnvironmentSSRRoughnessQuality)
  640. FUNC10(environment_set_ssao, RID, bool, float, float, float, float, float, float, float, float)
  641. FUNC6(environment_set_ssao_quality, EnvironmentSSAOQuality, bool, float, int, float, float)
  642. FUNC6(environment_set_ssil, RID, bool, float, float, float, float)
  643. FUNC6(environment_set_ssil_quality, EnvironmentSSILQuality, bool, float, int, float, float)
  644. FUNC13(environment_set_glow, RID, bool, Vector<float>, float, float, float, float, EnvironmentGlowBlendMode, float, float, float, float, RID)
  645. FUNC1(environment_glow_set_use_bicubic_upscale, bool)
  646. FUNC4(environment_set_tonemap, RID, EnvironmentToneMapper, float, float)
  647. FUNC2(environment_set_tonemap_agx_contrast, RID, float)
  648. FUNC7(environment_set_adjustment, RID, bool, float, float, float, bool, RID)
  649. FUNC11(environment_set_fog, RID, bool, const Color &, float, float, float, float, float, float, float, EnvironmentFogMode)
  650. FUNC4(environment_set_fog_depth, RID, float, float, float)
  651. FUNC14(environment_set_volumetric_fog, RID, bool, float, const Color &, const Color &, float, float, float, float, float, bool, float, float, float)
  652. FUNC2(environment_set_volumetric_fog_volume_size, int, int)
  653. FUNC1(environment_set_volumetric_fog_filter_active, bool)
  654. FUNC11(environment_set_sdfgi, RID, bool, int, float, EnvironmentSDFGIYScale, bool, float, bool, float, float, float)
  655. FUNC1(environment_set_sdfgi_ray_count, EnvironmentSDFGIRayCount)
  656. FUNC1(environment_set_sdfgi_frames_to_converge, EnvironmentSDFGIFramesToConverge)
  657. FUNC1(environment_set_sdfgi_frames_to_update_light, EnvironmentSDFGIFramesToUpdateLight)
  658. FUNC3R(Ref<Image>, environment_bake_panorama, RID, bool, const Size2i &)
  659. FUNC3(screen_space_roughness_limiter_set_active, bool, float, float)
  660. FUNC1(sub_surface_scattering_set_quality, SubSurfaceScatteringQuality)
  661. FUNC2(sub_surface_scattering_set_scale, float, float)
  662. FUNC1(positional_soft_shadow_filter_set_quality, ShadowQuality);
  663. FUNC1(directional_soft_shadow_filter_set_quality, ShadowQuality);
  664. FUNC1(decals_set_filter, RS::DecalFilter);
  665. FUNC1(light_projectors_set_filter, RS::LightProjectorFilter);
  666. FUNC1(lightmaps_set_bicubic_filter, bool);
  667. FUNC1(material_set_use_debanding, bool);
  668. /* CAMERA ATTRIBUTES */
  669. #undef server_name
  670. #undef ServerName
  671. //from now on, calls forwarded to this singleton
  672. #define ServerName RendererCameraAttributes
  673. #define server_name RSG::camera_attributes
  674. FUNCRIDSPLIT(camera_attributes)
  675. FUNC2(camera_attributes_set_dof_blur_quality, DOFBlurQuality, bool)
  676. FUNC1(camera_attributes_set_dof_blur_bokeh_shape, DOFBokehShape)
  677. FUNC8(camera_attributes_set_dof_blur, RID, bool, float, float, bool, float, float, float)
  678. FUNC3(camera_attributes_set_exposure, RID, float, float)
  679. FUNC6(camera_attributes_set_auto_exposure, RID, bool, float, float, float, float)
  680. /* SCENARIO API */
  681. #undef server_name
  682. #undef ServerName
  683. #define ServerName RenderingMethod
  684. #define server_name RSG::scene
  685. FUNCRIDSPLIT(scenario)
  686. FUNC2(scenario_set_environment, RID, RID)
  687. FUNC2(scenario_set_camera_attributes, RID, RID)
  688. FUNC2(scenario_set_fallback_environment, RID, RID)
  689. FUNC2(scenario_set_compositor, RID, RID)
  690. /* INSTANCING API */
  691. FUNCRIDSPLIT(instance)
  692. FUNC2(instance_set_base, RID, RID)
  693. FUNC2(instance_set_scenario, RID, RID)
  694. FUNC2(instance_set_layer_mask, RID, uint32_t)
  695. FUNC3(instance_set_pivot_data, RID, float, bool)
  696. FUNC2(instance_set_transform, RID, const Transform3D &)
  697. FUNC2(instance_attach_object_instance_id, RID, ObjectID)
  698. FUNC3(instance_set_blend_shape_weight, RID, int, float)
  699. FUNC3(instance_set_surface_override_material, RID, int, RID)
  700. FUNC2(instance_set_visible, RID, bool)
  701. FUNC1(instance_teleport, RID)
  702. FUNC2(instance_set_custom_aabb, RID, AABB)
  703. FUNC2(instance_attach_skeleton, RID, RID)
  704. FUNC2(instance_set_extra_visibility_margin, RID, real_t)
  705. FUNC2(instance_set_visibility_parent, RID, RID)
  706. FUNC2(instance_set_ignore_culling, RID, bool)
  707. // don't use these in a game!
  708. FUNC2RC(Vector<ObjectID>, instances_cull_aabb, const AABB &, RID)
  709. FUNC3RC(Vector<ObjectID>, instances_cull_ray, const Vector3 &, const Vector3 &, RID)
  710. FUNC2RC(Vector<ObjectID>, instances_cull_convex, const Vector<Plane> &, RID)
  711. FUNC3(instance_geometry_set_flag, RID, InstanceFlags, bool)
  712. FUNC2(instance_geometry_set_cast_shadows_setting, RID, ShadowCastingSetting)
  713. FUNC2(instance_geometry_set_material_override, RID, RID)
  714. FUNC2(instance_geometry_set_material_overlay, RID, RID)
  715. FUNC6(instance_geometry_set_visibility_range, RID, float, float, float, float, VisibilityRangeFadeMode)
  716. FUNC4(instance_geometry_set_lightmap, RID, RID, const Rect2 &, int)
  717. FUNC2(instance_geometry_set_lod_bias, RID, float)
  718. FUNC2(instance_geometry_set_transparency, RID, float)
  719. FUNC3(instance_geometry_set_shader_parameter, RID, const StringName &, const Variant &)
  720. FUNC2RC(Variant, instance_geometry_get_shader_parameter, RID, const StringName &)
  721. FUNC2RC(Variant, instance_geometry_get_shader_parameter_default_value, RID, const StringName &)
  722. FUNC2C(instance_geometry_get_shader_parameter_list, RID, List<PropertyInfo> *)
  723. FUNC3R(TypedArray<Image>, bake_render_uv2, RID, const TypedArray<RID> &, const Size2i &)
  724. FUNC1(gi_set_use_half_resolution, bool)
  725. #undef server_name
  726. #undef ServerName
  727. //from now on, calls forwarded to this singleton
  728. #define ServerName RendererCanvasCull
  729. #define server_name RSG::canvas
  730. /* CANVAS (2D) */
  731. FUNCRIDSPLIT(canvas)
  732. FUNC3(canvas_set_item_mirroring, RID, RID, const Point2 &)
  733. FUNC3(canvas_set_item_repeat, RID, const Point2 &, int)
  734. FUNC2(canvas_set_modulate, RID, const Color &)
  735. FUNC3(canvas_set_parent, RID, RID, float)
  736. FUNC1(canvas_set_disable_scale, bool)
  737. FUNCRIDSPLIT(canvas_texture)
  738. FUNC3(canvas_texture_set_channel, RID, CanvasTextureChannel, RID)
  739. FUNC3(canvas_texture_set_shading_parameters, RID, const Color &, float)
  740. FUNC2(canvas_texture_set_texture_filter, RID, CanvasItemTextureFilter)
  741. FUNC2(canvas_texture_set_texture_repeat, RID, CanvasItemTextureRepeat)
  742. FUNCRIDSPLIT(canvas_item)
  743. FUNC2(canvas_item_set_parent, RID, RID)
  744. FUNC2(canvas_item_set_default_texture_filter, RID, CanvasItemTextureFilter)
  745. FUNC2(canvas_item_set_default_texture_repeat, RID, CanvasItemTextureRepeat)
  746. FUNC2(canvas_item_set_visible, RID, bool)
  747. FUNC2(canvas_item_set_light_mask, RID, int)
  748. FUNC2(canvas_item_set_visibility_layer, RID, uint32_t)
  749. FUNC2(canvas_item_set_update_when_visible, RID, bool)
  750. FUNC2(canvas_item_set_transform, RID, const Transform2D &)
  751. FUNC2(canvas_item_set_clip, RID, bool)
  752. FUNC2(canvas_item_set_distance_field_mode, RID, bool)
  753. FUNC3(canvas_item_set_custom_rect, RID, bool, const Rect2 &)
  754. FUNC2(canvas_item_set_modulate, RID, const Color &)
  755. FUNC2(canvas_item_set_self_modulate, RID, const Color &)
  756. FUNC2(canvas_item_set_draw_behind_parent, RID, bool)
  757. FUNC2(canvas_item_set_use_identity_transform, RID, bool)
  758. FUNC6(canvas_item_add_line, RID, const Point2 &, const Point2 &, const Color &, float, bool)
  759. FUNC5(canvas_item_add_polyline, RID, const Vector<Point2> &, const Vector<Color> &, float, bool)
  760. FUNC5(canvas_item_add_multiline, RID, const Vector<Point2> &, const Vector<Color> &, float, bool)
  761. FUNC4(canvas_item_add_rect, RID, const Rect2 &, const Color &, bool)
  762. FUNC6(canvas_item_add_ellipse, RID, const Point2 &, float, float, const Color &, bool)
  763. FUNC5(canvas_item_add_circle, RID, const Point2 &, float, const Color &, bool)
  764. FUNC6(canvas_item_add_texture_rect, RID, const Rect2 &, RID, bool, const Color &, bool)
  765. FUNC7(canvas_item_add_texture_rect_region, RID, const Rect2 &, RID, const Rect2 &, const Color &, bool, bool)
  766. FUNC8(canvas_item_add_msdf_texture_rect_region, RID, const Rect2 &, RID, const Rect2 &, const Color &, int, float, float)
  767. FUNC5(canvas_item_add_lcd_texture_rect_region, RID, const Rect2 &, RID, const Rect2 &, const Color &)
  768. FUNC10(canvas_item_add_nine_patch, RID, const Rect2 &, const Rect2 &, RID, const Vector2 &, const Vector2 &, NinePatchAxisMode, NinePatchAxisMode, bool, const Color &)
  769. FUNC5(canvas_item_add_primitive, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID)
  770. FUNC5(canvas_item_add_polygon, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID)
  771. FUNC9(canvas_item_add_triangle_array, RID, const Vector<int> &, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, const Vector<int> &, const Vector<float> &, RID, int)
  772. FUNC5(canvas_item_add_mesh, RID, const RID &, const Transform2D &, const Color &, RID)
  773. FUNC3(canvas_item_add_multimesh, RID, RID, RID)
  774. FUNC3(canvas_item_add_particles, RID, RID, RID)
  775. FUNC2(canvas_item_add_set_transform, RID, const Transform2D &)
  776. FUNC2(canvas_item_add_clip_ignore, RID, bool)
  777. FUNC5(canvas_item_add_animation_slice, RID, double, double, double, double)
  778. FUNC2(canvas_item_set_sort_children_by_y, RID, bool)
  779. FUNC2(canvas_item_set_z_index, RID, int)
  780. FUNC2(canvas_item_set_z_as_relative_to_parent, RID, bool)
  781. FUNC3(canvas_item_set_copy_to_backbuffer, RID, bool, const Rect2 &)
  782. FUNC2(canvas_item_attach_skeleton, RID, RID)
  783. FUNC1(canvas_item_clear, RID)
  784. FUNC2(canvas_item_set_draw_index, RID, int)
  785. FUNC2(canvas_item_set_material, RID, RID)
  786. FUNC3(canvas_item_set_instance_shader_parameter, RID, const StringName &, const Variant &)
  787. FUNC2RC(Variant, canvas_item_get_instance_shader_parameter, RID, const StringName &)
  788. FUNC2RC(Variant, canvas_item_get_instance_shader_parameter_default_value, RID, const StringName &)
  789. FUNC2C(canvas_item_get_instance_shader_parameter_list, RID, List<PropertyInfo> *)
  790. FUNC2(canvas_item_set_use_parent_material, RID, bool)
  791. FUNC5(canvas_item_set_visibility_notifier, RID, bool, const Rect2 &, const Callable &, const Callable &)
  792. FUNC6(canvas_item_set_canvas_group_mode, RID, CanvasGroupMode, float, bool, float, bool)
  793. FUNC1(canvas_item_set_debug_redraw, bool)
  794. FUNC0RC(bool, canvas_item_get_debug_redraw)
  795. FUNC2(canvas_item_set_interpolated, RID, bool)
  796. FUNC1(canvas_item_reset_physics_interpolation, RID)
  797. FUNC2(canvas_item_transform_physics_interpolation, RID, const Transform2D &)
  798. FUNCRIDSPLIT(canvas_light)
  799. FUNC2(canvas_light_set_mode, RID, CanvasLightMode)
  800. FUNC2(canvas_light_attach_to_canvas, RID, RID)
  801. FUNC2(canvas_light_set_enabled, RID, bool)
  802. FUNC2(canvas_light_set_texture_scale, RID, float)
  803. FUNC2(canvas_light_set_transform, RID, const Transform2D &)
  804. FUNC2(canvas_light_set_texture, RID, RID)
  805. FUNC2(canvas_light_set_texture_offset, RID, const Vector2 &)
  806. FUNC2(canvas_light_set_color, RID, const Color &)
  807. FUNC2(canvas_light_set_height, RID, float)
  808. FUNC2(canvas_light_set_energy, RID, float)
  809. FUNC3(canvas_light_set_z_range, RID, int, int)
  810. FUNC3(canvas_light_set_layer_range, RID, int, int)
  811. FUNC2(canvas_light_set_item_cull_mask, RID, int)
  812. FUNC2(canvas_light_set_item_shadow_cull_mask, RID, int)
  813. FUNC2(canvas_light_set_directional_distance, RID, float)
  814. FUNC2(canvas_light_set_blend_mode, RID, CanvasLightBlendMode)
  815. FUNC2(canvas_light_set_shadow_enabled, RID, bool)
  816. FUNC2(canvas_light_set_shadow_filter, RID, CanvasLightShadowFilter)
  817. FUNC2(canvas_light_set_shadow_color, RID, const Color &)
  818. FUNC2(canvas_light_set_shadow_smooth, RID, float)
  819. FUNC2(canvas_light_set_interpolated, RID, bool)
  820. FUNC1(canvas_light_reset_physics_interpolation, RID)
  821. FUNC2(canvas_light_transform_physics_interpolation, RID, const Transform2D &)
  822. FUNCRIDSPLIT(canvas_light_occluder)
  823. FUNC2(canvas_light_occluder_attach_to_canvas, RID, RID)
  824. FUNC2(canvas_light_occluder_set_enabled, RID, bool)
  825. FUNC2(canvas_light_occluder_set_polygon, RID, RID)
  826. FUNC2(canvas_light_occluder_set_as_sdf_collision, RID, bool)
  827. FUNC2(canvas_light_occluder_set_transform, RID, const Transform2D &)
  828. FUNC2(canvas_light_occluder_set_light_mask, RID, int)
  829. FUNC2(canvas_light_occluder_set_interpolated, RID, bool)
  830. FUNC1(canvas_light_occluder_reset_physics_interpolation, RID)
  831. FUNC2(canvas_light_occluder_transform_physics_interpolation, RID, const Transform2D &)
  832. FUNCRIDSPLIT(canvas_occluder_polygon)
  833. FUNC3(canvas_occluder_polygon_set_shape, RID, const Vector<Vector2> &, bool)
  834. FUNC2(canvas_occluder_polygon_set_cull_mode, RID, CanvasOccluderPolygonCullMode)
  835. FUNC1(canvas_set_shadow_texture_size, int)
  836. FUNC1R(Rect2, _debug_canvas_item_get_rect, RID)
  837. /* GLOBAL SHADER UNIFORMS */
  838. #undef server_name
  839. #undef ServerName
  840. //from now on, calls forwarded to this singleton
  841. #define ServerName RendererMaterialStorage
  842. #define server_name RSG::material_storage
  843. FUNC3(global_shader_parameter_add, const StringName &, GlobalShaderParameterType, const Variant &)
  844. FUNC1(global_shader_parameter_remove, const StringName &)
  845. FUNC0RC(Vector<StringName>, global_shader_parameter_get_list)
  846. FUNC2(global_shader_parameter_set, const StringName &, const Variant &)
  847. FUNC2(global_shader_parameter_set_override, const StringName &, const Variant &)
  848. FUNC1RC(GlobalShaderParameterType, global_shader_parameter_get_type, const StringName &)
  849. FUNC1RC(Variant, global_shader_parameter_get, const StringName &)
  850. FUNC1(global_shader_parameters_load_settings, bool)
  851. FUNC0(global_shader_parameters_clear)
  852. /* COMPOSITOR */
  853. #undef server_name
  854. #undef ServerName
  855. #define ServerName RendererCompositor
  856. #define server_name RSG::rasterizer
  857. FUNC4S(set_boot_image_with_stretch, const Ref<Image> &, const Color &, RenderingServer::SplashStretchMode, bool)
  858. /* STATUS INFORMATION */
  859. #undef server_name
  860. #undef ServerName
  861. /* UTILITIES */
  862. #define ServerName RendererUtilities
  863. #define server_name RSG::utilities
  864. FUNC0RC(String, get_video_adapter_name)
  865. FUNC0RC(String, get_video_adapter_vendor)
  866. FUNC0RC(String, get_video_adapter_api_version)
  867. #undef server_name
  868. #undef ServerName
  869. #undef WRITE_ACTION
  870. #undef SYNC_DEBUG
  871. #ifdef DEBUG_ENABLED
  872. #undef MAIN_THREAD_SYNC_WARN
  873. #endif
  874. virtual uint64_t get_rendering_info(RenderingInfo p_info) override;
  875. virtual RenderingDevice::DeviceType get_video_adapter_type() const override;
  876. virtual void set_frame_profiling_enabled(bool p_enable) override;
  877. virtual Vector<FrameProfileArea> get_frame_profile() override;
  878. virtual uint64_t get_frame_profile_frame() override;
  879. virtual RID get_test_cube() override;
  880. /* FREE */
  881. virtual void free_rid(RID p_rid) override {
  882. if (Thread::get_caller_id() == server_thread) {
  883. command_queue.flush_if_pending();
  884. _free(p_rid);
  885. } else {
  886. command_queue.push(this, &RenderingServerDefault::_free, p_rid);
  887. }
  888. }
  889. /* INTERPOLATION */
  890. virtual void set_physics_interpolation_enabled(bool p_enabled) override;
  891. /* EVENT QUEUING */
  892. virtual void request_frame_drawn_callback(const Callable &p_callable) override;
  893. virtual void draw(bool p_present, double frame_step) override;
  894. virtual void sync() override;
  895. virtual bool has_changed() const override;
  896. virtual void init() override;
  897. virtual void finish() override;
  898. virtual void tick() override;
  899. virtual void pre_draw(bool p_will_draw) override;
  900. virtual bool is_on_render_thread() override {
  901. return Thread::get_caller_id() == server_thread;
  902. }
  903. virtual void call_on_render_thread(const Callable &p_callable) override {
  904. if (Thread::get_caller_id() == server_thread) {
  905. command_queue.flush_if_pending();
  906. p_callable.call();
  907. } else {
  908. command_queue.push(this, &RenderingServerDefault::_call_on_render_thread, p_callable);
  909. }
  910. }
  911. /* TESTING */
  912. virtual double get_frame_setup_time_cpu() const override;
  913. virtual Color get_default_clear_color() override;
  914. virtual void set_default_clear_color(const Color &p_color) override;
  915. #ifndef DISABLE_DEPRECATED
  916. virtual bool has_feature(Features p_feature) const override;
  917. #endif
  918. virtual bool has_os_feature(const String &p_feature) const override;
  919. virtual void set_debug_generate_wireframes(bool p_generate) override;
  920. virtual bool is_low_end() const override;
  921. virtual void sdfgi_set_debug_probe_select(const Vector3 &p_position, const Vector3 &p_dir) override;
  922. virtual void set_print_gpu_profile(bool p_enable) override;
  923. virtual Size2i get_maximum_viewport_size() const override;
  924. RenderingServerDefault(bool p_create_thread = false);
  925. ~RenderingServerDefault();
  926. };