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