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