Debian Codegraph @

servers/rendering/rendering_server_default.h

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