rendering_server_default.h 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009
  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. #ifndef RENDERING_SERVER_DEFAULT_H
  31. #define RENDERING_SERVER_DEFAULT_H
  32. #include "core/templates/command_queue_mt.h"
  33. #include "core/templates/hash_map.h"
  34. #include "renderer_canvas_cull.h"
  35. #include "renderer_scene_cull.h"
  36. #include "renderer_viewport.h"
  37. #include "rendering_server_globals.h"
  38. #include "servers/rendering/renderer_compositor.h"
  39. #include "servers/rendering_server.h"
  40. #include "servers/server_wrap_mt_common.h"
  41. class RenderingServerDefault : public RenderingServer {
  42. enum {
  43. MAX_INSTANCE_CULL = 8192,
  44. MAX_INSTANCE_LIGHTS = 4,
  45. LIGHT_CACHE_DIRTY = -1,
  46. MAX_LIGHTS_CULLED = 256,
  47. MAX_ROOM_CULL = 32,
  48. MAX_EXTERIOR_PORTALS = 128,
  49. MAX_LIGHT_SAMPLERS = 256,
  50. INSTANCE_ROOMLESS_MASK = (1 << 20)
  51. };
  52. static int changes;
  53. RID test_cube;
  54. List<Callable> frame_drawn_callbacks;
  55. static void _changes_changed() {}
  56. uint64_t frame_profile_frame;
  57. Vector<FrameProfileArea> frame_profile;
  58. double frame_setup_time = 0;
  59. //for printing
  60. bool print_gpu_profile = false;
  61. HashMap<String, float> print_gpu_profile_task_time;
  62. uint64_t print_frame_profile_ticks_from = 0;
  63. uint32_t print_frame_profile_frame_count = 0;
  64. mutable CommandQueueMT command_queue;
  65. static void _thread_callback(void *_instance);
  66. void _thread_loop();
  67. Thread::ID server_thread;
  68. SafeFlag exit;
  69. Thread thread;
  70. SafeFlag draw_thread_up;
  71. bool create_thread;
  72. void _thread_draw(bool p_swap_buffers, double frame_step);
  73. void _thread_flush();
  74. void _thread_exit();
  75. Mutex alloc_mutex;
  76. void _draw(bool p_swap_buffers, double frame_step);
  77. void _init();
  78. void _finish();
  79. void _free(RID p_rid);
  80. public:
  81. //if editor is redrawing when it shouldn't, enable this and put a breakpoint in _changes_changed()
  82. //#define DEBUG_CHANGES
  83. #ifdef DEBUG_CHANGES
  84. _FORCE_INLINE_ static void redraw_request() {
  85. changes++;
  86. _changes_changed();
  87. }
  88. #define DISPLAY_CHANGED \
  89. changes++; \
  90. _changes_changed();
  91. #else
  92. _FORCE_INLINE_ static void redraw_request() {
  93. changes++;
  94. }
  95. #endif
  96. #define WRITE_ACTION redraw_request();
  97. #ifdef DEBUG_SYNC
  98. #define SYNC_DEBUG print_line("sync on: " + String(__FUNCTION__));
  99. #else
  100. #define SYNC_DEBUG
  101. #endif
  102. #include "servers/server_wrap_mt_common.h"
  103. /* TEXTURE API */
  104. #define ServerName RendererTextureStorage
  105. #define server_name RSG::texture_storage
  106. #define FUNCRIDTEX0(m_type) \
  107. virtual RID m_type##_create() override { \
  108. RID ret = RSG::texture_storage->texture_allocate(); \
  109. if (Thread::get_caller_id() == server_thread || RSG::texture_storage->can_create_resources_async()) { \
  110. RSG::texture_storage->m_type##_initialize(ret); \
  111. } else { \
  112. command_queue.push(RSG::texture_storage, &RendererTextureStorage::m_type##_initialize, ret); \
  113. } \
  114. return ret; \
  115. }
  116. #define FUNCRIDTEX1(m_type, m_type1) \
  117. virtual RID m_type##_create(m_type1 p1) override { \
  118. RID ret = RSG::texture_storage->texture_allocate(); \
  119. if (Thread::get_caller_id() == server_thread || RSG::texture_storage->can_create_resources_async()) { \
  120. RSG::texture_storage->m_type##_initialize(ret, p1); \
  121. } else { \
  122. command_queue.push(RSG::texture_storage, &RendererTextureStorage::m_type##_initialize, ret, p1); \
  123. } \
  124. return ret; \
  125. }
  126. #define FUNCRIDTEX2(m_type, m_type1, m_type2) \
  127. virtual RID m_type##_create(m_type1 p1, m_type2 p2) override { \
  128. RID ret = RSG::texture_storage->texture_allocate(); \
  129. if (Thread::get_caller_id() == server_thread || RSG::texture_storage->can_create_resources_async()) { \
  130. RSG::texture_storage->m_type##_initialize(ret, p1, p2); \
  131. } else { \
  132. command_queue.push(RSG::texture_storage, &RendererTextureStorage::m_type##_initialize, ret, p1, p2); \
  133. } \
  134. return ret; \
  135. }
  136. #define FUNCRIDTEX6(m_type, m_type1, m_type2, m_type3, m_type4, m_type5, m_type6) \
  137. virtual RID m_type##_create(m_type1 p1, m_type2 p2, m_type3 p3, m_type4 p4, m_type5 p5, m_type6 p6) override { \
  138. RID ret = RSG::texture_storage->texture_allocate(); \
  139. if (Thread::get_caller_id() == server_thread || RSG::texture_storage->can_create_resources_async()) { \
  140. RSG::texture_storage->m_type##_initialize(ret, p1, p2, p3, p4, p5, p6); \
  141. } else { \
  142. command_queue.push(RSG::texture_storage, &RendererTextureStorage::m_type##_initialize, ret, p1, p2, p3, p4, p5, p6); \
  143. } \
  144. return ret; \
  145. }
  146. //these go pass-through, as they can be called from any thread
  147. FUNCRIDTEX1(texture_2d, const Ref<Image> &)
  148. FUNCRIDTEX2(texture_2d_layered, const Vector<Ref<Image>> &, TextureLayeredType)
  149. FUNCRIDTEX6(texture_3d, Image::Format, int, int, int, bool, const Vector<Ref<Image>> &)
  150. FUNCRIDTEX1(texture_proxy, RID)
  151. //these go through command queue if they are in another thread
  152. FUNC3(texture_2d_update, RID, const Ref<Image> &, int)
  153. FUNC2(texture_3d_update, RID, const Vector<Ref<Image>> &)
  154. FUNC2(texture_proxy_update, RID, RID)
  155. //these also go pass-through
  156. FUNCRIDTEX0(texture_2d_placeholder)
  157. FUNCRIDTEX1(texture_2d_layered_placeholder, TextureLayeredType)
  158. FUNCRIDTEX0(texture_3d_placeholder)
  159. FUNC1RC(Ref<Image>, texture_2d_get, RID)
  160. FUNC2RC(Ref<Image>, texture_2d_layer_get, RID, int)
  161. FUNC1RC(Vector<Ref<Image>>, texture_3d_get, RID)
  162. FUNC2(texture_replace, RID, RID)
  163. FUNC3(texture_set_size_override, RID, int, int)
  164. // FIXME: Disabled during Vulkan refactoring, should be ported.
  165. #if 0
  166. FUNC2(texture_bind, RID, uint32_t)
  167. #endif
  168. FUNC3(texture_set_detect_3d_callback, RID, TextureDetectCallback, void *)
  169. FUNC3(texture_set_detect_normal_callback, RID, TextureDetectCallback, void *)
  170. FUNC3(texture_set_detect_roughness_callback, RID, TextureDetectRoughnessCallback, void *)
  171. FUNC2(texture_set_path, RID, const String &)
  172. FUNC1RC(String, texture_get_path, RID)
  173. FUNC1(texture_debug_usage, List<TextureInfo> *)
  174. FUNC2(texture_set_force_redraw_if_visible, RID, bool)
  175. FUNC2RC(RID, texture_get_rd_texture_rid, RID, bool)
  176. /* SHADER API */
  177. #undef ServerName
  178. #undef server_name
  179. #define ServerName RendererMaterialStorage
  180. #define server_name RSG::material_storage
  181. FUNCRIDSPLIT(shader)
  182. FUNC2(shader_set_code, RID, const String &)
  183. FUNC2(shader_set_path_hint, RID, const String &)
  184. FUNC1RC(String, shader_get_code, RID)
  185. FUNC2SC(get_shader_parameter_list, RID, List<PropertyInfo> *)
  186. FUNC4(shader_set_default_texture_parameter, RID, const StringName &, RID, int)
  187. FUNC3RC(RID, shader_get_default_texture_parameter, RID, const StringName &, int)
  188. FUNC2RC(Variant, shader_get_parameter_default, RID, const StringName &)
  189. FUNC1RC(ShaderNativeSourceCode, shader_get_native_source_code, RID)
  190. /* COMMON MATERIAL API */
  191. FUNCRIDSPLIT(material)
  192. FUNC2(material_set_shader, RID, RID)
  193. FUNC3(material_set_param, RID, const StringName &, const Variant &)
  194. FUNC2RC(Variant, material_get_param, RID, const StringName &)
  195. FUNC2(material_set_render_priority, RID, int)
  196. FUNC2(material_set_next_pass, RID, RID)
  197. /* MESH API */
  198. //from now on, calls forwarded to this singleton
  199. #undef ServerName
  200. #undef server_name
  201. #define ServerName RendererMeshStorage
  202. #define server_name RSG::mesh_storage
  203. virtual RID mesh_create_from_surfaces(const Vector<SurfaceData> &p_surfaces, int p_blend_shape_count = 0) override {
  204. RID mesh = RSG::mesh_storage->mesh_allocate();
  205. // TODO once we have RSG::mesh_storage, add can_create_resources_async and call here instead of texture_storage!!
  206. if (Thread::get_caller_id() == server_thread || RSG::texture_storage->can_create_resources_async()) {
  207. if (Thread::get_caller_id() == server_thread) {
  208. command_queue.flush_if_pending();
  209. }
  210. RSG::mesh_storage->mesh_initialize(mesh);
  211. RSG::mesh_storage->mesh_set_blend_shape_count(mesh, p_blend_shape_count);
  212. for (int i = 0; i < p_surfaces.size(); i++) {
  213. RSG::mesh_storage->mesh_add_surface(mesh, p_surfaces[i]);
  214. }
  215. } else {
  216. command_queue.push(RSG::mesh_storage, &RendererMeshStorage::mesh_initialize, mesh);
  217. command_queue.push(RSG::mesh_storage, &RendererMeshStorage::mesh_set_blend_shape_count, mesh, p_blend_shape_count);
  218. for (int i = 0; i < p_surfaces.size(); i++) {
  219. command_queue.push(RSG::mesh_storage, &RendererMeshStorage::mesh_add_surface, mesh, p_surfaces[i]);
  220. }
  221. }
  222. return mesh;
  223. }
  224. FUNC2(mesh_set_blend_shape_count, RID, int)
  225. FUNCRIDSPLIT(mesh)
  226. FUNC2(mesh_add_surface, RID, const SurfaceData &)
  227. FUNC1RC(int, mesh_get_blend_shape_count, RID)
  228. FUNC2(mesh_set_blend_shape_mode, RID, BlendShapeMode)
  229. FUNC1RC(BlendShapeMode, mesh_get_blend_shape_mode, RID)
  230. FUNC4(mesh_surface_update_vertex_region, RID, int, int, const Vector<uint8_t> &)
  231. FUNC4(mesh_surface_update_attribute_region, RID, int, int, const Vector<uint8_t> &)
  232. FUNC4(mesh_surface_update_skin_region, RID, int, int, const Vector<uint8_t> &)
  233. FUNC3(mesh_surface_set_material, RID, int, RID)
  234. FUNC2RC(RID, mesh_surface_get_material, RID, int)
  235. FUNC2RC(SurfaceData, mesh_get_surface, RID, int)
  236. FUNC1RC(int, mesh_get_surface_count, RID)
  237. FUNC2(mesh_set_custom_aabb, RID, const AABB &)
  238. FUNC1RC(AABB, mesh_get_custom_aabb, RID)
  239. FUNC2(mesh_set_shadow_mesh, RID, RID)
  240. FUNC1(mesh_clear, RID)
  241. /* MULTIMESH API */
  242. FUNCRIDSPLIT(multimesh)
  243. FUNC5(multimesh_allocate_data, RID, int, MultimeshTransformFormat, bool, bool)
  244. FUNC1RC(int, multimesh_get_instance_count, RID)
  245. FUNC2(multimesh_set_mesh, RID, RID)
  246. FUNC3(multimesh_instance_set_transform, RID, int, const Transform3D &)
  247. FUNC3(multimesh_instance_set_transform_2d, RID, int, const Transform2D &)
  248. FUNC3(multimesh_instance_set_color, RID, int, const Color &)
  249. FUNC3(multimesh_instance_set_custom_data, RID, int, const Color &)
  250. FUNC1RC(RID, multimesh_get_mesh, RID)
  251. FUNC1RC(AABB, multimesh_get_aabb, RID)
  252. FUNC2RC(Transform3D, multimesh_instance_get_transform, RID, int)
  253. FUNC2RC(Transform2D, multimesh_instance_get_transform_2d, RID, int)
  254. FUNC2RC(Color, multimesh_instance_get_color, RID, int)
  255. FUNC2RC(Color, multimesh_instance_get_custom_data, RID, int)
  256. FUNC2(multimesh_set_buffer, RID, const Vector<float> &)
  257. FUNC1RC(Vector<float>, multimesh_get_buffer, RID)
  258. FUNC2(multimesh_set_visible_instances, RID, int)
  259. FUNC1RC(int, multimesh_get_visible_instances, RID)
  260. /* SKELETON API */
  261. FUNCRIDSPLIT(skeleton)
  262. FUNC3(skeleton_allocate_data, RID, int, bool)
  263. FUNC1RC(int, skeleton_get_bone_count, RID)
  264. FUNC3(skeleton_bone_set_transform, RID, int, const Transform3D &)
  265. FUNC2RC(Transform3D, skeleton_bone_get_transform, RID, int)
  266. FUNC3(skeleton_bone_set_transform_2d, RID, int, const Transform2D &)
  267. FUNC2RC(Transform2D, skeleton_bone_get_transform_2d, RID, int)
  268. FUNC2(skeleton_set_base_transform_2d, RID, const Transform2D &)
  269. /* Light API */
  270. #undef ServerName
  271. #undef server_name
  272. #define ServerName RendererLightStorage
  273. #define server_name RSG::light_storage
  274. FUNCRIDSPLIT(directional_light)
  275. FUNCRIDSPLIT(omni_light)
  276. FUNCRIDSPLIT(spot_light)
  277. FUNC2(light_set_color, RID, const Color &)
  278. FUNC3(light_set_param, RID, LightParam, float)
  279. FUNC2(light_set_shadow, RID, bool)
  280. FUNC2(light_set_projector, RID, RID)
  281. FUNC2(light_set_negative, RID, bool)
  282. FUNC2(light_set_cull_mask, RID, uint32_t)
  283. FUNC5(light_set_distance_fade, RID, bool, float, float, float)
  284. FUNC2(light_set_reverse_cull_face_mode, RID, bool)
  285. FUNC2(light_set_bake_mode, RID, LightBakeMode)
  286. FUNC2(light_set_max_sdfgi_cascade, RID, uint32_t)
  287. FUNC2(light_omni_set_shadow_mode, RID, LightOmniShadowMode)
  288. FUNC2(light_directional_set_shadow_mode, RID, LightDirectionalShadowMode)
  289. FUNC2(light_directional_set_blend_splits, RID, bool)
  290. FUNC2(light_directional_set_sky_mode, RID, LightDirectionalSkyMode)
  291. /* PROBE API */
  292. FUNCRIDSPLIT(reflection_probe)
  293. FUNC2(reflection_probe_set_update_mode, RID, ReflectionProbeUpdateMode)
  294. FUNC2(reflection_probe_set_intensity, RID, float)
  295. FUNC2(reflection_probe_set_ambient_color, RID, const Color &)
  296. FUNC2(reflection_probe_set_ambient_energy, RID, float)
  297. FUNC2(reflection_probe_set_ambient_mode, RID, ReflectionProbeAmbientMode)
  298. FUNC2(reflection_probe_set_max_distance, RID, float)
  299. FUNC2(reflection_probe_set_extents, RID, const Vector3 &)
  300. FUNC2(reflection_probe_set_origin_offset, RID, const Vector3 &)
  301. FUNC2(reflection_probe_set_as_interior, RID, bool)
  302. FUNC2(reflection_probe_set_enable_box_projection, RID, bool)
  303. FUNC2(reflection_probe_set_enable_shadows, RID, bool)
  304. FUNC2(reflection_probe_set_cull_mask, RID, uint32_t)
  305. FUNC2(reflection_probe_set_resolution, RID, int)
  306. FUNC2(reflection_probe_set_mesh_lod_threshold, RID, float)
  307. /* LIGHTMAP */
  308. FUNCRIDSPLIT(lightmap)
  309. FUNC3(lightmap_set_textures, RID, RID, bool)
  310. FUNC2(lightmap_set_probe_bounds, RID, const AABB &)
  311. FUNC2(lightmap_set_probe_interior, RID, bool)
  312. FUNC5(lightmap_set_probe_capture_data, RID, const PackedVector3Array &, const PackedColorArray &, const PackedInt32Array &, const PackedInt32Array &)
  313. FUNC2(lightmap_set_baked_exposure_normalization, RID, float)
  314. FUNC1RC(PackedVector3Array, lightmap_get_probe_capture_points, RID)
  315. FUNC1RC(PackedColorArray, lightmap_get_probe_capture_sh, RID)
  316. FUNC1RC(PackedInt32Array, lightmap_get_probe_capture_tetrahedra, RID)
  317. FUNC1RC(PackedInt32Array, lightmap_get_probe_capture_bsp_tree, RID)
  318. FUNC1(lightmap_set_probe_capture_update_speed, float)
  319. /* Shadow Atlas */
  320. FUNC0R(RID, shadow_atlas_create)
  321. FUNC3(shadow_atlas_set_size, RID, int, bool)
  322. FUNC3(shadow_atlas_set_quadrant_subdivision, RID, int, int)
  323. FUNC2(directional_shadow_atlas_set_size, int, bool)
  324. /* DECAL API */
  325. #undef ServerName
  326. #undef server_name
  327. #define ServerName RendererTextureStorage
  328. #define server_name RSG::texture_storage
  329. FUNCRIDSPLIT(decal)
  330. FUNC2(decal_set_extents, RID, const Vector3 &)
  331. FUNC3(decal_set_texture, RID, DecalTexture, RID)
  332. FUNC2(decal_set_emission_energy, RID, float)
  333. FUNC2(decal_set_albedo_mix, RID, float)
  334. FUNC2(decal_set_modulate, RID, const Color &)
  335. FUNC2(decal_set_cull_mask, RID, uint32_t)
  336. FUNC4(decal_set_distance_fade, RID, bool, float, float)
  337. FUNC3(decal_set_fade, RID, float, float)
  338. FUNC2(decal_set_normal_fade, RID, float)
  339. /* BAKED LIGHT API */
  340. //from now on, calls forwarded to this singleton
  341. #undef ServerName
  342. #undef server_name
  343. #define ServerName RendererGI
  344. #define server_name RSG::gi
  345. FUNCRIDSPLIT(voxel_gi)
  346. 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> &)
  347. FUNC1RC(AABB, voxel_gi_get_bounds, RID)
  348. FUNC1RC(Vector3i, voxel_gi_get_octree_size, RID)
  349. FUNC1RC(Vector<uint8_t>, voxel_gi_get_octree_cells, RID)
  350. FUNC1RC(Vector<uint8_t>, voxel_gi_get_data_cells, RID)
  351. FUNC1RC(Vector<uint8_t>, voxel_gi_get_distance_field, RID)
  352. FUNC1RC(Vector<int>, voxel_gi_get_level_counts, RID)
  353. FUNC1RC(Transform3D, voxel_gi_get_to_cell_xform, RID)
  354. FUNC2(voxel_gi_set_dynamic_range, RID, float)
  355. FUNC2(voxel_gi_set_propagation, RID, float)
  356. FUNC2(voxel_gi_set_energy, RID, float)
  357. FUNC2(voxel_gi_set_baked_exposure_normalization, RID, float)
  358. FUNC2(voxel_gi_set_bias, RID, float)
  359. FUNC2(voxel_gi_set_normal_bias, RID, float)
  360. FUNC2(voxel_gi_set_interior, RID, bool)
  361. FUNC2(voxel_gi_set_use_two_bounces, RID, bool)
  362. /* PARTICLES */
  363. #undef ServerName
  364. #undef server_name
  365. #define ServerName RendererParticlesStorage
  366. #define server_name RSG::particles_storage
  367. FUNCRIDSPLIT(particles)
  368. FUNC2(particles_set_mode, RID, ParticlesMode)
  369. FUNC2(particles_set_emitting, RID, bool)
  370. FUNC1R(bool, particles_get_emitting, RID)
  371. FUNC2(particles_set_amount, RID, int)
  372. FUNC2(particles_set_lifetime, RID, double)
  373. FUNC2(particles_set_one_shot, RID, bool)
  374. FUNC2(particles_set_pre_process_time, RID, double)
  375. FUNC2(particles_set_explosiveness_ratio, RID, float)
  376. FUNC2(particles_set_randomness_ratio, RID, float)
  377. FUNC2(particles_set_custom_aabb, RID, const AABB &)
  378. FUNC2(particles_set_speed_scale, RID, double)
  379. FUNC2(particles_set_use_local_coordinates, RID, bool)
  380. FUNC2(particles_set_process_material, RID, RID)
  381. FUNC2(particles_set_fixed_fps, RID, int)
  382. FUNC2(particles_set_interpolate, RID, bool)
  383. FUNC2(particles_set_fractional_delta, RID, bool)
  384. FUNC1R(bool, particles_is_inactive, RID)
  385. FUNC3(particles_set_trails, RID, bool, float)
  386. FUNC2(particles_set_trail_bind_poses, RID, const Vector<Transform3D> &)
  387. FUNC1(particles_request_process, RID)
  388. FUNC1(particles_restart, RID)
  389. FUNC6(particles_emit, RID, const Transform3D &, const Vector3 &, const Color &, const Color &, uint32_t)
  390. FUNC2(particles_set_subemitter, RID, RID)
  391. FUNC2(particles_set_collision_base_size, RID, float)
  392. FUNC2(particles_set_transform_align, RID, RS::ParticlesTransformAlign)
  393. FUNC2(particles_set_draw_order, RID, RS::ParticlesDrawOrder)
  394. FUNC2(particles_set_draw_passes, RID, int)
  395. FUNC3(particles_set_draw_pass_mesh, RID, int, RID)
  396. FUNC1R(AABB, particles_get_current_aabb, RID)
  397. FUNC2(particles_set_emission_transform, RID, const Transform3D &)
  398. /* PARTICLES COLLISION */
  399. FUNCRIDSPLIT(particles_collision)
  400. FUNC2(particles_collision_set_collision_type, RID, ParticlesCollisionType)
  401. FUNC2(particles_collision_set_cull_mask, RID, uint32_t)
  402. FUNC2(particles_collision_set_sphere_radius, RID, real_t)
  403. FUNC2(particles_collision_set_box_extents, RID, const Vector3 &)
  404. FUNC2(particles_collision_set_attractor_strength, RID, real_t)
  405. FUNC2(particles_collision_set_attractor_directionality, RID, real_t)
  406. FUNC2(particles_collision_set_attractor_attenuation, RID, real_t)
  407. FUNC2(particles_collision_set_field_texture, RID, RID)
  408. FUNC1(particles_collision_height_field_update, RID)
  409. FUNC2(particles_collision_set_height_field_resolution, RID, ParticlesCollisionHeightfieldResolution)
  410. /* FOG VOLUME */
  411. #undef ServerName
  412. #undef server_name
  413. #define ServerName RendererFog
  414. #define server_name RSG::fog
  415. FUNCRIDSPLIT(fog_volume)
  416. FUNC2(fog_volume_set_shape, RID, FogVolumeShape)
  417. FUNC2(fog_volume_set_extents, RID, const Vector3 &)
  418. FUNC2(fog_volume_set_material, RID, RID)
  419. /* VISIBILITY_NOTIFIER */
  420. #undef ServerName
  421. #undef server_name
  422. #define ServerName RendererUtilities
  423. #define server_name RSG::utilities
  424. FUNCRIDSPLIT(visibility_notifier)
  425. FUNC2(visibility_notifier_set_aabb, RID, const AABB &)
  426. FUNC3(visibility_notifier_set_callbacks, RID, const Callable &, const Callable &)
  427. #undef server_name
  428. #undef ServerName
  429. //from now on, calls forwarded to this singleton
  430. #define ServerName RenderingMethod
  431. #define server_name RSG::scene
  432. /* CAMERA API */
  433. FUNCRIDSPLIT(camera)
  434. FUNC4(camera_set_perspective, RID, float, float, float)
  435. FUNC4(camera_set_orthogonal, RID, float, float, float)
  436. FUNC5(camera_set_frustum, RID, float, Vector2, float, float)
  437. FUNC2(camera_set_transform, RID, const Transform3D &)
  438. FUNC2(camera_set_cull_mask, RID, uint32_t)
  439. FUNC2(camera_set_environment, RID, RID)
  440. FUNC2(camera_set_camera_attributes, RID, RID)
  441. FUNC2(camera_set_use_vertical_aspect, RID, bool)
  442. /* OCCLUDER */
  443. FUNCRIDSPLIT(occluder)
  444. FUNC3(occluder_set_mesh, RID, const PackedVector3Array &, const PackedInt32Array &)
  445. #undef server_name
  446. #undef ServerName
  447. //from now on, calls forwarded to this singleton
  448. #define ServerName RendererViewport
  449. #define server_name RSG::viewport
  450. /* VIEWPORT TARGET API */
  451. FUNCRIDSPLIT(viewport)
  452. FUNC2(viewport_set_use_xr, RID, bool)
  453. FUNC3(viewport_set_size, RID, int, int)
  454. FUNC2(viewport_set_active, RID, bool)
  455. FUNC2(viewport_set_parent_viewport, RID, RID)
  456. FUNC2(viewport_set_clear_mode, RID, ViewportClearMode)
  457. FUNC3(viewport_attach_to_screen, RID, const Rect2 &, int)
  458. FUNC2(viewport_set_render_direct_to_screen, RID, bool)
  459. FUNC2(viewport_set_scaling_3d_mode, RID, ViewportScaling3DMode)
  460. FUNC2(viewport_set_scaling_3d_scale, RID, float)
  461. FUNC2(viewport_set_fsr_sharpness, RID, float)
  462. FUNC2(viewport_set_texture_mipmap_bias, RID, float)
  463. FUNC2(viewport_set_update_mode, RID, ViewportUpdateMode)
  464. FUNC1RC(RID, viewport_get_texture, RID)
  465. FUNC2(viewport_set_disable_2d, RID, bool)
  466. FUNC2(viewport_set_disable_environment, RID, bool)
  467. FUNC2(viewport_set_disable_3d, RID, bool)
  468. FUNC2(viewport_set_canvas_cull_mask, RID, uint32_t)
  469. FUNC2(viewport_attach_camera, RID, RID)
  470. FUNC2(viewport_set_scenario, RID, RID)
  471. FUNC2(viewport_attach_canvas, RID, RID)
  472. FUNC2(viewport_remove_canvas, RID, RID)
  473. FUNC3(viewport_set_canvas_transform, RID, RID, const Transform2D &)
  474. FUNC2(viewport_set_transparent_background, RID, bool)
  475. FUNC2(viewport_set_snap_2d_transforms_to_pixel, RID, bool)
  476. FUNC2(viewport_set_snap_2d_vertices_to_pixel, RID, bool)
  477. FUNC2(viewport_set_default_canvas_item_texture_filter, RID, CanvasItemTextureFilter)
  478. FUNC2(viewport_set_default_canvas_item_texture_repeat, RID, CanvasItemTextureRepeat)
  479. FUNC2(viewport_set_global_canvas_transform, RID, const Transform2D &)
  480. FUNC4(viewport_set_canvas_stacking, RID, RID, int, int)
  481. FUNC3(viewport_set_positional_shadow_atlas_size, RID, int, bool)
  482. FUNC3(viewport_set_sdf_oversize_and_scale, RID, ViewportSDFOversize, ViewportSDFScale)
  483. FUNC3(viewport_set_positional_shadow_atlas_quadrant_subdivision, RID, int, int)
  484. FUNC2(viewport_set_msaa_2d, RID, ViewportMSAA)
  485. FUNC2(viewport_set_msaa_3d, RID, ViewportMSAA)
  486. FUNC2(viewport_set_screen_space_aa, RID, ViewportScreenSpaceAA)
  487. FUNC2(viewport_set_use_taa, RID, bool)
  488. FUNC2(viewport_set_use_debanding, RID, bool)
  489. FUNC2(viewport_set_use_occlusion_culling, RID, bool)
  490. FUNC1(viewport_set_occlusion_rays_per_thread, int)
  491. FUNC1(viewport_set_occlusion_culling_build_quality, ViewportOcclusionCullingBuildQuality)
  492. FUNC2(viewport_set_mesh_lod_threshold, RID, float)
  493. FUNC3R(int, viewport_get_render_info, RID, ViewportRenderInfoType, ViewportRenderInfo)
  494. FUNC2(viewport_set_debug_draw, RID, ViewportDebugDraw)
  495. FUNC2(viewport_set_measure_render_time, RID, bool)
  496. FUNC1RC(double, viewport_get_measured_render_time_cpu, RID)
  497. FUNC1RC(double, viewport_get_measured_render_time_gpu, RID)
  498. FUNC1RC(RID, viewport_find_from_screen_attachment, DisplayServer::WindowID)
  499. FUNC2(call_set_vsync_mode, DisplayServer::VSyncMode, DisplayServer::WindowID)
  500. FUNC2(viewport_set_vrs_mode, RID, ViewportVRSMode)
  501. FUNC2(viewport_set_vrs_texture, RID, RID)
  502. /* ENVIRONMENT API */
  503. #undef server_name
  504. #undef ServerName
  505. //from now on, calls forwarded to this singleton
  506. #define ServerName RenderingMethod
  507. #define server_name RSG::scene
  508. FUNC1(voxel_gi_set_quality, VoxelGIQuality)
  509. /* SKY API */
  510. FUNCRIDSPLIT(sky)
  511. FUNC2(sky_set_radiance_size, RID, int)
  512. FUNC2(sky_set_mode, RID, SkyMode)
  513. FUNC2(sky_set_material, RID, RID)
  514. FUNC4R(Ref<Image>, sky_bake_panorama, RID, float, bool, const Size2i &)
  515. FUNCRIDSPLIT(environment)
  516. FUNC2(environment_set_background, RID, EnvironmentBG)
  517. FUNC2(environment_set_sky, RID, RID)
  518. FUNC2(environment_set_sky_custom_fov, RID, float)
  519. FUNC2(environment_set_sky_orientation, RID, const Basis &)
  520. FUNC2(environment_set_bg_color, RID, const Color &)
  521. FUNC3(environment_set_bg_energy, RID, float, float)
  522. FUNC2(environment_set_canvas_max_layer, RID, int)
  523. FUNC6(environment_set_ambient_light, RID, const Color &, EnvironmentAmbientSource, float, float, EnvironmentReflectionSource)
  524. // FIXME: Disabled during Vulkan refactoring, should be ported.
  525. #if 0
  526. FUNC2(environment_set_camera_feed_id, RID, int)
  527. #endif
  528. FUNC6(environment_set_ssr, RID, bool, int, float, float, float)
  529. FUNC1(environment_set_ssr_roughness_quality, EnvironmentSSRRoughnessQuality)
  530. FUNC10(environment_set_ssao, RID, bool, float, float, float, float, float, float, float, float)
  531. FUNC6(environment_set_ssao_quality, EnvironmentSSAOQuality, bool, float, int, float, float)
  532. FUNC6(environment_set_ssil, RID, bool, float, float, float, float)
  533. FUNC6(environment_set_ssil_quality, EnvironmentSSILQuality, bool, float, int, float, float)
  534. FUNC13(environment_set_glow, RID, bool, Vector<float>, float, float, float, float, EnvironmentGlowBlendMode, float, float, float, float, RID)
  535. FUNC1(environment_glow_set_use_bicubic_upscale, bool)
  536. FUNC4(environment_set_tonemap, RID, EnvironmentToneMapper, float, float)
  537. FUNC7(environment_set_adjustment, RID, bool, float, float, float, bool, RID)
  538. FUNC10(environment_set_fog, RID, bool, const Color &, float, float, float, float, float, float, float)
  539. FUNC14(environment_set_volumetric_fog, RID, bool, float, const Color &, const Color &, float, float, float, float, float, bool, float, float, float)
  540. FUNC2(environment_set_volumetric_fog_volume_size, int, int)
  541. FUNC1(environment_set_volumetric_fog_filter_active, bool)
  542. FUNC11(environment_set_sdfgi, RID, bool, int, float, EnvironmentSDFGIYScale, bool, float, bool, float, float, float)
  543. FUNC1(environment_set_sdfgi_ray_count, EnvironmentSDFGIRayCount)
  544. FUNC1(environment_set_sdfgi_frames_to_converge, EnvironmentSDFGIFramesToConverge)
  545. FUNC1(environment_set_sdfgi_frames_to_update_light, EnvironmentSDFGIFramesToUpdateLight)
  546. FUNC3R(Ref<Image>, environment_bake_panorama, RID, bool, const Size2i &)
  547. FUNC3(screen_space_roughness_limiter_set_active, bool, float, float)
  548. FUNC1(sub_surface_scattering_set_quality, SubSurfaceScatteringQuality)
  549. FUNC2(sub_surface_scattering_set_scale, float, float)
  550. FUNC1(positional_soft_shadow_filter_set_quality, ShadowQuality);
  551. FUNC1(directional_soft_shadow_filter_set_quality, ShadowQuality);
  552. FUNC1(decals_set_filter, RS::DecalFilter);
  553. FUNC1(light_projectors_set_filter, RS::LightProjectorFilter);
  554. /* CAMERA ATTRIBUTES */
  555. #undef server_name
  556. #undef ServerName
  557. //from now on, calls forwarded to this singleton
  558. #define ServerName RendererCameraAttributes
  559. #define server_name RSG::camera_attributes
  560. FUNCRIDSPLIT(camera_attributes)
  561. FUNC2(camera_attributes_set_dof_blur_quality, DOFBlurQuality, bool)
  562. FUNC1(camera_attributes_set_dof_blur_bokeh_shape, DOFBokehShape)
  563. FUNC8(camera_attributes_set_dof_blur, RID, bool, float, float, bool, float, float, float)
  564. FUNC3(camera_attributes_set_exposure, RID, float, float)
  565. FUNC6(camera_attributes_set_auto_exposure, RID, bool, float, float, float, float)
  566. /* SCENARIO API */
  567. #undef server_name
  568. #undef ServerName
  569. #define ServerName RenderingMethod
  570. #define server_name RSG::scene
  571. FUNCRIDSPLIT(scenario)
  572. FUNC2(scenario_set_environment, RID, RID)
  573. FUNC2(scenario_set_camera_attributes, RID, RID)
  574. FUNC2(scenario_set_fallback_environment, RID, RID)
  575. /* INSTANCING API */
  576. FUNCRIDSPLIT(instance)
  577. FUNC2(instance_set_base, RID, RID)
  578. FUNC2(instance_set_scenario, RID, RID)
  579. FUNC2(instance_set_layer_mask, RID, uint32_t)
  580. FUNC3(instance_set_pivot_data, RID, float, bool)
  581. FUNC2(instance_set_transform, RID, const Transform3D &)
  582. FUNC2(instance_attach_object_instance_id, RID, ObjectID)
  583. FUNC3(instance_set_blend_shape_weight, RID, int, float)
  584. FUNC3(instance_set_surface_override_material, RID, int, RID)
  585. FUNC2(instance_set_visible, RID, bool)
  586. FUNC2(instance_set_custom_aabb, RID, AABB)
  587. FUNC2(instance_attach_skeleton, RID, RID)
  588. FUNC2(instance_set_extra_visibility_margin, RID, real_t)
  589. FUNC2(instance_set_visibility_parent, RID, RID)
  590. FUNC2(instance_set_ignore_culling, RID, bool)
  591. // don't use these in a game!
  592. FUNC2RC(Vector<ObjectID>, instances_cull_aabb, const AABB &, RID)
  593. FUNC3RC(Vector<ObjectID>, instances_cull_ray, const Vector3 &, const Vector3 &, RID)
  594. FUNC2RC(Vector<ObjectID>, instances_cull_convex, const Vector<Plane> &, RID)
  595. FUNC3(instance_geometry_set_flag, RID, InstanceFlags, bool)
  596. FUNC2(instance_geometry_set_cast_shadows_setting, RID, ShadowCastingSetting)
  597. FUNC2(instance_geometry_set_material_override, RID, RID)
  598. FUNC2(instance_geometry_set_material_overlay, RID, RID)
  599. FUNC6(instance_geometry_set_visibility_range, RID, float, float, float, float, VisibilityRangeFadeMode)
  600. FUNC4(instance_geometry_set_lightmap, RID, RID, const Rect2 &, int)
  601. FUNC2(instance_geometry_set_lod_bias, RID, float)
  602. FUNC2(instance_geometry_set_transparency, RID, float)
  603. FUNC3(instance_geometry_set_shader_parameter, RID, const StringName &, const Variant &)
  604. FUNC2RC(Variant, instance_geometry_get_shader_parameter, RID, const StringName &)
  605. FUNC2RC(Variant, instance_geometry_get_shader_parameter_default_value, RID, const StringName &)
  606. FUNC2C(instance_geometry_get_shader_parameter_list, RID, List<PropertyInfo> *)
  607. FUNC3R(TypedArray<Image>, bake_render_uv2, RID, const TypedArray<RID> &, const Size2i &)
  608. FUNC1(gi_set_use_half_resolution, bool)
  609. #undef server_name
  610. #undef ServerName
  611. //from now on, calls forwarded to this singleton
  612. #define ServerName RendererCanvasCull
  613. #define server_name RSG::canvas
  614. /* CANVAS (2D) */
  615. FUNCRIDSPLIT(canvas)
  616. FUNC3(canvas_set_item_mirroring, RID, RID, const Point2 &)
  617. FUNC2(canvas_set_modulate, RID, const Color &)
  618. FUNC3(canvas_set_parent, RID, RID, float)
  619. FUNC1(canvas_set_disable_scale, bool)
  620. FUNCRIDSPLIT(canvas_texture)
  621. FUNC3(canvas_texture_set_channel, RID, CanvasTextureChannel, RID)
  622. FUNC3(canvas_texture_set_shading_parameters, RID, const Color &, float)
  623. FUNC2(canvas_texture_set_texture_filter, RID, CanvasItemTextureFilter)
  624. FUNC2(canvas_texture_set_texture_repeat, RID, CanvasItemTextureRepeat)
  625. FUNCRIDSPLIT(canvas_item)
  626. FUNC2(canvas_item_set_parent, RID, RID)
  627. FUNC2(canvas_item_set_default_texture_filter, RID, CanvasItemTextureFilter)
  628. FUNC2(canvas_item_set_default_texture_repeat, RID, CanvasItemTextureRepeat)
  629. FUNC2(canvas_item_set_visible, RID, bool)
  630. FUNC2(canvas_item_set_light_mask, RID, int)
  631. FUNC2(canvas_item_set_visibility_layer, RID, uint32_t)
  632. FUNC2(canvas_item_set_update_when_visible, RID, bool)
  633. FUNC2(canvas_item_set_transform, RID, const Transform2D &)
  634. FUNC2(canvas_item_set_clip, RID, bool)
  635. FUNC2(canvas_item_set_distance_field_mode, RID, bool)
  636. FUNC3(canvas_item_set_custom_rect, RID, bool, const Rect2 &)
  637. FUNC2(canvas_item_set_modulate, RID, const Color &)
  638. FUNC2(canvas_item_set_self_modulate, RID, const Color &)
  639. FUNC2(canvas_item_set_draw_behind_parent, RID, bool)
  640. FUNC6(canvas_item_add_line, RID, const Point2 &, const Point2 &, const Color &, float, bool)
  641. FUNC5(canvas_item_add_polyline, RID, const Vector<Point2> &, const Vector<Color> &, float, bool)
  642. FUNC4(canvas_item_add_multiline, RID, const Vector<Point2> &, const Vector<Color> &, float)
  643. FUNC3(canvas_item_add_rect, RID, const Rect2 &, const Color &)
  644. FUNC4(canvas_item_add_circle, RID, const Point2 &, float, const Color &)
  645. FUNC6(canvas_item_add_texture_rect, RID, const Rect2 &, RID, bool, const Color &, bool)
  646. FUNC7(canvas_item_add_texture_rect_region, RID, const Rect2 &, RID, const Rect2 &, const Color &, bool, bool)
  647. FUNC8(canvas_item_add_msdf_texture_rect_region, RID, const Rect2 &, RID, const Rect2 &, const Color &, int, float, float)
  648. FUNC5(canvas_item_add_lcd_texture_rect_region, RID, const Rect2 &, RID, const Rect2 &, const Color &)
  649. FUNC10(canvas_item_add_nine_patch, RID, const Rect2 &, const Rect2 &, RID, const Vector2 &, const Vector2 &, NinePatchAxisMode, NinePatchAxisMode, bool, const Color &)
  650. FUNC6(canvas_item_add_primitive, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, float)
  651. FUNC5(canvas_item_add_polygon, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID)
  652. 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)
  653. FUNC5(canvas_item_add_mesh, RID, const RID &, const Transform2D &, const Color &, RID)
  654. FUNC3(canvas_item_add_multimesh, RID, RID, RID)
  655. FUNC3(canvas_item_add_particles, RID, RID, RID)
  656. FUNC2(canvas_item_add_set_transform, RID, const Transform2D &)
  657. FUNC2(canvas_item_add_clip_ignore, RID, bool)
  658. FUNC5(canvas_item_add_animation_slice, RID, double, double, double, double)
  659. FUNC2(canvas_item_set_sort_children_by_y, RID, bool)
  660. FUNC2(canvas_item_set_z_index, RID, int)
  661. FUNC2(canvas_item_set_z_as_relative_to_parent, RID, bool)
  662. FUNC3(canvas_item_set_copy_to_backbuffer, RID, bool, const Rect2 &)
  663. FUNC2(canvas_item_attach_skeleton, RID, RID)
  664. FUNC1(canvas_item_clear, RID)
  665. FUNC2(canvas_item_set_draw_index, RID, int)
  666. FUNC2(canvas_item_set_material, RID, RID)
  667. FUNC2(canvas_item_set_use_parent_material, RID, bool)
  668. FUNC5(canvas_item_set_visibility_notifier, RID, bool, const Rect2 &, const Callable &, const Callable &)
  669. FUNC6(canvas_item_set_canvas_group_mode, RID, CanvasGroupMode, float, bool, float, bool)
  670. FUNCRIDSPLIT(canvas_light)
  671. FUNC2(canvas_light_set_mode, RID, CanvasLightMode)
  672. FUNC2(canvas_light_attach_to_canvas, RID, RID)
  673. FUNC2(canvas_light_set_enabled, RID, bool)
  674. FUNC2(canvas_light_set_texture_scale, RID, float)
  675. FUNC2(canvas_light_set_transform, RID, const Transform2D &)
  676. FUNC2(canvas_light_set_texture, RID, RID)
  677. FUNC2(canvas_light_set_texture_offset, RID, const Vector2 &)
  678. FUNC2(canvas_light_set_color, RID, const Color &)
  679. FUNC2(canvas_light_set_height, RID, float)
  680. FUNC2(canvas_light_set_energy, RID, float)
  681. FUNC3(canvas_light_set_z_range, RID, int, int)
  682. FUNC3(canvas_light_set_layer_range, RID, int, int)
  683. FUNC2(canvas_light_set_item_cull_mask, RID, int)
  684. FUNC2(canvas_light_set_item_shadow_cull_mask, RID, int)
  685. FUNC2(canvas_light_set_directional_distance, RID, float)
  686. FUNC2(canvas_light_set_blend_mode, RID, CanvasLightBlendMode)
  687. FUNC2(canvas_light_set_shadow_enabled, RID, bool)
  688. FUNC2(canvas_light_set_shadow_filter, RID, CanvasLightShadowFilter)
  689. FUNC2(canvas_light_set_shadow_color, RID, const Color &)
  690. FUNC2(canvas_light_set_shadow_smooth, RID, float)
  691. FUNCRIDSPLIT(canvas_light_occluder)
  692. FUNC2(canvas_light_occluder_attach_to_canvas, RID, RID)
  693. FUNC2(canvas_light_occluder_set_enabled, RID, bool)
  694. FUNC2(canvas_light_occluder_set_polygon, RID, RID)
  695. FUNC2(canvas_light_occluder_set_as_sdf_collision, RID, bool)
  696. FUNC2(canvas_light_occluder_set_transform, RID, const Transform2D &)
  697. FUNC2(canvas_light_occluder_set_light_mask, RID, int)
  698. FUNCRIDSPLIT(canvas_occluder_polygon)
  699. FUNC3(canvas_occluder_polygon_set_shape, RID, const Vector<Vector2> &, bool)
  700. FUNC2(canvas_occluder_polygon_set_cull_mode, RID, CanvasOccluderPolygonCullMode)
  701. FUNC1(canvas_set_shadow_texture_size, int)
  702. /* GLOBAL SHADER UNIFORMS */
  703. #undef server_name
  704. #undef ServerName
  705. //from now on, calls forwarded to this singleton
  706. #define ServerName RendererMaterialStorage
  707. #define server_name RSG::material_storage
  708. FUNC3(global_shader_parameter_add, const StringName &, GlobalShaderParameterType, const Variant &)
  709. FUNC1(global_shader_parameter_remove, const StringName &)
  710. FUNC0RC(Vector<StringName>, global_shader_parameter_get_list)
  711. FUNC2(global_shader_parameter_set, const StringName &, const Variant &)
  712. FUNC2(global_shader_parameter_set_override, const StringName &, const Variant &)
  713. FUNC1RC(GlobalShaderParameterType, global_shader_parameter_get_type, const StringName &)
  714. FUNC1RC(Variant, global_shader_parameter_get, const StringName &)
  715. FUNC1(global_shader_parameters_load_settings, bool)
  716. FUNC0(global_shader_parameters_clear)
  717. #undef server_name
  718. #undef ServerName
  719. #undef WRITE_ACTION
  720. #undef SYNC_DEBUG
  721. /* FREE */
  722. virtual void free(RID p_rid) override {
  723. if (Thread::get_caller_id() == server_thread) {
  724. command_queue.flush_if_pending();
  725. _free(p_rid);
  726. } else {
  727. command_queue.push(this, &RenderingServerDefault::_free, p_rid);
  728. }
  729. }
  730. /* EVENT QUEUING */
  731. virtual void request_frame_drawn_callback(const Callable &p_callable) override;
  732. virtual void draw(bool p_swap_buffers, double frame_step) override;
  733. virtual void sync() override;
  734. virtual bool has_changed() const override;
  735. virtual void init() override;
  736. virtual void finish() override;
  737. /* STATUS INFORMATION */
  738. virtual uint64_t get_rendering_info(RenderingInfo p_info) override;
  739. virtual String get_video_adapter_name() const override;
  740. virtual String get_video_adapter_vendor() const override;
  741. virtual RenderingDevice::DeviceType get_video_adapter_type() const override;
  742. virtual String get_video_adapter_api_version() const override;
  743. virtual void set_frame_profiling_enabled(bool p_enable) override;
  744. virtual Vector<FrameProfileArea> get_frame_profile() override;
  745. virtual uint64_t get_frame_profile_frame() override;
  746. virtual RID get_test_cube() override;
  747. /* TESTING */
  748. virtual double get_frame_setup_time_cpu() const override;
  749. virtual void set_boot_image(const Ref<Image> &p_image, const Color &p_color, bool p_scale, bool p_use_filter = true) override;
  750. virtual Color get_default_clear_color() override;
  751. virtual void set_default_clear_color(const Color &p_color) override;
  752. virtual bool has_feature(Features p_feature) const override;
  753. virtual bool has_os_feature(const String &p_feature) const override;
  754. virtual void set_debug_generate_wireframes(bool p_generate) override;
  755. virtual bool is_low_end() const override;
  756. virtual void sdfgi_set_debug_probe_select(const Vector3 &p_position, const Vector3 &p_dir) override;
  757. virtual void set_print_gpu_profile(bool p_enable) override;
  758. virtual Size2i get_maximum_viewport_size() const override;
  759. RenderingServerDefault(bool p_create_thread = false);
  760. ~RenderingServerDefault();
  761. };
  762. #endif // RENDERING_SERVER_DEFAULT_H