rendering_server_wrap_mt.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693
  1. /*************************************************************************/
  2. /* rendering_server_wrap_mt.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
  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_WRAP_MT_H
  31. #define RENDERING_SERVER_WRAP_MT_H
  32. #include "core/command_queue_mt.h"
  33. #include "core/os/thread.h"
  34. #include "servers/rendering_server.h"
  35. class RenderingServerWrapMT : public RenderingServer {
  36. // the real visual server
  37. mutable RenderingServer *rendering_server;
  38. mutable CommandQueueMT command_queue;
  39. static void _thread_callback(void *_instance);
  40. void thread_loop();
  41. Thread::ID server_thread;
  42. volatile bool exit;
  43. Thread *thread;
  44. volatile bool draw_thread_up;
  45. bool create_thread;
  46. uint64_t draw_pending;
  47. void thread_draw(bool p_swap_buffers, double frame_step);
  48. void thread_flush();
  49. void thread_exit();
  50. Mutex alloc_mutex;
  51. int pool_max_size;
  52. //#define DEBUG_SYNC
  53. static RenderingServerWrapMT *singleton_mt;
  54. #ifdef DEBUG_SYNC
  55. #define SYNC_DEBUG print_line("sync on: " + String(__FUNCTION__));
  56. #else
  57. #define SYNC_DEBUG
  58. #endif
  59. public:
  60. #define ServerName RenderingServer
  61. #define ServerNameWrapMT RenderingServerWrapMT
  62. #define server_name rendering_server
  63. #include "servers/server_wrap_mt_common.h"
  64. //these go pass-through, as they can be called from any thread
  65. virtual RID texture_2d_create(const Ref<Image> &p_image) { return rendering_server->texture_2d_create(p_image); }
  66. virtual RID texture_2d_layered_create(const Vector<Ref<Image>> &p_layers, TextureLayeredType p_layered_type) { return rendering_server->texture_2d_layered_create(p_layers, p_layered_type); }
  67. virtual RID texture_3d_create(const Vector<Ref<Image>> &p_slices) { return rendering_server->texture_3d_create(p_slices); }
  68. virtual RID texture_proxy_create(RID p_base) { return rendering_server->texture_proxy_create(p_base); }
  69. //goes pass-through
  70. virtual void texture_2d_update_immediate(RID p_texture, const Ref<Image> &p_image, int p_layer = 0) { rendering_server->texture_2d_update_immediate(p_texture, p_image, p_layer); }
  71. //these go through command queue if they are in another thread
  72. FUNC3(texture_2d_update, RID, const Ref<Image> &, int)
  73. FUNC4(texture_3d_update, RID, const Ref<Image> &, int, int)
  74. FUNC2(texture_proxy_update, RID, RID)
  75. //these also go pass-through
  76. virtual RID texture_2d_placeholder_create() { return rendering_server->texture_2d_placeholder_create(); }
  77. virtual RID texture_2d_layered_placeholder_create() { return rendering_server->texture_2d_layered_placeholder_create(); }
  78. virtual RID texture_3d_placeholder_create() { return rendering_server->texture_3d_placeholder_create(); }
  79. FUNC1RC(Ref<Image>, texture_2d_get, RID)
  80. FUNC2RC(Ref<Image>, texture_2d_layer_get, RID, int)
  81. FUNC3RC(Ref<Image>, texture_3d_slice_get, RID, int, int)
  82. FUNC2(texture_replace, RID, RID)
  83. FUNC3(texture_set_size_override, RID, int, int)
  84. // FIXME: Disabled during Vulkan refactoring, should be ported.
  85. #if 0
  86. FUNC2(texture_bind, RID, uint32_t)
  87. #endif
  88. FUNC3(texture_set_detect_3d_callback, RID, TextureDetectCallback, void *)
  89. FUNC3(texture_set_detect_normal_callback, RID, TextureDetectCallback, void *)
  90. FUNC3(texture_set_detect_roughness_callback, RID, TextureDetectRoughnessCallback, void *)
  91. FUNC2(texture_set_path, RID, const String &)
  92. FUNC1RC(String, texture_get_path, RID)
  93. FUNC1S(texture_debug_usage, List<TextureInfo> *)
  94. FUNC2(texture_set_force_redraw_if_visible, RID, bool)
  95. /* SHADER API */
  96. FUNCRID(shader)
  97. FUNC2(shader_set_code, RID, const String &)
  98. FUNC1RC(String, shader_get_code, RID)
  99. FUNC2SC(shader_get_param_list, RID, List<PropertyInfo> *)
  100. FUNC3(shader_set_default_texture_param, RID, const StringName &, RID)
  101. FUNC2RC(RID, shader_get_default_texture_param, RID, const StringName &)
  102. FUNC2RC(Variant, shader_get_param_default, RID, const StringName &)
  103. /* COMMON MATERIAL API */
  104. FUNCRID(material)
  105. FUNC2(material_set_shader, RID, RID)
  106. FUNC3(material_set_param, RID, const StringName &, const Variant &)
  107. FUNC2RC(Variant, material_get_param, RID, const StringName &)
  108. FUNC2(material_set_render_priority, RID, int)
  109. FUNC2(material_set_next_pass, RID, RID)
  110. /* MESH API */
  111. virtual RID mesh_create_from_surfaces(const Vector<SurfaceData> &p_surfaces) {
  112. return rendering_server->mesh_create_from_surfaces(p_surfaces);
  113. }
  114. FUNCRID(mesh)
  115. FUNC2(mesh_add_surface, RID, const SurfaceData &)
  116. FUNC1RC(int, mesh_get_blend_shape_count, RID)
  117. FUNC2(mesh_set_blend_shape_mode, RID, BlendShapeMode)
  118. FUNC1RC(BlendShapeMode, mesh_get_blend_shape_mode, RID)
  119. FUNC4(mesh_surface_update_region, RID, int, int, const Vector<uint8_t> &)
  120. FUNC3(mesh_surface_set_material, RID, int, RID)
  121. FUNC2RC(RID, mesh_surface_get_material, RID, int)
  122. FUNC2RC(SurfaceData, mesh_get_surface, RID, int)
  123. FUNC1RC(int, mesh_get_surface_count, RID)
  124. FUNC2(mesh_set_custom_aabb, RID, const AABB &)
  125. FUNC1RC(AABB, mesh_get_custom_aabb, RID)
  126. FUNC1(mesh_clear, RID)
  127. /* MULTIMESH API */
  128. FUNCRID(multimesh)
  129. FUNC5(multimesh_allocate, RID, int, MultimeshTransformFormat, bool, bool)
  130. FUNC1RC(int, multimesh_get_instance_count, RID)
  131. FUNC2(multimesh_set_mesh, RID, RID)
  132. FUNC3(multimesh_instance_set_transform, RID, int, const Transform &)
  133. FUNC3(multimesh_instance_set_transform_2d, RID, int, const Transform2D &)
  134. FUNC3(multimesh_instance_set_color, RID, int, const Color &)
  135. FUNC3(multimesh_instance_set_custom_data, RID, int, const Color &)
  136. FUNC1RC(RID, multimesh_get_mesh, RID)
  137. FUNC1RC(AABB, multimesh_get_aabb, RID)
  138. FUNC2RC(Transform, multimesh_instance_get_transform, RID, int)
  139. FUNC2RC(Transform2D, multimesh_instance_get_transform_2d, RID, int)
  140. FUNC2RC(Color, multimesh_instance_get_color, RID, int)
  141. FUNC2RC(Color, multimesh_instance_get_custom_data, RID, int)
  142. FUNC2(multimesh_set_buffer, RID, const Vector<float> &)
  143. FUNC1RC(Vector<float>, multimesh_get_buffer, RID)
  144. FUNC2(multimesh_set_visible_instances, RID, int)
  145. FUNC1RC(int, multimesh_get_visible_instances, RID)
  146. /* IMMEDIATE API */
  147. FUNCRID(immediate)
  148. FUNC3(immediate_begin, RID, PrimitiveType, RID)
  149. FUNC2(immediate_vertex, RID, const Vector3 &)
  150. FUNC2(immediate_normal, RID, const Vector3 &)
  151. FUNC2(immediate_tangent, RID, const Plane &)
  152. FUNC2(immediate_color, RID, const Color &)
  153. FUNC2(immediate_uv, RID, const Vector2 &)
  154. FUNC2(immediate_uv2, RID, const Vector2 &)
  155. FUNC1(immediate_end, RID)
  156. FUNC1(immediate_clear, RID)
  157. FUNC2(immediate_set_material, RID, RID)
  158. FUNC1RC(RID, immediate_get_material, RID)
  159. /* SKELETON API */
  160. FUNCRID(skeleton)
  161. FUNC3(skeleton_allocate, RID, int, bool)
  162. FUNC1RC(int, skeleton_get_bone_count, RID)
  163. FUNC3(skeleton_bone_set_transform, RID, int, const Transform &)
  164. FUNC2RC(Transform, skeleton_bone_get_transform, RID, int)
  165. FUNC3(skeleton_bone_set_transform_2d, RID, int, const Transform2D &)
  166. FUNC2RC(Transform2D, skeleton_bone_get_transform_2d, RID, int)
  167. FUNC2(skeleton_set_base_transform_2d, RID, const Transform2D &)
  168. /* Light API */
  169. FUNCRID(directional_light)
  170. FUNCRID(omni_light)
  171. FUNCRID(spot_light)
  172. FUNC2(light_set_color, RID, const Color &)
  173. FUNC3(light_set_param, RID, LightParam, float)
  174. FUNC2(light_set_shadow, RID, bool)
  175. FUNC2(light_set_shadow_color, RID, const Color &)
  176. FUNC2(light_set_projector, RID, RID)
  177. FUNC2(light_set_negative, RID, bool)
  178. FUNC2(light_set_cull_mask, RID, uint32_t)
  179. FUNC2(light_set_reverse_cull_face_mode, RID, bool)
  180. FUNC2(light_set_use_gi, RID, bool)
  181. FUNC2(light_omni_set_shadow_mode, RID, LightOmniShadowMode)
  182. FUNC2(light_directional_set_shadow_mode, RID, LightDirectionalShadowMode)
  183. FUNC2(light_directional_set_blend_splits, RID, bool)
  184. FUNC2(light_directional_set_shadow_depth_range_mode, RID, LightDirectionalShadowDepthRangeMode)
  185. /* PROBE API */
  186. FUNCRID(reflection_probe)
  187. FUNC2(reflection_probe_set_update_mode, RID, ReflectionProbeUpdateMode)
  188. FUNC2(reflection_probe_set_intensity, RID, float)
  189. FUNC2(reflection_probe_set_interior_ambient, RID, const Color &)
  190. FUNC2(reflection_probe_set_interior_ambient_energy, RID, float)
  191. FUNC2(reflection_probe_set_interior_ambient_probe_contribution, RID, float)
  192. FUNC2(reflection_probe_set_max_distance, RID, float)
  193. FUNC2(reflection_probe_set_extents, RID, const Vector3 &)
  194. FUNC2(reflection_probe_set_origin_offset, RID, const Vector3 &)
  195. FUNC2(reflection_probe_set_as_interior, RID, bool)
  196. FUNC2(reflection_probe_set_enable_box_projection, RID, bool)
  197. FUNC2(reflection_probe_set_enable_shadows, RID, bool)
  198. FUNC2(reflection_probe_set_cull_mask, RID, uint32_t)
  199. FUNC2(reflection_probe_set_resolution, RID, int)
  200. /* BAKED LIGHT API */
  201. FUNCRID(gi_probe)
  202. FUNC8(gi_probe_allocate, RID, const Transform &, const AABB &, const Vector3i &, const Vector<uint8_t> &, const Vector<uint8_t> &, const Vector<uint8_t> &, const Vector<int> &)
  203. FUNC1RC(AABB, gi_probe_get_bounds, RID)
  204. FUNC1RC(Vector3i, gi_probe_get_octree_size, RID)
  205. FUNC1RC(Vector<uint8_t>, gi_probe_get_octree_cells, RID)
  206. FUNC1RC(Vector<uint8_t>, gi_probe_get_data_cells, RID)
  207. FUNC1RC(Vector<uint8_t>, gi_probe_get_distance_field, RID)
  208. FUNC1RC(Vector<int>, gi_probe_get_level_counts, RID)
  209. FUNC1RC(Transform, gi_probe_get_to_cell_xform, RID)
  210. FUNC2(gi_probe_set_dynamic_range, RID, float)
  211. FUNC1RC(float, gi_probe_get_dynamic_range, RID)
  212. FUNC2(gi_probe_set_propagation, RID, float)
  213. FUNC1RC(float, gi_probe_get_propagation, RID)
  214. FUNC2(gi_probe_set_energy, RID, float)
  215. FUNC1RC(float, gi_probe_get_energy, RID)
  216. FUNC2(gi_probe_set_ao, RID, float)
  217. FUNC1RC(float, gi_probe_get_ao, RID)
  218. FUNC2(gi_probe_set_ao_size, RID, float)
  219. FUNC1RC(float, gi_probe_get_ao_size, RID)
  220. FUNC2(gi_probe_set_bias, RID, float)
  221. FUNC1RC(float, gi_probe_get_bias, RID)
  222. FUNC2(gi_probe_set_normal_bias, RID, float)
  223. FUNC1RC(float, gi_probe_get_normal_bias, RID)
  224. FUNC2(gi_probe_set_interior, RID, bool)
  225. FUNC1RC(bool, gi_probe_is_interior, RID)
  226. FUNC2(gi_probe_set_use_two_bounces, RID, bool)
  227. FUNC1RC(bool, gi_probe_is_using_two_bounces, RID)
  228. FUNC2(gi_probe_set_anisotropy_strength, RID, float)
  229. FUNC1RC(float, gi_probe_get_anisotropy_strength, RID)
  230. /* LIGHTMAP CAPTURE */
  231. FUNCRID(lightmap_capture)
  232. FUNC2(lightmap_capture_set_bounds, RID, const AABB &)
  233. FUNC1RC(AABB, lightmap_capture_get_bounds, RID)
  234. FUNC2(lightmap_capture_set_octree, RID, const Vector<uint8_t> &)
  235. FUNC1RC(Vector<uint8_t>, lightmap_capture_get_octree, RID)
  236. FUNC2(lightmap_capture_set_octree_cell_transform, RID, const Transform &)
  237. FUNC1RC(Transform, lightmap_capture_get_octree_cell_transform, RID)
  238. FUNC2(lightmap_capture_set_octree_cell_subdiv, RID, int)
  239. FUNC1RC(int, lightmap_capture_get_octree_cell_subdiv, RID)
  240. FUNC2(lightmap_capture_set_energy, RID, float)
  241. FUNC1RC(float, lightmap_capture_get_energy, RID)
  242. /* PARTICLES */
  243. FUNCRID(particles)
  244. FUNC2(particles_set_emitting, RID, bool)
  245. FUNC1R(bool, particles_get_emitting, RID)
  246. FUNC2(particles_set_amount, RID, int)
  247. FUNC2(particles_set_lifetime, RID, float)
  248. FUNC2(particles_set_one_shot, RID, bool)
  249. FUNC2(particles_set_pre_process_time, RID, float)
  250. FUNC2(particles_set_explosiveness_ratio, RID, float)
  251. FUNC2(particles_set_randomness_ratio, RID, float)
  252. FUNC2(particles_set_custom_aabb, RID, const AABB &)
  253. FUNC2(particles_set_speed_scale, RID, float)
  254. FUNC2(particles_set_use_local_coordinates, RID, bool)
  255. FUNC2(particles_set_process_material, RID, RID)
  256. FUNC2(particles_set_fixed_fps, RID, int)
  257. FUNC2(particles_set_fractional_delta, RID, bool)
  258. FUNC1R(bool, particles_is_inactive, RID)
  259. FUNC1(particles_request_process, RID)
  260. FUNC1(particles_restart, RID)
  261. FUNC2(particles_set_draw_order, RID, RS::ParticlesDrawOrder)
  262. FUNC2(particles_set_draw_passes, RID, int)
  263. FUNC3(particles_set_draw_pass_mesh, RID, int, RID)
  264. FUNC2(particles_set_emission_transform, RID, const Transform &)
  265. FUNC1R(AABB, particles_get_current_aabb, RID)
  266. /* CAMERA API */
  267. FUNCRID(camera)
  268. FUNC4(camera_set_perspective, RID, float, float, float)
  269. FUNC4(camera_set_orthogonal, RID, float, float, float)
  270. FUNC5(camera_set_frustum, RID, float, Vector2, float, float)
  271. FUNC2(camera_set_transform, RID, const Transform &)
  272. FUNC2(camera_set_cull_mask, RID, uint32_t)
  273. FUNC2(camera_set_environment, RID, RID)
  274. FUNC2(camera_set_camera_effects, RID, RID)
  275. FUNC2(camera_set_use_vertical_aspect, RID, bool)
  276. /* VIEWPORT TARGET API */
  277. FUNCRID(viewport)
  278. FUNC2(viewport_set_use_xr, RID, bool)
  279. FUNC3(viewport_set_size, RID, int, int)
  280. FUNC2(viewport_set_active, RID, bool)
  281. FUNC2(viewport_set_parent_viewport, RID, RID)
  282. FUNC2(viewport_set_clear_mode, RID, ViewportClearMode)
  283. FUNC3(viewport_attach_to_screen, RID, const Rect2 &, DisplayServer::WindowID)
  284. FUNC2(viewport_set_render_direct_to_screen, RID, bool)
  285. FUNC2(viewport_set_update_mode, RID, ViewportUpdateMode)
  286. FUNC1RC(RID, viewport_get_texture, RID)
  287. FUNC2(viewport_set_hide_scenario, RID, bool)
  288. FUNC2(viewport_set_hide_canvas, RID, bool)
  289. FUNC2(viewport_set_disable_environment, RID, bool)
  290. FUNC2(viewport_attach_camera, RID, RID)
  291. FUNC2(viewport_set_scenario, RID, RID)
  292. FUNC2(viewport_attach_canvas, RID, RID)
  293. FUNC2(viewport_remove_canvas, RID, RID)
  294. FUNC3(viewport_set_canvas_transform, RID, RID, const Transform2D &)
  295. FUNC2(viewport_set_transparent_background, RID, bool)
  296. FUNC2(viewport_set_global_canvas_transform, RID, const Transform2D &)
  297. FUNC4(viewport_set_canvas_stacking, RID, RID, int, int)
  298. FUNC2(viewport_set_shadow_atlas_size, RID, int)
  299. FUNC3(viewport_set_shadow_atlas_quadrant_subdivision, RID, int, int)
  300. FUNC2(viewport_set_msaa, RID, ViewportMSAA)
  301. //this passes directly to avoid stalling, but it's pretty dangerous, so don't call after freeing a viewport
  302. virtual int viewport_get_render_info(RID p_viewport, ViewportRenderInfo p_info) {
  303. return rendering_server->viewport_get_render_info(p_viewport, p_info);
  304. }
  305. FUNC2(viewport_set_debug_draw, RID, ViewportDebugDraw)
  306. FUNC2(viewport_set_measure_render_time, RID, bool)
  307. virtual float viewport_get_measured_render_time_cpu(RID p_viewport) const {
  308. return rendering_server->viewport_get_measured_render_time_cpu(p_viewport);
  309. }
  310. virtual float viewport_get_measured_render_time_gpu(RID p_viewport) const {
  311. return rendering_server->viewport_get_measured_render_time_gpu(p_viewport);
  312. }
  313. FUNC1(directional_shadow_atlas_set_size, int)
  314. /* SKY API */
  315. FUNCRID(sky)
  316. FUNC2(sky_set_radiance_size, RID, int)
  317. FUNC2(sky_set_mode, RID, SkyMode)
  318. FUNC2(sky_set_material, RID, RID)
  319. /* ENVIRONMENT API */
  320. FUNCRID(environment)
  321. FUNC2(environment_set_background, RID, EnvironmentBG)
  322. FUNC2(environment_set_sky, RID, RID)
  323. FUNC2(environment_set_sky_custom_fov, RID, float)
  324. FUNC2(environment_set_sky_orientation, RID, const Basis &)
  325. FUNC2(environment_set_bg_color, RID, const Color &)
  326. FUNC2(environment_set_bg_energy, RID, float)
  327. FUNC2(environment_set_canvas_max_layer, RID, int)
  328. FUNC7(environment_set_ambient_light, RID, const Color &, EnvironmentAmbientSource, float, float, EnvironmentReflectionSource, const Color &)
  329. // FIXME: Disabled during Vulkan refactoring, should be ported.
  330. #if 0
  331. FUNC2(environment_set_camera_feed_id, RID, int)
  332. #endif
  333. FUNC6(environment_set_ssr, RID, bool, int, float, float, float)
  334. FUNC1(environment_set_ssr_roughness_quality, EnvironmentSSRRoughnessQuality)
  335. FUNC9(environment_set_ssao, RID, bool, float, float, float, float, float, EnvironmentSSAOBlur, float)
  336. FUNC2(environment_set_ssao_quality, EnvironmentSSAOQuality, bool)
  337. FUNC11(environment_set_glow, RID, bool, int, float, float, float, float, EnvironmentGlowBlendMode, float, float, float)
  338. FUNC1(environment_glow_set_use_bicubic_upscale, bool)
  339. FUNC9(environment_set_tonemap, RID, EnvironmentToneMapper, float, float, bool, float, float, float, float)
  340. FUNC6(environment_set_adjustment, RID, bool, float, float, float, RID)
  341. FUNC5(environment_set_fog, RID, bool, const Color &, const Color &, float)
  342. FUNC7(environment_set_fog_depth, RID, bool, float, float, float, bool, float)
  343. FUNC5(environment_set_fog_height, RID, bool, float, float, float)
  344. FUNC2(screen_space_roughness_limiter_set_active, bool, float)
  345. FUNC1(sub_surface_scattering_set_quality, SubSurfaceScatteringQuality)
  346. FUNC2(sub_surface_scattering_set_scale, float, float)
  347. FUNCRID(camera_effects)
  348. FUNC2(camera_effects_set_dof_blur_quality, DOFBlurQuality, bool)
  349. FUNC1(camera_effects_set_dof_blur_bokeh_shape, DOFBokehShape)
  350. FUNC8(camera_effects_set_dof_blur, RID, bool, float, float, bool, float, float, float)
  351. FUNC3(camera_effects_set_custom_exposure, RID, bool, float)
  352. FUNC1(shadow_filter_set, ShadowFilter)
  353. FUNCRID(scenario)
  354. FUNC2(scenario_set_debug, RID, ScenarioDebugMode)
  355. FUNC2(scenario_set_environment, RID, RID)
  356. FUNC2(scenario_set_camera_effects, RID, RID)
  357. FUNC2(scenario_set_fallback_environment, RID, RID)
  358. /* INSTANCING API */
  359. FUNCRID(instance)
  360. FUNC2(instance_set_base, RID, RID)
  361. FUNC2(instance_set_scenario, RID, RID)
  362. FUNC2(instance_set_layer_mask, RID, uint32_t)
  363. FUNC2(instance_set_transform, RID, const Transform &)
  364. FUNC2(instance_attach_object_instance_id, RID, ObjectID)
  365. FUNC3(instance_set_blend_shape_weight, RID, int, float)
  366. FUNC3(instance_set_surface_material, RID, int, RID)
  367. FUNC2(instance_set_visible, RID, bool)
  368. FUNC3(instance_set_use_lightmap, RID, RID, RID)
  369. FUNC2(instance_set_custom_aabb, RID, AABB)
  370. FUNC2(instance_attach_skeleton, RID, RID)
  371. FUNC2(instance_set_exterior, RID, bool)
  372. FUNC2(instance_set_extra_visibility_margin, RID, real_t)
  373. // don't use these in a game!
  374. FUNC2RC(Vector<ObjectID>, instances_cull_aabb, const AABB &, RID)
  375. FUNC3RC(Vector<ObjectID>, instances_cull_ray, const Vector3 &, const Vector3 &, RID)
  376. FUNC2RC(Vector<ObjectID>, instances_cull_convex, const Vector<Plane> &, RID)
  377. FUNC3(instance_geometry_set_flag, RID, InstanceFlags, bool)
  378. FUNC2(instance_geometry_set_cast_shadows_setting, RID, ShadowCastingSetting)
  379. FUNC2(instance_geometry_set_material_override, RID, RID)
  380. FUNC5(instance_geometry_set_draw_range, RID, float, float, float, float)
  381. FUNC2(instance_geometry_set_as_instance_lod, RID, RID)
  382. /* CANVAS (2D) */
  383. FUNCRID(canvas)
  384. FUNC3(canvas_set_item_mirroring, RID, RID, const Point2 &)
  385. FUNC2(canvas_set_modulate, RID, const Color &)
  386. FUNC3(canvas_set_parent, RID, RID, float)
  387. FUNC1(canvas_set_disable_scale, bool)
  388. FUNCRID(canvas_item)
  389. FUNC2(canvas_item_set_parent, RID, RID)
  390. FUNC2(canvas_item_set_visible, RID, bool)
  391. FUNC2(canvas_item_set_light_mask, RID, int)
  392. FUNC2(canvas_item_set_update_when_visible, RID, bool)
  393. FUNC2(canvas_item_set_transform, RID, const Transform2D &)
  394. FUNC2(canvas_item_set_clip, RID, bool)
  395. FUNC2(canvas_item_set_distance_field_mode, RID, bool)
  396. FUNC3(canvas_item_set_custom_rect, RID, bool, const Rect2 &)
  397. FUNC2(canvas_item_set_modulate, RID, const Color &)
  398. FUNC2(canvas_item_set_self_modulate, RID, const Color &)
  399. FUNC2(canvas_item_set_draw_behind_parent, RID, bool)
  400. FUNC2(canvas_item_set_default_texture_filter, RID, CanvasItemTextureFilter)
  401. FUNC2(canvas_item_set_default_texture_repeat, RID, CanvasItemTextureRepeat)
  402. FUNC5(canvas_item_add_line, RID, const Point2 &, const Point2 &, const Color &, float)
  403. FUNC4(canvas_item_add_polyline, RID, const Vector<Point2> &, const Vector<Color> &, float)
  404. FUNC4(canvas_item_add_multiline, RID, const Vector<Point2> &, const Vector<Color> &, float)
  405. FUNC3(canvas_item_add_rect, RID, const Rect2 &, const Color &)
  406. FUNC4(canvas_item_add_circle, RID, const Point2 &, float, const Color &)
  407. FUNC11(canvas_item_add_texture_rect, RID, const Rect2 &, RID, bool, const Color &, bool, RID, RID, const Color &, CanvasItemTextureFilter, CanvasItemTextureRepeat)
  408. FUNC12(canvas_item_add_texture_rect_region, RID, const Rect2 &, RID, const Rect2 &, const Color &, bool, RID, RID, const Color &, bool, CanvasItemTextureFilter, CanvasItemTextureRepeat)
  409. FUNC15(canvas_item_add_nine_patch, RID, const Rect2 &, const Rect2 &, RID, const Vector2 &, const Vector2 &, NinePatchAxisMode, NinePatchAxisMode, bool, const Color &, RID, RID, const Color &, CanvasItemTextureFilter, CanvasItemTextureRepeat)
  410. FUNC11(canvas_item_add_primitive, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, float, RID, RID, const Color &, CanvasItemTextureFilter, CanvasItemTextureRepeat)
  411. FUNC10(canvas_item_add_polygon, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, RID, RID, const Color &, CanvasItemTextureFilter, CanvasItemTextureRepeat)
  412. FUNC14(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, RID, RID, const Color &, CanvasItemTextureFilter, CanvasItemTextureRepeat)
  413. FUNC10(canvas_item_add_mesh, RID, const RID &, const Transform2D &, const Color &, RID, RID, RID, const Color &, CanvasItemTextureFilter, CanvasItemTextureRepeat)
  414. FUNC8(canvas_item_add_multimesh, RID, RID, RID, RID, RID, const Color &, CanvasItemTextureFilter, CanvasItemTextureRepeat)
  415. FUNC8(canvas_item_add_particles, RID, RID, RID, RID, RID, const Color &, CanvasItemTextureFilter, CanvasItemTextureRepeat)
  416. FUNC2(canvas_item_add_set_transform, RID, const Transform2D &)
  417. FUNC2(canvas_item_add_clip_ignore, RID, bool)
  418. FUNC2(canvas_item_set_sort_children_by_y, RID, bool)
  419. FUNC2(canvas_item_set_z_index, RID, int)
  420. FUNC2(canvas_item_set_z_as_relative_to_parent, RID, bool)
  421. FUNC3(canvas_item_set_copy_to_backbuffer, RID, bool, const Rect2 &)
  422. FUNC2(canvas_item_attach_skeleton, RID, RID)
  423. FUNC1(canvas_item_clear, RID)
  424. FUNC2(canvas_item_set_draw_index, RID, int)
  425. FUNC2(canvas_item_set_material, RID, RID)
  426. FUNC2(canvas_item_set_use_parent_material, RID, bool)
  427. FUNC0R(RID, canvas_light_create)
  428. FUNC2(canvas_light_attach_to_canvas, RID, RID)
  429. FUNC2(canvas_light_set_enabled, RID, bool)
  430. FUNC2(canvas_light_set_scale, RID, float)
  431. FUNC2(canvas_light_set_transform, RID, const Transform2D &)
  432. FUNC2(canvas_light_set_texture, RID, RID)
  433. FUNC2(canvas_light_set_texture_offset, RID, const Vector2 &)
  434. FUNC2(canvas_light_set_color, RID, const Color &)
  435. FUNC2(canvas_light_set_height, RID, float)
  436. FUNC2(canvas_light_set_energy, RID, float)
  437. FUNC3(canvas_light_set_z_range, RID, int, int)
  438. FUNC3(canvas_light_set_layer_range, RID, int, int)
  439. FUNC2(canvas_light_set_item_cull_mask, RID, int)
  440. FUNC2(canvas_light_set_item_shadow_cull_mask, RID, int)
  441. FUNC2(canvas_light_set_mode, RID, CanvasLightMode)
  442. FUNC2(canvas_light_set_shadow_enabled, RID, bool)
  443. FUNC2(canvas_light_set_shadow_buffer_size, RID, int)
  444. FUNC2(canvas_light_set_shadow_filter, RID, CanvasLightShadowFilter)
  445. FUNC2(canvas_light_set_shadow_color, RID, const Color &)
  446. FUNC2(canvas_light_set_shadow_smooth, RID, float)
  447. FUNCRID(canvas_light_occluder)
  448. FUNC2(canvas_light_occluder_attach_to_canvas, RID, RID)
  449. FUNC2(canvas_light_occluder_set_enabled, RID, bool)
  450. FUNC2(canvas_light_occluder_set_polygon, RID, RID)
  451. FUNC2(canvas_light_occluder_set_transform, RID, const Transform2D &)
  452. FUNC2(canvas_light_occluder_set_light_mask, RID, int)
  453. FUNCRID(canvas_occluder_polygon)
  454. FUNC3(canvas_occluder_polygon_set_shape, RID, const Vector<Vector2> &, bool)
  455. FUNC2(canvas_occluder_polygon_set_shape_as_lines, RID, const Vector<Vector2> &)
  456. FUNC2(canvas_occluder_polygon_set_cull_mode, RID, CanvasOccluderPolygonCullMode)
  457. /* BLACK BARS */
  458. FUNC4(black_bars_set_margins, int, int, int, int)
  459. FUNC4(black_bars_set_images, RID, RID, RID, RID)
  460. /* FREE */
  461. FUNC1(free, RID)
  462. /* EVENT QUEUING */
  463. FUNC3(request_frame_drawn_callback, Object *, const StringName &, const Variant &)
  464. virtual void init();
  465. virtual void finish();
  466. virtual void draw(bool p_swap_buffers, double frame_step);
  467. virtual void sync();
  468. FUNC0RC(bool, has_changed)
  469. /* RENDER INFO */
  470. //this passes directly to avoid stalling
  471. virtual int get_render_info(RenderInfo p_info) {
  472. return rendering_server->get_render_info(p_info);
  473. }
  474. virtual String get_video_adapter_name() const {
  475. return rendering_server->get_video_adapter_name();
  476. }
  477. virtual String get_video_adapter_vendor() const {
  478. return rendering_server->get_video_adapter_vendor();
  479. }
  480. FUNC4(set_boot_image, const Ref<Image> &, const Color &, bool, bool)
  481. FUNC1(set_default_clear_color, const Color &)
  482. FUNC0R(RID, get_test_cube)
  483. FUNC1(set_debug_generate_wireframes, bool)
  484. virtual bool has_feature(Features p_feature) const {
  485. return rendering_server->has_feature(p_feature);
  486. }
  487. virtual bool has_os_feature(const String &p_feature) const {
  488. return rendering_server->has_os_feature(p_feature);
  489. }
  490. FUNC1(call_set_use_vsync, bool)
  491. static void set_use_vsync_callback(bool p_enable);
  492. virtual bool is_low_end() const {
  493. return rendering_server->is_low_end();
  494. }
  495. virtual uint64_t get_frame_profile_frame() {
  496. return rendering_server->get_frame_profile_frame();
  497. }
  498. virtual void set_frame_profiling_enabled(bool p_enabled) {
  499. rendering_server->set_frame_profiling_enabled(p_enabled);
  500. }
  501. virtual Vector<FrameProfileArea> get_frame_profile() {
  502. return rendering_server->get_frame_profile();
  503. }
  504. RenderingServerWrapMT(RenderingServer *p_contained, bool p_create_thread);
  505. ~RenderingServerWrapMT();
  506. #undef ServerName
  507. #undef ServerNameWrapMT
  508. #undef server_name
  509. };
  510. #ifdef DEBUG_SYNC
  511. #undef DEBUG_SYNC
  512. #endif
  513. #undef SYNC_DEBUG
  514. #endif