2023-01-05 13:25:55 +01:00
/**************************************************************************/
/* rendering_server_default.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
2018-01-05 00:50:27 +01:00
2020-12-03 18:09:47 -03:00
# ifndef RENDERING_SERVER_DEFAULT_H
# define RENDERING_SERVER_DEFAULT_H
2014-02-09 22:10:30 -03:00
2024-04-04 10:18:08 +02:00
# include "core/object/worker_thread_pool.h"
2023-02-13 13:45:06 -05:00
# include "core/os/thread.h"
2021-02-09 13:19:03 -03:00
# include "core/templates/command_queue_mt.h"
2022-05-08 10:09:19 +02:00
# include "core/templates/hash_map.h"
2020-12-04 15:26:24 -03:00
# include "renderer_canvas_cull.h"
# include "renderer_viewport.h"
2020-03-27 15:21:27 -03:00
# include "rendering_server_globals.h"
2020-12-04 15:26:24 -03:00
# include "servers/rendering/renderer_compositor.h"
2020-03-27 15:21:27 -03:00
# include "servers/rendering_server.h"
2021-02-09 13:19:03 -03:00
# include "servers/server_wrap_mt_common.h"
2014-02-09 22:10:30 -03:00
2020-12-03 18:09:47 -03:00
class RenderingServerDefault : public RenderingServer {
2014-02-09 22:10:30 -03:00
enum {
2017-03-05 16:44:50 +01:00
MAX_INSTANCE_CULL = 8192 ,
MAX_INSTANCE_LIGHTS = 4 ,
LIGHT_CACHE_DIRTY = - 1 ,
MAX_LIGHTS_CULLED = 256 ,
MAX_ROOM_CULL = 32 ,
MAX_EXTERIOR_PORTALS = 128 ,
MAX_LIGHT_SAMPLERS = 256 ,
INSTANCE_ROOMLESS_MASK = ( 1 < < 20 )
2014-02-09 22:10:30 -03:00
} ;
2017-04-06 23:36:37 -03:00
static int changes ;
2016-10-03 16:33:42 -03:00
RID test_cube ;
2021-11-05 01:59:38 -04:00
List < Callable > frame_drawn_callbacks ;
2017-06-09 00:23:50 -03:00
2017-09-23 17:27:29 -03:00
static void _changes_changed ( ) { }
2017-08-07 18:06:57 -03:00
2024-04-23 12:01:23 +02:00
uint64_t frame_profile_frame = 0 ;
2019-09-20 17:58:06 -03:00
Vector < FrameProfileArea > frame_profile ;
2021-02-01 21:16:37 -05:00
double frame_setup_time = 0 ;
2020-12-24 00:13:52 -03:00
2021-01-22 20:50:24 -03:00
//for printing
bool print_gpu_profile = false ;
2022-05-08 10:09:19 +02:00
HashMap < String , float > print_gpu_profile_task_time ;
2021-01-22 20:50:24 -03:00
uint64_t print_frame_profile_ticks_from = 0 ;
uint32_t print_frame_profile_frame_count = 0 ;
2021-02-09 13:19:03 -03:00
mutable CommandQueueMT command_queue ;
2024-04-23 12:01:23 +02:00
Thread : : ID server_thread = Thread : : MAIN_ID ;
2024-04-04 10:18:08 +02:00
WorkerThreadPool : : TaskID server_task_id = WorkerThreadPool : : INVALID_TASK_ID ;
bool exit = false ;
bool create_thread = false ;
2021-02-09 13:19:03 -03:00
2024-04-23 12:01:23 +02:00
void _assign_mt_ids ( WorkerThreadPool : : TaskID p_pump_task_id ) ;
2021-02-09 13:19:03 -03:00
void _thread_exit ( ) ;
2024-04-23 12:01:23 +02:00
void _thread_loop ( ) ;
2021-02-09 13:19:03 -03:00
void _draw ( bool p_swap_buffers , double frame_step ) ;
2024-04-23 12:01:23 +02:00
void _run_post_draw_steps ( ) ;
2021-02-09 13:19:03 -03:00
void _init ( ) ;
void _finish ( ) ;
void _free ( RID p_rid ) ;
2023-07-20 11:49:59 +02:00
void _call_on_render_thread ( const Callable & p_callable ) ;
2014-02-09 22:10:30 -03:00
public :
2017-12-06 21:36:34 +01:00
//if editor is redrawing when it shouldn't, enable this and put a breakpoint in _changes_changed()
//#define DEBUG_CHANGES
2017-09-23 17:27:29 -03:00
# ifdef DEBUG_CHANGES
_FORCE_INLINE_ static void redraw_request ( ) {
changes + + ;
_changes_changed ( ) ;
}
# else
2022-04-29 15:34:01 -07:00
_FORCE_INLINE_ static void redraw_request ( ) {
changes + + ;
}
2021-02-09 13:19:03 -03:00
# endif
2017-04-06 23:36:37 -03:00
2021-02-09 13:19:03 -03:00
# define WRITE_ACTION redraw_request();
# ifdef DEBUG_SYNC
# define SYNC_DEBUG print_line("sync on: " + String(__FUNCTION__));
# else
# define SYNC_DEBUG
2017-09-23 17:27:29 -03:00
# endif
2014-02-09 22:10:30 -03:00
2024-04-04 10:18:08 +02:00
# ifdef DEBUG_ENABLED
# define MAIN_THREAD_SYNC_WARN WARN_PRINT("Call to " + String(__FUNCTION__) + " causing RenderingServer synchronizations on every frame. This significantly affects performance.");
# endif
2021-02-09 13:19:03 -03:00
# include "servers/server_wrap_mt_common.h"
2014-02-09 22:10:30 -03:00
2016-10-03 16:33:42 -03:00
/* TEXTURE API */
2014-02-09 22:10:30 -03:00
2022-03-12 22:19:59 +11:00
# define ServerName RendererTextureStorage
# define server_name RSG::texture_storage
2024-03-15 14:13:31 -03:00
# define FUNCRIDTEX0(m_type) \
virtual RID m_type # # _create ( ) override { \
RID ret = RSG : : texture_storage - > texture_allocate ( ) ; \
if ( Thread : : get_caller_id ( ) = = server_thread | | RSG : : rasterizer - > can_create_resources_async ( ) ) { \
RSG : : texture_storage - > m_type # # _initialize ( ret ) ; \
} else { \
command_queue . push ( RSG : : texture_storage , & RendererTextureStorage : : m_type # # _initialize , ret ) ; \
} \
return ret ; \
2021-02-09 13:19:03 -03:00
}
2024-03-15 14:13:31 -03:00
# define FUNCRIDTEX1(m_type, m_type1) \
virtual RID m_type # # _create ( m_type1 p1 ) override { \
RID ret = RSG : : texture_storage - > texture_allocate ( ) ; \
if ( Thread : : get_caller_id ( ) = = server_thread | | RSG : : rasterizer - > can_create_resources_async ( ) ) { \
RSG : : texture_storage - > m_type # # _initialize ( ret , p1 ) ; \
} else { \
command_queue . push ( RSG : : texture_storage , & RendererTextureStorage : : m_type # # _initialize , ret , p1 ) ; \
} \
return ret ; \
2021-02-09 13:19:03 -03:00
}
2022-03-12 22:19:59 +11:00
# define FUNCRIDTEX2(m_type, m_type1, m_type2) \
virtual RID m_type # # _create ( m_type1 p1 , m_type2 p2 ) override { \
RID ret = RSG : : texture_storage - > texture_allocate ( ) ; \
2024-03-15 14:13:31 -03:00
if ( Thread : : get_caller_id ( ) = = server_thread | | RSG : : rasterizer - > can_create_resources_async ( ) ) { \
2022-03-12 22:19:59 +11:00
RSG : : texture_storage - > m_type # # _initialize ( ret , p1 , p2 ) ; \
} else { \
command_queue . push ( RSG : : texture_storage , & RendererTextureStorage : : m_type # # _initialize , ret , p1 , p2 ) ; \
} \
return ret ; \
2021-02-09 13:19:03 -03:00
}
2023-10-14 03:58:59 -07:00
# define FUNCRIDTEX3(m_type, m_type1, m_type2, m_type3) \
virtual RID m_type # # _create ( m_type1 p1 , m_type2 p2 , m_type3 p3 ) override { \
RID ret = RSG : : texture_storage - > texture_allocate ( ) ; \
2024-03-15 14:13:31 -03:00
if ( Thread : : get_caller_id ( ) = = server_thread | | RSG : : rasterizer - > can_create_resources_async ( ) ) { \
2023-10-14 03:58:59 -07:00
RSG : : texture_storage - > m_type # # _initialize ( ret , p1 , p2 , p3 ) ; \
} else { \
command_queue . push ( RSG : : texture_storage , & RendererTextureStorage : : m_type # # _initialize , ret , p1 , p2 , p3 ) ; \
} \
return ret ; \
}
2022-03-12 22:19:59 +11:00
# define FUNCRIDTEX6(m_type, m_type1, m_type2, m_type3, m_type4, m_type5, m_type6) \
virtual RID m_type # # _create ( m_type1 p1 , m_type2 p2 , m_type3 p3 , m_type4 p4 , m_type5 p5 , m_type6 p6 ) override { \
RID ret = RSG : : texture_storage - > texture_allocate ( ) ; \
2024-03-15 14:13:31 -03:00
if ( Thread : : get_caller_id ( ) = = server_thread | | RSG : : rasterizer - > can_create_resources_async ( ) ) { \
2022-03-12 22:19:59 +11:00
RSG : : texture_storage - > m_type # # _initialize ( ret , p1 , p2 , p3 , p4 , p5 , p6 ) ; \
} else { \
command_queue . push ( RSG : : texture_storage , & RendererTextureStorage : : m_type # # _initialize , ret , p1 , p2 , p3 , p4 , p5 , p6 ) ; \
} \
return ret ; \
2021-02-09 13:19:03 -03:00
}
2019-06-11 15:43:37 -03:00
//these go pass-through, as they can be called from any thread
2021-02-09 13:19:03 -03:00
FUNCRIDTEX1 ( texture_2d , const Ref < Image > & )
FUNCRIDTEX2 ( texture_2d_layered , const Vector < Ref < Image > > & , TextureLayeredType )
FUNCRIDTEX6 ( texture_3d , Image : : Format , int , int , int , bool , const Vector < Ref < Image > > & )
2023-10-14 03:58:59 -07:00
FUNCRIDTEX3 ( texture_external , int , int , uint64_t )
2021-02-09 13:19:03 -03:00
FUNCRIDTEX1 ( texture_proxy , RID )
2019-06-11 15:43:37 -03:00
2024-09-12 12:54:57 -05:00
// Called directly, not through the command queue.
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 {
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 ) ;
}
2019-06-11 15:43:37 -03:00
//these go through command queue if they are in another thread
2021-02-09 13:19:03 -03:00
FUNC3 ( texture_2d_update , RID , const Ref < Image > & , int )
FUNC2 ( texture_3d_update , RID , const Vector < Ref < Image > > & )
2023-10-14 03:58:59 -07:00
FUNC4 ( texture_external_update , RID , int , int , uint64_t )
2021-02-09 13:19:03 -03:00
FUNC2 ( texture_proxy_update , RID , RID )
2019-06-11 15:43:37 -03:00
//these also go pass-through
2021-02-09 13:19:03 -03:00
FUNCRIDTEX0 ( texture_2d_placeholder )
FUNCRIDTEX1 ( texture_2d_layered_placeholder , TextureLayeredType )
FUNCRIDTEX0 ( texture_3d_placeholder )
2019-06-11 15:43:37 -03:00
2021-02-09 13:19:03 -03:00
FUNC1RC ( Ref < Image > , texture_2d_get , RID )
FUNC2RC ( Ref < Image > , texture_2d_layer_get , RID , int )
FUNC1RC ( Vector < Ref < Image > > , texture_3d_get , RID )
2019-06-11 15:43:37 -03:00
2021-02-09 13:19:03 -03:00
FUNC2 ( texture_replace , RID , RID )
2019-06-11 15:43:37 -03:00
2021-02-09 13:19:03 -03:00
FUNC3 ( texture_set_size_override , RID , int , int )
2019-06-11 15:43:37 -03:00
// FIXME: Disabled during Vulkan refactoring, should be ported.
#if 0
2021-02-09 13:19:03 -03:00
FUNC2 ( texture_bind , RID , uint32_t )
2019-06-11 15:43:37 -03:00
# endif
2014-02-09 22:10:30 -03:00
2021-02-09 13:19:03 -03:00
FUNC3 ( texture_set_detect_3d_callback , RID , TextureDetectCallback , void * )
FUNC3 ( texture_set_detect_normal_callback , RID , TextureDetectCallback , void * )
FUNC3 ( texture_set_detect_roughness_callback , RID , TextureDetectRoughnessCallback , void * )
2014-02-09 22:10:30 -03:00
2021-02-09 13:19:03 -03:00
FUNC2 ( texture_set_path , RID , const String & )
FUNC1RC ( String , texture_get_path , RID )
2023-07-10 22:31:27 +10:00
FUNC1RC ( Image : : Format , texture_get_format , RID )
2021-02-09 13:19:03 -03:00
FUNC1 ( texture_debug_usage , List < TextureInfo > * )
2014-02-09 22:10:30 -03:00
2021-02-09 13:19:03 -03:00
FUNC2 ( texture_set_force_redraw_if_visible , RID , bool )
2023-07-10 22:31:27 +10:00
FUNCRIDTEX2 ( texture_rd , const RID & , const RS : : TextureLayeredType )
2023-03-10 20:41:55 +11:00
FUNC2RC ( RID , texture_get_rd_texture , RID , bool )
2023-03-10 21:24:25 +11:00
FUNC2RC ( uint64_t , texture_get_native_handle , RID , bool )
2018-07-16 11:43:26 -03:00
2022-03-21 22:25:25 +11:00
/* SHADER API */
2022-03-12 22:19:59 +11:00
# undef ServerName
# undef server_name
2022-03-21 22:25:25 +11:00
# define ServerName RendererMaterialStorage
# define server_name RSG::material_storage
2014-02-09 22:10:30 -03:00
2021-02-09 13:19:03 -03:00
FUNCRIDSPLIT ( shader )
2014-06-27 23:21:45 -03:00
2024-03-15 14:13:31 -03:00
virtual RID shader_create_from_code ( const String & p_code , const String & p_path_hint = String ( ) ) override {
RID shader = RSG : : material_storage - > shader_allocate ( ) ;
bool using_server_thread = Thread : : get_caller_id ( ) = = server_thread ;
if ( using_server_thread | | RSG : : rasterizer - > can_create_resources_async ( ) ) {
if ( using_server_thread ) {
command_queue . flush_if_pending ( ) ;
}
RSG : : material_storage - > shader_initialize ( shader ) ;
RSG : : material_storage - > shader_set_code ( shader , p_code ) ;
RSG : : material_storage - > shader_set_path_hint ( shader , p_path_hint ) ;
} else {
command_queue . push ( RSG : : material_storage , & RendererMaterialStorage : : shader_initialize , shader ) ;
command_queue . push ( RSG : : material_storage , & RendererMaterialStorage : : shader_set_code , shader , p_code ) ;
command_queue . push ( RSG : : material_storage , & RendererMaterialStorage : : shader_set_path_hint , shader , p_path_hint ) ;
}
return shader ;
}
2021-02-09 13:19:03 -03:00
FUNC2 ( shader_set_code , RID , const String & )
2022-06-29 11:31:18 +02:00
FUNC2 ( shader_set_path_hint , RID , const String & )
2021-02-09 13:19:03 -03:00
FUNC1RC ( String , shader_get_code , RID )
2014-02-09 22:10:30 -03:00
2022-08-27 12:22:43 +03:00
FUNC2SC ( get_shader_parameter_list , RID , List < PropertyInfo > * )
2014-02-09 22:10:30 -03:00
2022-08-27 12:22:43 +03:00
FUNC4 ( shader_set_default_texture_parameter , RID , const StringName & , RID , int )
FUNC3RC ( RID , shader_get_default_texture_parameter , RID , const StringName & , int )
FUNC2RC ( Variant , shader_get_parameter_default , RID , const StringName & )
2014-02-09 22:10:30 -03:00
2021-02-09 13:19:03 -03:00
FUNC1RC ( ShaderNativeSourceCode , shader_get_native_source_code , RID )
2021-01-05 20:01:50 -03:00
2014-02-09 22:10:30 -03:00
/* COMMON MATERIAL API */
2021-02-09 13:19:03 -03:00
FUNCRIDSPLIT ( material )
2016-03-09 00:00:52 +01:00
2024-03-15 14:13:31 -03:00
virtual RID material_create_from_shader ( RID p_next_pass , int p_render_priority , RID p_shader ) override {
RID material = RSG : : material_storage - > material_allocate ( ) ;
bool using_server_thread = Thread : : get_caller_id ( ) = = server_thread ;
if ( using_server_thread | | RSG : : rasterizer - > can_create_resources_async ( ) ) {
if ( using_server_thread ) {
command_queue . flush_if_pending ( ) ;
}
RSG : : material_storage - > material_initialize ( material ) ;
RSG : : material_storage - > material_set_next_pass ( material , p_next_pass ) ;
RSG : : material_storage - > material_set_render_priority ( material , p_render_priority ) ;
RSG : : material_storage - > material_set_shader ( material , p_shader ) ;
} else {
command_queue . push ( RSG : : material_storage , & RendererMaterialStorage : : material_initialize , material ) ;
command_queue . push ( RSG : : material_storage , & RendererMaterialStorage : : material_set_next_pass , material , p_next_pass ) ;
command_queue . push ( RSG : : material_storage , & RendererMaterialStorage : : material_set_render_priority , material , p_render_priority ) ;
command_queue . push ( RSG : : material_storage , & RendererMaterialStorage : : material_set_shader , material , p_shader ) ;
}
return material ;
}
2021-02-09 13:19:03 -03:00
FUNC2 ( material_set_shader , RID , RID )
2014-05-04 22:50:23 -03:00
2021-02-09 13:19:03 -03:00
FUNC3 ( material_set_param , RID , const StringName & , const Variant & )
FUNC2RC ( Variant , material_get_param , RID , const StringName & )
2014-05-04 22:50:23 -03:00
2021-02-09 13:19:03 -03:00
FUNC2 ( material_set_render_priority , RID , int )
FUNC2 ( material_set_next_pass , RID , RID )
2014-02-09 22:10:30 -03:00
2016-10-03 16:33:42 -03:00
/* MESH API */
2014-02-09 22:10:30 -03:00
2022-03-21 22:25:25 +11:00
//from now on, calls forwarded to this singleton
# undef ServerName
# undef server_name
2022-04-02 16:29:04 +11:00
# define ServerName RendererMeshStorage
# define server_name RSG::mesh_storage
2022-03-21 22:25:25 +11:00
2021-02-09 13:19:03 -03:00
virtual RID mesh_create_from_surfaces ( const Vector < SurfaceData > & p_surfaces , int p_blend_shape_count = 0 ) override {
2022-04-02 16:29:04 +11:00
RID mesh = RSG : : mesh_storage - > mesh_allocate ( ) ;
2021-02-09 13:19:03 -03:00
2024-03-15 14:13:31 -03:00
bool using_server_thread = Thread : : get_caller_id ( ) = = server_thread ;
if ( using_server_thread | | RSG : : rasterizer - > can_create_resources_async ( ) ) {
if ( using_server_thread ) {
2021-02-09 13:19:03 -03:00
command_queue . flush_if_pending ( ) ;
}
2022-04-02 16:29:04 +11:00
RSG : : mesh_storage - > mesh_initialize ( mesh ) ;
RSG : : mesh_storage - > mesh_set_blend_shape_count ( mesh , p_blend_shape_count ) ;
2021-02-09 13:19:03 -03:00
for ( int i = 0 ; i < p_surfaces . size ( ) ; i + + ) {
2022-04-02 16:29:04 +11:00
RSG : : mesh_storage - > mesh_add_surface ( mesh , p_surfaces [ i ] ) ;
2021-02-09 13:19:03 -03:00
}
2024-03-15 14:13:31 -03:00
RSG : : scene - > mesh_generate_pipelines ( mesh , using_server_thread ) ;
2021-02-09 13:19:03 -03:00
} else {
2022-04-02 16:29:04 +11:00
command_queue . push ( RSG : : mesh_storage , & RendererMeshStorage : : mesh_initialize , mesh ) ;
command_queue . push ( RSG : : mesh_storage , & RendererMeshStorage : : mesh_set_blend_shape_count , mesh , p_blend_shape_count ) ;
2021-02-09 13:19:03 -03:00
for ( int i = 0 ; i < p_surfaces . size ( ) ; i + + ) {
2022-04-02 16:29:04 +11:00
command_queue . push ( RSG : : mesh_storage , & RendererMeshStorage : : mesh_add_surface , mesh , p_surfaces [ i ] ) ;
2021-02-09 13:19:03 -03:00
}
2024-03-15 14:13:31 -03:00
command_queue . push ( RSG : : scene , & RenderingMethod : : mesh_generate_pipelines , mesh , true ) ;
2019-08-18 19:40:52 -03:00
}
2021-02-09 13:19:03 -03:00
2019-08-18 19:40:52 -03:00
return mesh ;
}
2021-02-09 13:19:03 -03:00
FUNC2 ( mesh_set_blend_shape_count , RID , int )
2020-12-16 11:07:08 -03:00
2021-02-09 13:19:03 -03:00
FUNCRIDSPLIT ( mesh )
2014-02-09 22:10:30 -03:00
2021-02-09 13:19:03 -03:00
FUNC2 ( mesh_add_surface , RID , const SurfaceData & )
2014-02-09 22:10:30 -03:00
2021-02-09 13:19:03 -03:00
FUNC1RC ( int , mesh_get_blend_shape_count , RID )
2014-02-09 22:10:30 -03:00
2021-02-09 13:19:03 -03:00
FUNC2 ( mesh_set_blend_shape_mode , RID , BlendShapeMode )
FUNC1RC ( BlendShapeMode , mesh_get_blend_shape_mode , RID )
2014-02-09 22:10:30 -03:00
2021-06-29 22:55:11 -03:00
FUNC4 ( mesh_surface_update_vertex_region , RID , int , int , const Vector < uint8_t > & )
FUNC4 ( mesh_surface_update_attribute_region , RID , int , int , const Vector < uint8_t > & )
FUNC4 ( mesh_surface_update_skin_region , RID , int , int , const Vector < uint8_t > & )
2017-11-14 17:25:42 -03:00
2021-02-09 13:19:03 -03:00
FUNC3 ( mesh_surface_set_material , RID , int , RID )
FUNC2RC ( RID , mesh_surface_get_material , RID , int )
2014-05-29 10:56:39 -03:00
2021-02-09 13:19:03 -03:00
FUNC2RC ( SurfaceData , mesh_get_surface , RID , int )
2016-03-09 00:00:52 +01:00
2021-02-09 13:19:03 -03:00
FUNC1RC ( int , mesh_get_surface_count , RID )
2016-03-09 00:00:52 +01:00
2021-02-09 13:19:03 -03:00
FUNC2 ( mesh_set_custom_aabb , RID , const AABB & )
FUNC1RC ( AABB , mesh_get_custom_aabb , RID )
2016-03-09 00:00:52 +01:00
2023-11-14 16:27:10 +01:00
FUNC2 ( mesh_set_path , RID , const String & )
FUNC1RC ( String , mesh_get_path , RID )
2021-02-09 13:19:03 -03:00
FUNC2 ( mesh_set_shadow_mesh , RID , RID )
2021-01-25 12:20:11 -03:00
2024-11-27 12:45:05 +01:00
FUNC2 ( mesh_surface_remove , RID , int )
2021-02-09 13:19:03 -03:00
FUNC1 ( mesh_clear , RID )
2016-03-09 00:00:52 +01:00
2014-02-09 22:10:30 -03:00
/* MULTIMESH API */
2016-03-09 00:00:52 +01:00
2021-02-09 13:19:03 -03:00
FUNCRIDSPLIT ( multimesh )
2016-03-09 00:00:52 +01:00
2021-02-09 13:19:03 -03:00
FUNC5 ( multimesh_allocate_data , RID , int , MultimeshTransformFormat , bool , bool )
FUNC1RC ( int , multimesh_get_instance_count , RID )
2016-03-09 00:00:52 +01:00
2021-02-09 13:19:03 -03:00
FUNC2 ( multimesh_set_mesh , RID , RID )
2020-10-17 01:08:21 -04:00
FUNC3 ( multimesh_instance_set_transform , RID , int , const Transform3D & )
2021-02-09 13:19:03 -03:00
FUNC3 ( multimesh_instance_set_transform_2d , RID , int , const Transform2D & )
FUNC3 ( multimesh_instance_set_color , RID , int , const Color & )
FUNC3 ( multimesh_instance_set_custom_data , RID , int , const Color & )
2014-02-09 22:10:30 -03:00
2023-07-22 20:53:39 -07:00
FUNC2 ( multimesh_set_custom_aabb , RID , const AABB & )
FUNC1RC ( AABB , multimesh_get_custom_aabb , RID )
2021-02-09 13:19:03 -03:00
FUNC1RC ( RID , multimesh_get_mesh , RID )
FUNC1RC ( AABB , multimesh_get_aabb , RID )
2014-02-09 22:10:30 -03:00
2020-10-17 01:08:21 -04:00
FUNC2RC ( Transform3D , multimesh_instance_get_transform , RID , int )
2021-02-09 13:19:03 -03:00
FUNC2RC ( Transform2D , multimesh_instance_get_transform_2d , RID , int )
FUNC2RC ( Color , multimesh_instance_get_color , RID , int )
FUNC2RC ( Color , multimesh_instance_get_custom_data , RID , int )
2018-07-06 20:21:13 -03:00
2021-02-09 13:19:03 -03:00
FUNC2 ( multimesh_set_buffer , RID , const Vector < float > & )
2024-11-02 23:22:16 -05:00
FUNC1RC ( RID , multimesh_get_buffer_rd_rid , RID )
2021-02-09 13:19:03 -03:00
FUNC1RC ( Vector < float > , multimesh_get_buffer , RID )
2014-02-09 22:10:30 -03:00
2024-05-11 01:22:50 +02:00
FUNC3 ( multimesh_set_buffer_interpolated , RID , const Vector < float > & , const Vector < float > & )
FUNC2 ( multimesh_set_physics_interpolated , RID , bool )
FUNC2 ( multimesh_set_physics_interpolation_quality , RID , MultimeshPhysicsInterpolationQuality )
FUNC2 ( multimesh_instance_reset_physics_interpolation , RID , int )
2021-02-09 13:19:03 -03:00
FUNC2 ( multimesh_set_visible_instances , RID , int )
FUNC1RC ( int , multimesh_get_visible_instances , RID )
2014-02-09 22:10:30 -03:00
2016-10-03 16:33:42 -03:00
/* SKELETON API */
2014-02-09 22:10:30 -03:00
2021-02-09 13:19:03 -03:00
FUNCRIDSPLIT ( skeleton )
FUNC3 ( skeleton_allocate_data , RID , int , bool )
FUNC1RC ( int , skeleton_get_bone_count , RID )
2020-10-17 01:08:21 -04:00
FUNC3 ( skeleton_bone_set_transform , RID , int , const Transform3D & )
FUNC2RC ( Transform3D , skeleton_bone_get_transform , RID , int )
2021-02-09 13:19:03 -03:00
FUNC3 ( skeleton_bone_set_transform_2d , RID , int , const Transform2D & )
FUNC2RC ( Transform2D , skeleton_bone_get_transform_2d , RID , int )
FUNC2 ( skeleton_set_base_transform_2d , RID , const Transform2D & )
2016-03-09 00:00:52 +01:00
2014-02-09 22:10:30 -03:00
/* Light API */
2022-04-02 16:29:04 +11:00
# undef ServerName
# undef server_name
2022-04-09 19:34:31 +10:00
# define ServerName RendererLightStorage
# define server_name RSG::light_storage
2016-03-09 00:00:52 +01:00
2021-02-09 13:19:03 -03:00
FUNCRIDSPLIT ( directional_light )
FUNCRIDSPLIT ( omni_light )
FUNCRIDSPLIT ( spot_light )
2014-02-09 22:10:30 -03:00
2021-02-09 13:19:03 -03:00
FUNC2 ( light_set_color , RID , const Color & )
FUNC3 ( light_set_param , RID , LightParam , float )
FUNC2 ( light_set_shadow , RID , bool )
FUNC2 ( light_set_projector , RID , RID )
FUNC2 ( light_set_negative , RID , bool )
FUNC2 ( light_set_cull_mask , RID , uint32_t )
2022-02-24 22:55:14 +01:00
FUNC5 ( light_set_distance_fade , RID , bool , float , float , float )
2021-02-09 13:19:03 -03:00
FUNC2 ( light_set_reverse_cull_face_mode , RID , bool )
2024-08-12 00:17:11 +01:00
FUNC2 ( light_set_shadow_caster_mask , RID , uint32_t )
2021-02-09 13:19:03 -03:00
FUNC2 ( light_set_bake_mode , RID , LightBakeMode )
FUNC2 ( light_set_max_sdfgi_cascade , RID , uint32_t )
2016-03-09 00:00:52 +01:00
2021-02-09 13:19:03 -03:00
FUNC2 ( light_omni_set_shadow_mode , RID , LightOmniShadowMode )
2016-03-09 00:00:52 +01:00
2021-02-09 13:19:03 -03:00
FUNC2 ( light_directional_set_shadow_mode , RID , LightDirectionalShadowMode )
FUNC2 ( light_directional_set_blend_splits , RID , bool )
2021-10-20 00:40:46 +02:00
FUNC2 ( light_directional_set_sky_mode , RID , LightDirectionalSkyMode )
2016-03-09 00:00:52 +01:00
2016-10-03 16:33:42 -03:00
/* PROBE API */
2014-02-09 22:10:30 -03:00
2021-02-09 13:19:03 -03:00
FUNCRIDSPLIT ( reflection_probe )
FUNC2 ( reflection_probe_set_update_mode , RID , ReflectionProbeUpdateMode )
FUNC2 ( reflection_probe_set_intensity , RID , float )
2024-12-03 12:08:36 +01:00
FUNC2 ( reflection_probe_set_blend_distance , RID , float )
2021-02-09 13:19:03 -03:00
FUNC2 ( reflection_probe_set_ambient_color , RID , const Color & )
FUNC2 ( reflection_probe_set_ambient_energy , RID , float )
FUNC2 ( reflection_probe_set_ambient_mode , RID , ReflectionProbeAmbientMode )
FUNC2 ( reflection_probe_set_max_distance , RID , float )
2022-07-12 08:43:01 +01:00
FUNC2 ( reflection_probe_set_size , RID , const Vector3 & )
2021-02-09 13:19:03 -03:00
FUNC2 ( reflection_probe_set_origin_offset , RID , const Vector3 & )
FUNC2 ( reflection_probe_set_as_interior , RID , bool )
FUNC2 ( reflection_probe_set_enable_box_projection , RID , bool )
FUNC2 ( reflection_probe_set_enable_shadows , RID , bool )
FUNC2 ( reflection_probe_set_cull_mask , RID , uint32_t )
2023-12-12 13:20:41 +01:00
FUNC2 ( reflection_probe_set_reflection_mask , RID , uint32_t )
2021-02-09 13:19:03 -03:00
FUNC2 ( reflection_probe_set_resolution , RID , int )
2021-12-29 00:10:41 +01:00
FUNC2 ( reflection_probe_set_mesh_lod_threshold , RID , float )
2014-02-09 22:10:30 -03:00
2022-04-09 19:34:31 +10:00
/* LIGHTMAP */
FUNCRIDSPLIT ( lightmap )
FUNC3 ( lightmap_set_textures , RID , RID , bool )
FUNC2 ( lightmap_set_probe_bounds , RID , const AABB & )
FUNC2 ( lightmap_set_probe_interior , RID , bool )
FUNC5 ( lightmap_set_probe_capture_data , RID , const PackedVector3Array & , const PackedColorArray & , const PackedInt32Array & , const PackedInt32Array & )
2022-07-31 16:20:24 -07:00
FUNC2 ( lightmap_set_baked_exposure_normalization , RID , float )
2022-04-09 19:34:31 +10:00
FUNC1RC ( PackedVector3Array , lightmap_get_probe_capture_points , RID )
FUNC1RC ( PackedColorArray , lightmap_get_probe_capture_sh , RID )
FUNC1RC ( PackedInt32Array , lightmap_get_probe_capture_tetrahedra , RID )
FUNC1RC ( PackedInt32Array , lightmap_get_probe_capture_bsp_tree , RID )
FUNC1 ( lightmap_set_probe_capture_update_speed , float )
2023-11-30 17:14:45 +01:00
FUNC2 ( lightmap_set_shadowmask_textures , RID , RID )
FUNC1R ( ShadowmaskMode , lightmap_get_shadowmask_mode , RID )
FUNC2 ( lightmap_set_shadowmask_mode , RID , ShadowmaskMode )
2022-09-12 19:44:48 +10:00
/* Shadow Atlas */
FUNC0R ( RID , shadow_atlas_create )
FUNC3 ( shadow_atlas_set_size , RID , int , bool )
FUNC3 ( shadow_atlas_set_quadrant_subdivision , RID , int , int )
FUNC2 ( directional_shadow_atlas_set_size , int , bool )
2020-04-14 00:05:21 -03:00
/* DECAL API */
2022-03-20 22:28:24 +11:00
# undef ServerName
# undef server_name
2022-04-08 00:00:51 +10:00
# define ServerName RendererTextureStorage
# define server_name RSG::texture_storage
2022-03-20 22:28:24 +11:00
2021-02-09 13:19:03 -03:00
FUNCRIDSPLIT ( decal )
2020-04-14 00:05:21 -03:00
2022-07-12 08:43:01 +01:00
FUNC2 ( decal_set_size , RID , const Vector3 & )
2021-02-09 13:19:03 -03:00
FUNC3 ( decal_set_texture , RID , DecalTexture , RID )
FUNC2 ( decal_set_emission_energy , RID , float )
FUNC2 ( decal_set_albedo_mix , RID , float )
FUNC2 ( decal_set_modulate , RID , const Color & )
FUNC2 ( decal_set_cull_mask , RID , uint32_t )
FUNC4 ( decal_set_distance_fade , RID , bool , float , float )
FUNC3 ( decal_set_fade , RID , float , float )
FUNC2 ( decal_set_normal_fade , RID , float )
2020-04-14 00:05:21 -03:00
2016-12-20 00:21:07 -03:00
/* BAKED LIGHT API */
2014-06-11 10:41:03 -03:00
2022-03-20 22:28:24 +11:00
//from now on, calls forwarded to this singleton
# undef ServerName
# undef server_name
2022-05-20 12:52:19 +10:00
# define ServerName RendererGI
# define server_name RSG::gi
2022-03-20 22:28:24 +11:00
2021-06-04 19:47:26 -03:00
FUNCRIDSPLIT ( voxel_gi )
2014-06-11 10:41:03 -03:00
2021-06-04 19:47:26 -03:00
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 > & )
2014-10-27 22:54:32 -03:00
2021-06-04 19:47:26 -03:00
FUNC1RC ( AABB , voxel_gi_get_bounds , RID )
FUNC1RC ( Vector3i , voxel_gi_get_octree_size , RID )
FUNC1RC ( Vector < uint8_t > , voxel_gi_get_octree_cells , RID )
FUNC1RC ( Vector < uint8_t > , voxel_gi_get_data_cells , RID )
FUNC1RC ( Vector < uint8_t > , voxel_gi_get_distance_field , RID )
FUNC1RC ( Vector < int > , voxel_gi_get_level_counts , RID )
FUNC1RC ( Transform3D , voxel_gi_get_to_cell_xform , RID )
2014-08-14 10:31:38 -03:00
2021-06-04 19:47:26 -03:00
FUNC2 ( voxel_gi_set_dynamic_range , RID , float )
FUNC2 ( voxel_gi_set_propagation , RID , float )
FUNC2 ( voxel_gi_set_energy , RID , float )
2022-07-31 16:20:24 -07:00
FUNC2 ( voxel_gi_set_baked_exposure_normalization , RID , float )
2021-06-04 19:47:26 -03:00
FUNC2 ( voxel_gi_set_bias , RID , float )
FUNC2 ( voxel_gi_set_normal_bias , RID , float )
FUNC2 ( voxel_gi_set_interior , RID , bool )
FUNC2 ( voxel_gi_set_use_two_bounces , RID , bool )
2014-10-27 22:54:32 -03:00
2023-08-30 16:25:27 +03:00
FUNC0 ( sdfgi_reset )
2016-12-30 08:35:54 -03:00
/* PARTICLES */
2014-10-27 22:54:32 -03:00
2022-04-12 21:41:50 +10:00
# undef ServerName
# undef server_name
# define ServerName RendererParticlesStorage
# define server_name RSG::particles_storage
2021-02-09 13:19:03 -03:00
FUNCRIDSPLIT ( particles )
2021-05-10 13:12:44 -03:00
FUNC2 ( particles_set_mode , RID , ParticlesMode )
2021-02-09 13:19:03 -03:00
FUNC2 ( particles_set_emitting , RID , bool )
FUNC1R ( bool , particles_get_emitting , RID )
FUNC2 ( particles_set_amount , RID , int )
2023-08-13 13:08:52 +02:00
FUNC2 ( particles_set_amount_ratio , RID , float )
2021-02-01 21:16:37 -05:00
FUNC2 ( particles_set_lifetime , RID , double )
2021-02-09 13:19:03 -03:00
FUNC2 ( particles_set_one_shot , RID , bool )
2021-02-01 21:16:37 -05:00
FUNC2 ( particles_set_pre_process_time , RID , double )
2024-05-18 18:13:57 +02:00
FUNC2 ( particles_request_process_time , RID , real_t )
2021-02-09 13:19:03 -03:00
FUNC2 ( particles_set_explosiveness_ratio , RID , float )
FUNC2 ( particles_set_randomness_ratio , RID , float )
2024-05-18 18:13:57 +02:00
FUNC2 ( particles_set_seed , RID , uint32_t )
2021-02-09 13:19:03 -03:00
FUNC2 ( particles_set_custom_aabb , RID , const AABB & )
2021-02-01 21:16:37 -05:00
FUNC2 ( particles_set_speed_scale , RID , double )
2021-02-09 13:19:03 -03:00
FUNC2 ( particles_set_use_local_coordinates , RID , bool )
FUNC2 ( particles_set_process_material , RID , RID )
FUNC2 ( particles_set_fixed_fps , RID , int )
2021-04-27 12:43:49 -03:00
FUNC2 ( particles_set_interpolate , RID , bool )
2021-02-09 13:19:03 -03:00
FUNC2 ( particles_set_fractional_delta , RID , bool )
FUNC1R ( bool , particles_is_inactive , RID )
2021-04-27 12:43:49 -03:00
FUNC3 ( particles_set_trails , RID , bool , float )
2020-10-17 01:08:21 -04:00
FUNC2 ( particles_set_trail_bind_poses , RID , const Vector < Transform3D > & )
2021-04-27 12:43:49 -03:00
2021-02-09 13:19:03 -03:00
FUNC1 ( particles_request_process , RID )
FUNC1 ( particles_restart , RID )
2020-10-17 01:08:21 -04:00
FUNC6 ( particles_emit , RID , const Transform3D & , const Vector3 & , const Color & , const Color & , uint32_t )
2021-02-09 13:19:03 -03:00
FUNC2 ( particles_set_subemitter , RID , RID )
FUNC2 ( particles_set_collision_base_size , RID , float )
2021-04-27 12:43:49 -03:00
FUNC2 ( particles_set_transform_align , RID , RS : : ParticlesTransformAlign )
2021-02-09 13:19:03 -03:00
FUNC2 ( particles_set_draw_order , RID , RS : : ParticlesDrawOrder )
FUNC2 ( particles_set_draw_passes , RID , int )
FUNC3 ( particles_set_draw_pass_mesh , RID , int , RID )
FUNC1R ( AABB , particles_get_current_aabb , RID )
2020-10-17 01:08:21 -04:00
FUNC2 ( particles_set_emission_transform , RID , const Transform3D & )
2023-08-13 13:08:52 +02:00
FUNC2 ( particles_set_emitter_velocity , RID , const Vector3 & )
FUNC2 ( particles_set_interp_to_end , RID , float )
2014-02-09 22:10:30 -03:00
2020-10-07 21:29:49 -03:00
/* PARTICLES COLLISION */
2021-02-09 13:19:03 -03:00
FUNCRIDSPLIT ( particles_collision )
FUNC2 ( particles_collision_set_collision_type , RID , ParticlesCollisionType )
FUNC2 ( particles_collision_set_cull_mask , RID , uint32_t )
2021-08-12 09:07:47 -05:00
FUNC2 ( particles_collision_set_sphere_radius , RID , real_t )
2021-02-09 13:19:03 -03:00
FUNC2 ( particles_collision_set_box_extents , RID , const Vector3 & )
2021-08-12 09:07:47 -05:00
FUNC2 ( particles_collision_set_attractor_strength , RID , real_t )
FUNC2 ( particles_collision_set_attractor_directionality , RID , real_t )
FUNC2 ( particles_collision_set_attractor_attenuation , RID , real_t )
2021-02-09 13:19:03 -03:00
FUNC2 ( particles_collision_set_field_texture , RID , RID )
FUNC1 ( particles_collision_height_field_update , RID )
FUNC2 ( particles_collision_set_height_field_resolution , RID , ParticlesCollisionHeightfieldResolution )
2021-10-03 04:28:55 -07:00
/* FOG VOLUME */
2022-04-12 21:41:50 +10:00
# undef ServerName
# undef server_name
2022-06-21 10:08:33 +10:00
# define ServerName RendererFog
# define server_name RSG::fog
2022-04-12 21:41:50 +10:00
2021-10-03 04:28:55 -07:00
FUNCRIDSPLIT ( fog_volume )
FUNC2 ( fog_volume_set_shape , RID , FogVolumeShape )
2022-07-12 08:43:01 +01:00
FUNC2 ( fog_volume_set_size , RID , const Vector3 & )
2021-10-03 04:28:55 -07:00
FUNC2 ( fog_volume_set_material , RID , RID )
2021-06-16 15:43:02 -03:00
/* VISIBILITY_NOTIFIER */
2022-06-21 10:08:33 +10:00
# undef ServerName
# undef server_name
# define ServerName RendererUtilities
# define server_name RSG::utilities
2021-06-16 15:43:02 -03:00
FUNCRIDSPLIT ( visibility_notifier )
FUNC2 ( visibility_notifier_set_aabb , RID , const AABB & )
FUNC3 ( visibility_notifier_set_callbacks , RID , const Callable & , const Callable & )
2021-02-09 13:19:03 -03:00
# undef server_name
# undef ServerName
2016-10-19 11:14:41 -03:00
//from now on, calls forwarded to this singleton
2022-09-07 17:44:36 -07:00
# define ServerName RenderingMethod
2021-02-09 13:19:03 -03:00
# define server_name RSG::scene
2014-02-09 22:10:30 -03:00
2016-12-20 00:21:07 -03:00
/* CAMERA API */
2014-02-09 22:10:30 -03:00
2021-02-09 13:19:03 -03:00
FUNCRIDSPLIT ( camera )
FUNC4 ( camera_set_perspective , RID , float , float , float )
FUNC4 ( camera_set_orthogonal , RID , float , float , float )
FUNC5 ( camera_set_frustum , RID , float , Vector2 , float , float )
2020-10-17 01:08:21 -04:00
FUNC2 ( camera_set_transform , RID , const Transform3D & )
2021-02-09 13:19:03 -03:00
FUNC2 ( camera_set_cull_mask , RID , uint32_t )
FUNC2 ( camera_set_environment , RID , RID )
2022-07-31 16:20:24 -07:00
FUNC2 ( camera_set_camera_attributes , RID , RID )
2023-08-03 22:10:03 +10:00
FUNC2 ( camera_set_compositor , RID , RID )
2021-02-09 13:19:03 -03:00
FUNC2 ( camera_set_use_vertical_aspect , RID , bool )
2021-04-20 18:40:24 +02:00
/* OCCLUDER */
FUNCRIDSPLIT ( occluder )
2021-06-16 15:43:02 -03:00
FUNC3 ( occluder_set_mesh , RID , const PackedVector3Array & , const PackedInt32Array & )
2021-04-20 18:40:24 +02:00
2021-02-09 13:19:03 -03:00
# undef server_name
# undef ServerName
2016-10-03 23:46:24 -03:00
//from now on, calls forwarded to this singleton
2021-02-09 13:19:03 -03:00
# define ServerName RendererViewport
# define server_name RSG::viewport
2014-02-09 22:10:30 -03:00
2016-10-03 16:33:42 -03:00
/* VIEWPORT TARGET API */
2016-03-09 00:00:52 +01:00
2021-02-09 13:19:03 -03:00
FUNCRIDSPLIT ( viewport )
2014-02-09 22:10:30 -03:00
2021-02-09 13:19:03 -03:00
FUNC2 ( viewport_set_use_xr , RID , bool )
FUNC3 ( viewport_set_size , RID , int , int )
2014-02-09 22:10:30 -03:00
2021-02-09 13:19:03 -03:00
FUNC2 ( viewport_set_active , RID , bool )
FUNC2 ( viewport_set_parent_viewport , RID , RID )
2014-02-09 22:10:30 -03:00
2021-02-09 13:19:03 -03:00
FUNC2 ( viewport_set_clear_mode , RID , ViewportClearMode )
2014-02-09 22:10:30 -03:00
2021-02-09 13:19:03 -03:00
FUNC3 ( viewport_attach_to_screen , RID , const Rect2 & , int )
FUNC2 ( viewport_set_render_direct_to_screen , RID , bool )
2014-02-09 22:10:30 -03:00
2021-11-23 14:16:03 -07:00
FUNC2 ( viewport_set_scaling_3d_mode , RID , ViewportScaling3DMode )
FUNC2 ( viewport_set_scaling_3d_scale , RID , float )
FUNC2 ( viewport_set_fsr_sharpness , RID , float )
2022-06-12 01:49:59 +02:00
FUNC2 ( viewport_set_texture_mipmap_bias , RID , float )
2024-11-30 00:50:45 -03:00
FUNC2 ( viewport_set_anisotropic_filtering_level , RID , ViewportAnisotropicFiltering )
2021-11-23 14:16:03 -07:00
2021-02-09 13:19:03 -03:00
FUNC2 ( viewport_set_update_mode , RID , ViewportUpdateMode )
2024-03-25 08:07:28 -05:00
FUNC1RC ( ViewportUpdateMode , viewport_get_update_mode , RID )
2014-02-09 22:10:30 -03:00
2023-03-31 11:28:53 +11:00
FUNC1RC ( RID , viewport_get_render_target , RID )
2021-02-09 13:19:03 -03:00
FUNC1RC ( RID , viewport_get_texture , RID )
2014-02-09 22:10:30 -03:00
2021-06-30 23:17:47 -03:00
FUNC2 ( viewport_set_disable_2d , RID , bool )
2023-01-29 16:04:39 -08:00
FUNC2 ( viewport_set_environment_mode , RID , ViewportEnvironmentMode )
2021-06-29 13:36:32 -03:00
FUNC2 ( viewport_set_disable_3d , RID , bool )
2014-02-09 22:10:30 -03:00
2021-09-02 20:07:04 +02:00
FUNC2 ( viewport_set_canvas_cull_mask , RID , uint32_t )
2021-02-09 13:19:03 -03:00
FUNC2 ( viewport_attach_camera , RID , RID )
FUNC2 ( viewport_set_scenario , RID , RID )
FUNC2 ( viewport_attach_canvas , RID , RID )
2016-03-09 00:00:52 +01:00
2021-02-09 13:19:03 -03:00
FUNC2 ( viewport_remove_canvas , RID , RID )
FUNC3 ( viewport_set_canvas_transform , RID , RID , const Transform2D & )
FUNC2 ( viewport_set_transparent_background , RID , bool )
2023-08-03 14:10:01 +02:00
FUNC2 ( viewport_set_use_hdr_2d , RID , bool )
2024-05-28 15:13:24 -07:00
FUNC1RC ( bool , viewport_is_using_hdr_2d , RID )
2021-02-09 13:19:03 -03:00
FUNC2 ( viewport_set_snap_2d_transforms_to_pixel , RID , bool )
FUNC2 ( viewport_set_snap_2d_vertices_to_pixel , RID , bool )
2016-03-09 00:00:52 +01:00
2021-02-09 13:19:03 -03:00
FUNC2 ( viewport_set_default_canvas_item_texture_filter , RID , CanvasItemTextureFilter )
FUNC2 ( viewport_set_default_canvas_item_texture_repeat , RID , CanvasItemTextureRepeat )
2020-10-24 12:15:43 -03:00
2021-02-09 13:19:03 -03:00
FUNC2 ( viewport_set_global_canvas_transform , RID , const Transform2D & )
FUNC4 ( viewport_set_canvas_stacking , RID , RID , int , int )
2022-05-01 01:40:30 +02:00
FUNC3 ( viewport_set_positional_shadow_atlas_size , RID , int , bool )
2021-02-09 13:19:03 -03:00
FUNC3 ( viewport_set_sdf_oversize_and_scale , RID , ViewportSDFOversize , ViewportSDFScale )
2022-05-01 01:40:30 +02:00
FUNC3 ( viewport_set_positional_shadow_atlas_quadrant_subdivision , RID , int , int )
2022-08-13 01:02:32 +02:00
FUNC2 ( viewport_set_msaa_2d , RID , ViewportMSAA )
FUNC2 ( viewport_set_msaa_3d , RID , ViewportMSAA )
2021-02-09 13:19:03 -03:00
FUNC2 ( viewport_set_screen_space_aa , RID , ViewportScreenSpaceAA )
2022-04-04 16:10:22 +02:00
FUNC2 ( viewport_set_use_taa , RID , bool )
2021-02-09 13:19:03 -03:00
FUNC2 ( viewport_set_use_debanding , RID , bool )
2024-12-10 13:40:47 -06:00
FUNC2 ( viewport_set_force_motion_vectors , RID , bool )
2021-04-20 18:40:24 +02:00
FUNC2 ( viewport_set_use_occlusion_culling , RID , bool )
FUNC1 ( viewport_set_occlusion_rays_per_thread , int )
FUNC1 ( viewport_set_occlusion_culling_build_quality , ViewportOcclusionCullingBuildQuality )
2021-12-29 00:10:41 +01:00
FUNC2 ( viewport_set_mesh_lod_threshold , RID , float )
2014-10-12 02:13:22 -03:00
2021-07-02 20:14:19 -03:00
FUNC3R ( int , viewport_get_render_info , RID , ViewportRenderInfoType , ViewportRenderInfo )
2021-02-09 13:19:03 -03:00
FUNC2 ( viewport_set_debug_draw , RID , ViewportDebugDraw )
2017-06-11 15:52:03 -03:00
2021-02-09 13:19:03 -03:00
FUNC2 ( viewport_set_measure_render_time , RID , bool )
2021-02-01 21:16:37 -05:00
FUNC1RC ( double , viewport_get_measured_render_time_cpu , RID )
FUNC1RC ( double , viewport_get_measured_render_time_gpu , RID )
Implement Running Godot as Movie Writer
* Allows running the game in "movie writer" mode.
* It ensures entirely stable framerate, so your run can be saved stable and with proper sound (which is impossible if your CPU/GPU can't sustain doing this in real-time).
* If disabling vsync, it can save movies faster than the game is run, but if you want to control the interaction it can get difficult.
* Implements a simple, default MJPEG writer.
This new features has two main use cases, which have high demand:
* Saving game videos in high quality and ensuring the frame rate is *completely* stable, always.
* Using Godot as a tool to make movies and animations (which is ideal if you want interaction, or creating them procedurally. No other software is as good for this).
**Note**: This feature **IS NOT** for capturing real-time footage. Use something like OBS, SimpleScreenRecorder or FRAPS to achieve that, as they do a much better job at intercepting the compositor than Godot can probably do using Vulkan or OpenGL natively. If your game runs near real-time when capturing, you can still use this feature but it will play no sound (sound will be saved directly).
Usage:
$ godot --write-movie movie.avi [scene_file.tscn]
Missing:
* Options for configuring video writing via GLOBAL_DEF
* UI Menu for launching with this mode from the editor.
* Add to list of command line options.
* Add a feature tag to override configurations when movie writing (fantastic for saving videos with highest quality settings).
2022-06-17 00:55:19 +02:00
FUNC1RC ( RID , viewport_find_from_screen_attachment , DisplayServer : : WindowID )
2021-02-09 13:19:03 -03:00
2021-06-19 17:44:59 +02:00
FUNC2 ( call_set_vsync_mode , DisplayServer : : VSyncMode , DisplayServer : : WindowID )
2020-04-10 14:18:42 -03:00
2022-02-11 22:33:54 +11:00
FUNC2 ( viewport_set_vrs_mode , RID , ViewportVRSMode )
2024-03-26 12:57:26 +11:00
FUNC2 ( viewport_set_vrs_update_mode , RID , ViewportVRSUpdateMode )
2022-02-11 22:33:54 +11:00
FUNC2 ( viewport_set_vrs_texture , RID , RID )
2023-08-03 22:10:03 +10:00
/* COMPOSITOR EFFECT */
2014-02-09 22:10:30 -03:00
2021-02-09 13:19:03 -03:00
# undef server_name
# undef ServerName
2016-10-19 11:14:41 -03:00
//from now on, calls forwarded to this singleton
2022-09-07 17:44:36 -07:00
# define ServerName RenderingMethod
2021-02-09 13:19:03 -03:00
# define server_name RSG::scene
2016-03-09 00:00:52 +01:00
2023-08-03 22:10:03 +10:00
FUNCRIDSPLIT ( compositor_effect )
FUNC2 ( compositor_effect_set_enabled , RID , bool )
FUNC3 ( compositor_effect_set_callback , RID , CompositorEffectCallbackType , const Callable & )
FUNC3 ( compositor_effect_set_flag , RID , CompositorEffectFlags , bool )
/* COMPOSITOR */
FUNC2 ( compositor_set_compositor_effects , RID , const TypedArray < RID > & )
FUNCRIDSPLIT ( compositor )
/* ENVIRONMENT API */
2021-06-04 19:47:26 -03:00
FUNC1 ( voxel_gi_set_quality , VoxelGIQuality )
2019-09-06 22:51:27 -03:00
2019-08-26 17:43:58 -03:00
/* SKY API */
2021-02-09 13:19:03 -03:00
FUNCRIDSPLIT ( sky )
FUNC2 ( sky_set_radiance_size , RID , int )
FUNC2 ( sky_set_mode , RID , SkyMode )
FUNC2 ( sky_set_material , RID , RID )
FUNC4R ( Ref < Image > , sky_bake_panorama , RID , float , bool , const Size2i & )
2019-08-26 17:43:58 -03:00
2023-08-03 22:10:03 +10:00
/* ENVIRONMENT */
2021-02-09 13:19:03 -03:00
FUNCRIDSPLIT ( environment )
2014-02-09 22:10:30 -03:00
2021-02-09 13:19:03 -03:00
FUNC2 ( environment_set_background , RID , EnvironmentBG )
FUNC2 ( environment_set_sky , RID , RID )
FUNC2 ( environment_set_sky_custom_fov , RID , float )
FUNC2 ( environment_set_sky_orientation , RID , const Basis & )
FUNC2 ( environment_set_bg_color , RID , const Color & )
2022-07-31 16:20:24 -07:00
FUNC3 ( environment_set_bg_energy , RID , float , float )
2021-02-09 13:19:03 -03:00
FUNC2 ( environment_set_canvas_max_layer , RID , int )
2021-10-07 15:01:14 +02:00
FUNC6 ( environment_set_ambient_light , RID , const Color & , EnvironmentAmbientSource , float , float , EnvironmentReflectionSource )
2019-08-26 17:43:58 -03:00
2021-02-09 13:19:03 -03:00
FUNC2 ( environment_set_camera_feed_id , RID , int )
2024-03-17 20:44:47 +01:00
2021-02-09 13:19:03 -03:00
FUNC6 ( environment_set_ssr , RID , bool , int , float , float , float )
FUNC1 ( environment_set_ssr_roughness_quality , EnvironmentSSRRoughnessQuality )
2020-04-01 23:24:52 -03:00
2021-02-09 13:19:03 -03:00
FUNC10 ( environment_set_ssao , RID , bool , float , float , float , float , float , float , float , float )
FUNC6 ( environment_set_ssao_quality , EnvironmentSSAOQuality , bool , float , int , float , float )
2014-02-09 22:10:30 -03:00
2021-08-03 00:07:32 -07:00
FUNC6 ( environment_set_ssil , RID , bool , float , float , float , float )
FUNC6 ( environment_set_ssil_quality , EnvironmentSSILQuality , bool , float , int , float , float )
2022-01-20 16:47:25 +01:00
FUNC13 ( environment_set_glow , RID , bool , Vector < float > , float , float , float , float , EnvironmentGlowBlendMode , float , float , float , float , RID )
2021-02-09 13:19:03 -03:00
FUNC1 ( environment_glow_set_use_bicubic_upscale , bool )
2014-02-09 22:10:30 -03:00
2022-07-31 16:20:24 -07:00
FUNC4 ( environment_set_tonemap , RID , EnvironmentToneMapper , float , float )
2014-02-09 22:10:30 -03:00
2021-02-09 13:19:03 -03:00
FUNC7 ( environment_set_adjustment , RID , bool , float , float , float , bool , RID )
2014-02-09 22:10:30 -03:00
2022-09-18 00:31:43 -05:00
FUNC11 ( environment_set_fog , RID , bool , const Color & , float , float , float , float , float , float , float , EnvironmentFogMode )
FUNC4 ( environment_set_fog_depth , RID , float , float , float )
2022-02-23 23:54:06 +01:00
FUNC14 ( environment_set_volumetric_fog , RID , bool , float , const Color & , const Color & , float , float , float , float , float , bool , float , float , float )
2020-08-12 22:21:01 -03:00
2021-02-09 13:19:03 -03:00
FUNC2 ( environment_set_volumetric_fog_volume_size , int , int )
FUNC1 ( environment_set_volumetric_fog_filter_active , bool )
2017-06-06 23:16:17 -03:00
2022-01-13 19:46:14 +01:00
FUNC11 ( environment_set_sdfgi , RID , bool , int , float , EnvironmentSDFGIYScale , bool , float , bool , float , float , float )
2021-02-09 13:19:03 -03:00
FUNC1 ( environment_set_sdfgi_ray_count , EnvironmentSDFGIRayCount )
FUNC1 ( environment_set_sdfgi_frames_to_converge , EnvironmentSDFGIFramesToConverge )
FUNC1 ( environment_set_sdfgi_frames_to_update_light , EnvironmentSDFGIFramesToUpdateLight )
2020-06-25 10:33:28 -03:00
2021-02-09 13:19:03 -03:00
FUNC3R ( Ref < Image > , environment_bake_panorama , RID , bool , const Size2i & )
2020-05-01 09:34:23 -03:00
2021-02-09 13:19:03 -03:00
FUNC3 ( screen_space_roughness_limiter_set_active , bool , float , float )
FUNC1 ( sub_surface_scattering_set_quality , SubSurfaceScatteringQuality )
FUNC2 ( sub_surface_scattering_set_scale , float , float )
2020-01-26 20:09:40 -03:00
2022-05-01 01:40:30 +02:00
FUNC1 ( positional_soft_shadow_filter_set_quality , ShadowQuality ) ;
FUNC1 ( directional_soft_shadow_filter_set_quality , ShadowQuality ) ;
2021-07-19 16:41:55 -03:00
FUNC1 ( decals_set_filter , RS : : DecalFilter ) ;
FUNC1 ( light_projectors_set_filter , RS : : LightProjectorFilter ) ;
2024-03-25 17:48:03 +01:00
FUNC1 ( lightmaps_set_bicubic_filter , bool ) ;
2020-04-07 22:51:52 -03:00
2022-07-31 16:20:24 -07:00
/* CAMERA ATTRIBUTES */
# undef server_name
# undef ServerName
//from now on, calls forwarded to this singleton
# define ServerName RendererCameraAttributes
# define server_name RSG::camera_attributes
FUNCRIDSPLIT ( camera_attributes )
FUNC2 ( camera_attributes_set_dof_blur_quality , DOFBlurQuality , bool )
FUNC1 ( camera_attributes_set_dof_blur_bokeh_shape , DOFBokehShape )
FUNC8 ( camera_attributes_set_dof_blur , RID , bool , float , float , bool , float , float , float )
FUNC3 ( camera_attributes_set_exposure , RID , float , float )
FUNC6 ( camera_attributes_set_auto_exposure , RID , bool , float , float , float , float )
2017-12-06 21:36:34 +01:00
/* SCENARIO API */
2016-05-27 14:18:40 -03:00
2021-02-09 13:19:03 -03:00
# undef server_name
# undef ServerName
2022-09-07 17:44:36 -07:00
# define ServerName RenderingMethod
2021-02-09 13:19:03 -03:00
# define server_name RSG::scene
2016-05-27 14:18:40 -03:00
2021-02-09 13:19:03 -03:00
FUNCRIDSPLIT ( scenario )
2014-02-09 22:10:30 -03:00
2021-02-09 13:19:03 -03:00
FUNC2 ( scenario_set_environment , RID , RID )
2022-07-31 16:20:24 -07:00
FUNC2 ( scenario_set_camera_attributes , RID , RID )
2021-02-09 13:19:03 -03:00
FUNC2 ( scenario_set_fallback_environment , RID , RID )
2023-08-03 22:10:03 +10:00
FUNC2 ( scenario_set_compositor , RID , RID )
2014-02-09 22:10:30 -03:00
/* INSTANCING API */
2021-02-09 13:19:03 -03:00
FUNCRIDSPLIT ( instance )
2017-01-04 01:16:14 -03:00
2021-02-09 13:19:03 -03:00
FUNC2 ( instance_set_base , RID , RID )
FUNC2 ( instance_set_scenario , RID , RID )
FUNC2 ( instance_set_layer_mask , RID , uint32_t )
2022-12-13 15:13:16 +11:00
FUNC3 ( instance_set_pivot_data , RID , float , bool )
2020-10-17 01:08:21 -04:00
FUNC2 ( instance_set_transform , RID , const Transform3D & )
2024-05-26 19:39:28 +02:00
FUNC2 ( instance_set_interpolated , RID , bool )
FUNC1 ( instance_reset_physics_interpolation , RID )
2021-02-09 13:19:03 -03:00
FUNC2 ( instance_attach_object_instance_id , RID , ObjectID )
FUNC3 ( instance_set_blend_shape_weight , RID , int , float )
2021-04-13 20:45:16 -07:00
FUNC3 ( instance_set_surface_override_material , RID , int , RID )
2021-02-09 13:19:03 -03:00
FUNC2 ( instance_set_visible , RID , bool )
2014-02-09 22:10:30 -03:00
2021-02-09 13:19:03 -03:00
FUNC2 ( instance_set_custom_aabb , RID , AABB )
2017-11-20 20:54:26 +01:00
2021-02-09 13:19:03 -03:00
FUNC2 ( instance_attach_skeleton , RID , RID )
2014-02-09 22:10:30 -03:00
2021-02-09 13:19:03 -03:00
FUNC2 ( instance_set_extra_visibility_margin , RID , real_t )
2021-05-09 18:23:20 +02:00
FUNC2 ( instance_set_visibility_parent , RID , RID )
2016-03-07 23:00:55 +00:00
2021-10-03 04:28:55 -07:00
FUNC2 ( instance_set_ignore_culling , RID , bool )
2016-10-03 16:33:42 -03:00
// don't use these in a game!
2021-02-09 13:19:03 -03:00
FUNC2RC ( Vector < ObjectID > , instances_cull_aabb , const AABB & , RID )
FUNC3RC ( Vector < ObjectID > , instances_cull_ray , const Vector3 & , const Vector3 & , RID )
FUNC2RC ( Vector < ObjectID > , instances_cull_convex , const Vector < Plane > & , RID )
2014-06-11 10:41:03 -03:00
2021-02-09 13:19:03 -03:00
FUNC3 ( instance_geometry_set_flag , RID , InstanceFlags , bool )
FUNC2 ( instance_geometry_set_cast_shadows_setting , RID , ShadowCastingSetting )
FUNC2 ( instance_geometry_set_material_override , RID , RID )
2021-09-25 19:40:26 +01:00
FUNC2 ( instance_geometry_set_material_overlay , RID , RID )
2014-10-27 22:54:32 -03:00
2021-07-20 15:17:34 -03:00
FUNC6 ( instance_geometry_set_visibility_range , RID , float , float , float , float , VisibilityRangeFadeMode )
2021-02-09 13:19:03 -03:00
FUNC4 ( instance_geometry_set_lightmap , RID , RID , const Rect2 & , int )
FUNC2 ( instance_geometry_set_lod_bias , RID , float )
2021-07-20 15:17:34 -03:00
FUNC2 ( instance_geometry_set_transparency , RID , float )
2022-08-27 12:22:43 +03:00
FUNC3 ( instance_geometry_set_shader_parameter , RID , const StringName & , const Variant & )
FUNC2RC ( Variant , instance_geometry_get_shader_parameter , RID , const StringName & )
FUNC2RC ( Variant , instance_geometry_get_shader_parameter_default_value , RID , const StringName & )
FUNC2C ( instance_geometry_get_shader_parameter_list , RID , List < PropertyInfo > * )
2020-04-16 23:52:00 -03:00
2022-08-31 19:24:04 +02:00
FUNC3R ( TypedArray < Image > , bake_render_uv2 , RID , const TypedArray < RID > & , const Size2i & )
2020-05-01 09:34:23 -03:00
2021-02-09 13:19:03 -03:00
FUNC1 ( gi_set_use_half_resolution , bool )
2021-01-22 20:50:24 -03:00
2021-02-09 13:19:03 -03:00
# undef server_name
# undef ServerName
2016-10-03 23:46:24 -03:00
//from now on, calls forwarded to this singleton
2021-02-09 13:19:03 -03:00
# define ServerName RendererCanvasCull
# define server_name RSG::canvas
2014-06-11 10:41:03 -03:00
2014-02-09 22:10:30 -03:00
/* CANVAS (2D) */
2016-03-09 00:00:52 +01:00
2021-02-09 13:19:03 -03:00
FUNCRIDSPLIT ( canvas )
FUNC3 ( canvas_set_item_mirroring , RID , RID , const Point2 & )
2024-01-17 12:09:52 -05:00
FUNC3 ( canvas_set_item_repeat , RID , const Point2 & , int )
2021-02-09 13:19:03 -03:00
FUNC2 ( canvas_set_modulate , RID , const Color & )
FUNC3 ( canvas_set_parent , RID , RID , float )
FUNC1 ( canvas_set_disable_scale , bool )
FUNCRIDSPLIT ( canvas_texture )
FUNC3 ( canvas_texture_set_channel , RID , CanvasTextureChannel , RID )
FUNC3 ( canvas_texture_set_shading_parameters , RID , const Color & , float )
FUNC2 ( canvas_texture_set_texture_filter , RID , CanvasItemTextureFilter )
FUNC2 ( canvas_texture_set_texture_repeat , RID , CanvasItemTextureRepeat )
FUNCRIDSPLIT ( canvas_item )
FUNC2 ( canvas_item_set_parent , RID , RID )
FUNC2 ( canvas_item_set_default_texture_filter , RID , CanvasItemTextureFilter )
FUNC2 ( canvas_item_set_default_texture_repeat , RID , CanvasItemTextureRepeat )
FUNC2 ( canvas_item_set_visible , RID , bool )
FUNC2 ( canvas_item_set_light_mask , RID , int )
2021-09-02 20:07:04 +02:00
FUNC2 ( canvas_item_set_visibility_layer , RID , uint32_t )
2021-02-09 13:19:03 -03:00
FUNC2 ( canvas_item_set_update_when_visible , RID , bool )
FUNC2 ( canvas_item_set_transform , RID , const Transform2D & )
FUNC2 ( canvas_item_set_clip , RID , bool )
FUNC2 ( canvas_item_set_distance_field_mode , RID , bool )
FUNC3 ( canvas_item_set_custom_rect , RID , bool , const Rect2 & )
FUNC2 ( canvas_item_set_modulate , RID , const Color & )
FUNC2 ( canvas_item_set_self_modulate , RID , const Color & )
FUNC2 ( canvas_item_set_draw_behind_parent , RID , bool )
2022-04-11 20:42:46 +03:00
FUNC6 ( canvas_item_add_line , RID , const Point2 & , const Point2 & , const Color & , float , bool )
2021-02-09 13:19:03 -03:00
FUNC5 ( canvas_item_add_polyline , RID , const Vector < Point2 > & , const Vector < Color > & , float , bool )
2024-05-09 19:36:30 +08:00
FUNC5 ( canvas_item_add_multiline , RID , const Vector < Point2 > & , const Vector < Color > & , float , bool )
FUNC4 ( canvas_item_add_rect , RID , const Rect2 & , const Color & , bool )
FUNC5 ( canvas_item_add_circle , RID , const Point2 & , float , const Color & , bool )
2021-02-09 13:19:03 -03:00
FUNC6 ( canvas_item_add_texture_rect , RID , const Rect2 & , RID , bool , const Color & , bool )
FUNC7 ( canvas_item_add_texture_rect_region , RID , const Rect2 & , RID , const Rect2 & , const Color & , bool , bool )
2022-12-17 22:47:33 +02:00
FUNC8 ( canvas_item_add_msdf_texture_rect_region , RID , const Rect2 & , RID , const Rect2 & , const Color & , int , float , float )
2022-08-12 14:03:28 +03:00
FUNC5 ( canvas_item_add_lcd_texture_rect_region , RID , const Rect2 & , RID , const Rect2 & , const Color & )
2021-02-09 13:19:03 -03:00
FUNC10 ( canvas_item_add_nine_patch , RID , const Rect2 & , const Rect2 & , RID , const Vector2 & , const Vector2 & , NinePatchAxisMode , NinePatchAxisMode , bool , const Color & )
2023-01-14 08:28:55 +03:00
FUNC5 ( canvas_item_add_primitive , RID , const Vector < Point2 > & , const Vector < Color > & , const Vector < Point2 > & , RID )
2021-02-09 13:19:03 -03:00
FUNC5 ( canvas_item_add_polygon , RID , const Vector < Point2 > & , const Vector < Color > & , const Vector < Point2 > & , RID )
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 )
FUNC5 ( canvas_item_add_mesh , RID , const RID & , const Transform2D & , const Color & , RID )
FUNC3 ( canvas_item_add_multimesh , RID , RID , RID )
FUNC3 ( canvas_item_add_particles , RID , RID , RID )
FUNC2 ( canvas_item_add_set_transform , RID , const Transform2D & )
FUNC2 ( canvas_item_add_clip_ignore , RID , bool )
2021-06-17 11:30:20 -03:00
FUNC5 ( canvas_item_add_animation_slice , RID , double , double , double , double )
2021-02-09 13:19:03 -03:00
FUNC2 ( canvas_item_set_sort_children_by_y , RID , bool )
FUNC2 ( canvas_item_set_z_index , RID , int )
FUNC2 ( canvas_item_set_z_as_relative_to_parent , RID , bool )
FUNC3 ( canvas_item_set_copy_to_backbuffer , RID , bool , const Rect2 & )
FUNC2 ( canvas_item_attach_skeleton , RID , RID )
FUNC1 ( canvas_item_clear , RID )
FUNC2 ( canvas_item_set_draw_index , RID , int )
FUNC2 ( canvas_item_set_material , RID , RID )
2023-05-29 00:23:00 +02:00
FUNC3 ( canvas_item_set_instance_shader_parameter , RID , const StringName & , const Variant & )
FUNC2RC ( Variant , canvas_item_get_instance_shader_parameter , RID , const StringName & )
FUNC2RC ( Variant , canvas_item_get_instance_shader_parameter_default_value , RID , const StringName & )
FUNC2C ( canvas_item_get_instance_shader_parameter_list , RID , List < PropertyInfo > * )
2021-02-09 13:19:03 -03:00
FUNC2 ( canvas_item_set_use_parent_material , RID , bool )
2021-06-15 17:33:24 -03:00
FUNC5 ( canvas_item_set_visibility_notifier , RID , bool , const Rect2 & , const Callable & , const Callable & )
2021-02-09 13:19:03 -03:00
FUNC6 ( canvas_item_set_canvas_group_mode , RID , CanvasGroupMode , float , bool , float , bool )
2023-07-07 19:35:54 +02:00
FUNC1 ( canvas_item_set_debug_redraw , bool )
2023-10-11 13:21:29 +02:00
FUNC0RC ( bool , canvas_item_get_debug_redraw )
2023-07-07 19:35:54 +02:00
2024-02-17 00:57:32 +01:00
FUNC2 ( canvas_item_set_interpolated , RID , bool )
FUNC1 ( canvas_item_reset_physics_interpolation , RID )
FUNC2 ( canvas_item_transform_physics_interpolation , RID , const Transform2D & )
2021-02-09 13:19:03 -03:00
FUNCRIDSPLIT ( canvas_light )
FUNC2 ( canvas_light_set_mode , RID , CanvasLightMode )
FUNC2 ( canvas_light_attach_to_canvas , RID , RID )
FUNC2 ( canvas_light_set_enabled , RID , bool )
FUNC2 ( canvas_light_set_texture_scale , RID , float )
FUNC2 ( canvas_light_set_transform , RID , const Transform2D & )
FUNC2 ( canvas_light_set_texture , RID , RID )
FUNC2 ( canvas_light_set_texture_offset , RID , const Vector2 & )
FUNC2 ( canvas_light_set_color , RID , const Color & )
FUNC2 ( canvas_light_set_height , RID , float )
FUNC2 ( canvas_light_set_energy , RID , float )
FUNC3 ( canvas_light_set_z_range , RID , int , int )
FUNC3 ( canvas_light_set_layer_range , RID , int , int )
FUNC2 ( canvas_light_set_item_cull_mask , RID , int )
FUNC2 ( canvas_light_set_item_shadow_cull_mask , RID , int )
FUNC2 ( canvas_light_set_directional_distance , RID , float )
FUNC2 ( canvas_light_set_blend_mode , RID , CanvasLightBlendMode )
FUNC2 ( canvas_light_set_shadow_enabled , RID , bool )
FUNC2 ( canvas_light_set_shadow_filter , RID , CanvasLightShadowFilter )
FUNC2 ( canvas_light_set_shadow_color , RID , const Color & )
FUNC2 ( canvas_light_set_shadow_smooth , RID , float )
2024-02-17 00:57:32 +01:00
FUNC2 ( canvas_light_set_interpolated , RID , bool )
FUNC1 ( canvas_light_reset_physics_interpolation , RID )
FUNC2 ( canvas_light_transform_physics_interpolation , RID , const Transform2D & )
2021-02-09 13:19:03 -03:00
FUNCRIDSPLIT ( canvas_light_occluder )
FUNC2 ( canvas_light_occluder_attach_to_canvas , RID , RID )
FUNC2 ( canvas_light_occluder_set_enabled , RID , bool )
FUNC2 ( canvas_light_occluder_set_polygon , RID , RID )
FUNC2 ( canvas_light_occluder_set_as_sdf_collision , RID , bool )
FUNC2 ( canvas_light_occluder_set_transform , RID , const Transform2D & )
FUNC2 ( canvas_light_occluder_set_light_mask , RID , int )
2024-02-17 00:57:32 +01:00
FUNC2 ( canvas_light_occluder_set_interpolated , RID , bool )
FUNC1 ( canvas_light_occluder_reset_physics_interpolation , RID )
FUNC2 ( canvas_light_occluder_transform_physics_interpolation , RID , const Transform2D & )
2021-02-09 13:19:03 -03:00
FUNCRIDSPLIT ( canvas_occluder_polygon )
FUNC3 ( canvas_occluder_polygon_set_shape , RID , const Vector < Vector2 > & , bool )
FUNC2 ( canvas_occluder_polygon_set_cull_mode , RID , CanvasOccluderPolygonCullMode )
FUNC1 ( canvas_set_shadow_texture_size , int )
2020-10-24 12:15:43 -03:00
2023-11-04 22:09:33 +08:00
FUNC1R ( Rect2 , _debug_canvas_item_get_rect , RID )
2022-04-03 18:56:43 +02:00
/* GLOBAL SHADER UNIFORMS */
2020-04-16 23:52:00 -03:00
2021-02-09 13:19:03 -03:00
# undef server_name
# undef ServerName
2020-04-16 23:52:00 -03:00
//from now on, calls forwarded to this singleton
2022-03-21 22:25:25 +11:00
# define ServerName RendererMaterialStorage
# define server_name RSG::material_storage
2020-04-16 23:52:00 -03:00
2022-08-27 12:22:43 +03:00
FUNC3 ( global_shader_parameter_add , const StringName & , GlobalShaderParameterType , const Variant & )
FUNC1 ( global_shader_parameter_remove , const StringName & )
FUNC0RC ( Vector < StringName > , global_shader_parameter_get_list )
FUNC2 ( global_shader_parameter_set , const StringName & , const Variant & )
FUNC2 ( global_shader_parameter_set_override , const StringName & , const Variant & )
FUNC1RC ( GlobalShaderParameterType , global_shader_parameter_get_type , const StringName & )
FUNC1RC ( Variant , global_shader_parameter_get , const StringName & )
2020-04-16 23:52:00 -03:00
2022-08-27 12:22:43 +03:00
FUNC1 ( global_shader_parameters_load_settings , bool )
FUNC0 ( global_shader_parameters_clear )
2021-02-09 13:19:03 -03:00
2024-04-23 12:01:23 +02:00
/* COMPOSITOR */
2021-02-09 13:19:03 -03:00
# undef server_name
2023-07-16 10:19:11 +09:00
# undef ServerName
2024-04-23 12:01:23 +02:00
# define ServerName RendererCompositor
# define server_name RSG::rasterizer
FUNC4S ( set_boot_image , const Ref < Image > & , const Color & , bool , bool )
2023-07-16 10:19:11 +09:00
/* STATUS INFORMATION */
2024-04-23 12:01:23 +02:00
# undef server_name
# undef ServerName
/* UTILITIES */
2023-07-16 10:19:11 +09:00
# define ServerName RendererUtilities
# define server_name RSG::utilities
FUNC0RC ( String , get_video_adapter_name )
FUNC0RC ( String , get_video_adapter_vendor )
FUNC0RC ( String , get_video_adapter_api_version )
# undef server_name
2021-02-09 13:19:03 -03:00
# undef ServerName
# undef WRITE_ACTION
# undef SYNC_DEBUG
2024-04-04 10:18:08 +02:00
# ifdef DEBUG_ENABLED
# undef MAIN_THREAD_SYNC_WARN
# endif
2020-04-16 23:52:00 -03:00
2023-07-16 10:19:11 +09:00
virtual uint64_t get_rendering_info ( RenderingInfo p_info ) override ;
virtual RenderingDevice : : DeviceType get_video_adapter_type ( ) const override ;
virtual void set_frame_profiling_enabled ( bool p_enable ) override ;
virtual Vector < FrameProfileArea > get_frame_profile ( ) override ;
virtual uint64_t get_frame_profile_frame ( ) override ;
virtual RID get_test_cube ( ) override ;
2016-10-03 16:33:42 -03:00
/* FREE */
2014-02-09 22:10:30 -03:00
2021-02-09 13:19:03 -03:00
virtual void free ( RID p_rid ) override {
if ( Thread : : get_caller_id ( ) = = server_thread ) {
command_queue . flush_if_pending ( ) ;
_free ( p_rid ) ;
} else {
command_queue . push ( this , & RenderingServerDefault : : _free , p_rid ) ;
}
}
2014-02-09 22:10:30 -03:00
2024-02-17 00:57:32 +01:00
/* INTERPOLATION */
virtual void set_physics_interpolation_enabled ( bool p_enabled ) override ;
2014-02-09 22:10:30 -03:00
/* EVENT QUEUING */
2021-11-05 01:59:38 -04:00
virtual void request_frame_drawn_callback ( const Callable & p_callable ) override ;
2017-06-09 00:23:50 -03:00
Keep processing Graphics if there are pending operations
Fixes #90017
Fixes #90030
Fixes #98044
This PR makes the following changes:
# Force processing of GPU commands for frame_count frames
The variable `frames_pending_resources_for_processing` is added to track
this.
The ticket #98044 suggested to use `_flush_and_stall_for_all_frames()`
while minimized.
Technically this works and is a viable solution.
However I noticed that this issue was happening because Logic/Physics
continue to work "business as usual" while minimized(\*). Only Graphics
was being deactivated (which caused commands to accumulate until window
is restored).
To continue this behavior of "business as usual", I decided that GPU
work should also "continue as usual" by buffering commands in a double
or triple buffer scheme until all commands are done processing (if they
ever stop coming). This is specially important if the app specifically
intends to keep processing while minimized.
Calling `_flush_and_stall_for_all_frames()` would fix the leak, but it
would make Godot's behavior different while minimized vs while the
window is presenting.
\* `OS::add_frame_delay` _does_ consider being minimized, but it just
throttles CPU usage. Some platforms such as Android completely disable
processing because the higher level code stops being called when the app
goes into background. But this seems like an implementation-detail that
diverges from the rest of the platforms (e.g. Windows, Linux & macOS
continue to process while minimized).
# Rename p_swap_buffers for p_present
**This is potentially a breaking change** (if it actually breaks
anything, I ignore. But I strongly suspect it doesn't break anything).
"Swap Buffers" is a concept carried from OpenGL, where a frame is "done"
when `glSwapBuffers()` is called, which basically means "present to the
screen".
However it _also_ means that OpenGL internally swaps its internal
buffers in a double/triple buffer scheme (in Vulkan, we do that
ourselves and is tracked by `RenderingDevice::frame`).
Modern APIs like Vulkan differentiate between "submitting GPU work" and
"presenting".
Before this PR, calling `RendererCompositorRD::end_frame(false)` would
literally do nothing. This is often undesired and the cause of the leak.
After this PR, calling `RendererCompositorRD::end_frame(false)` will now
process commands, swap our internal buffers in a double/triple buffer
scheme **but avoid presenting to the screen**.
Hence the rename of the variable from `p_swap_buffers` to `p_present`
(which slightly alters its behavior).
If we want `RendererCompositorRD::end_frame(false)` to do nothing, then
we should not call it at all.
This PR reflects such change: When we're minimized **_and_**
`has_pending_resources_for_processing()` returns false, we don't call
`RendererCompositorRD::end_frame()` at all.
But if `has_pending_resources_for_processing()` returns true, we will
call it, but with `p_present = false` because we're minimized.
There's still the issue that Godot keeps processing work (logic,
scripts, physics) while minimized, which we shouldn't do by default. But
that's work for follow up PR.
2024-12-10 19:25:46 -03:00
virtual void draw ( bool p_present , double frame_step ) override ;
2021-02-09 13:19:03 -03:00
virtual void sync ( ) override ;
virtual bool has_changed ( ) const override ;
virtual void init ( ) override ;
virtual void finish ( ) override ;
2024-05-26 19:39:28 +02:00
virtual void tick ( ) override ;
virtual void pre_draw ( bool p_will_draw ) override ;
2014-02-09 22:10:30 -03:00
2024-03-21 18:58:24 +11:00
virtual bool is_on_render_thread ( ) override {
return Thread : : get_caller_id ( ) = = server_thread ;
}
2023-07-20 11:49:59 +02:00
virtual void call_on_render_thread ( const Callable & p_callable ) override {
if ( Thread : : get_caller_id ( ) = = server_thread ) {
command_queue . flush_if_pending ( ) ;
2024-04-23 12:01:23 +02:00
p_callable . call ( ) ;
2023-07-20 11:49:59 +02:00
} else {
command_queue . push ( this , & RenderingServerDefault : : _call_on_render_thread , p_callable ) ;
}
}
2016-10-03 16:33:42 -03:00
/* TESTING */
2014-02-09 22:10:30 -03:00
2021-02-01 21:16:37 -05:00
virtual double get_frame_setup_time_cpu ( ) const override ;
2014-02-09 22:10:30 -03:00
2023-01-11 19:14:43 +01:00
virtual Color get_default_clear_color ( ) override ;
2021-02-09 13:19:03 -03:00
virtual void set_default_clear_color ( const Color & p_color ) override ;
2016-10-03 16:33:42 -03:00
2024-01-10 11:27:37 +01:00
# ifndef DISABLE_DEPRECATED
2021-02-09 13:19:03 -03:00
virtual bool has_feature ( Features p_feature ) const override ;
2024-01-10 11:27:37 +01:00
# endif
2016-10-03 16:33:42 -03:00
2021-02-09 13:19:03 -03:00
virtual bool has_os_feature ( const String & p_feature ) const override ;
virtual void set_debug_generate_wireframes ( bool p_generate ) override ;
2017-12-16 17:09:25 -03:00
2021-02-09 13:19:03 -03:00
virtual bool is_low_end ( ) const override ;
2018-09-28 20:32:40 -03:00
2021-02-09 13:19:03 -03:00
virtual void sdfgi_set_debug_probe_select ( const Vector3 & p_position , const Vector3 & p_dir ) override ;
2020-06-25 10:33:28 -03:00
2021-02-09 13:19:03 -03:00
virtual void set_print_gpu_profile ( bool p_enable ) override ;
2021-01-22 20:50:24 -03:00
2022-08-22 00:16:56 +02:00
virtual Size2i get_maximum_viewport_size ( ) const override ;
2021-02-09 13:19:03 -03:00
RenderingServerDefault ( bool p_create_thread = false ) ;
2020-12-03 18:09:47 -03:00
~ RenderingServerDefault ( ) ;
2014-02-09 22:10:30 -03:00
} ;
2022-07-23 23:41:51 +02:00
# endif // RENDERING_SERVER_DEFAULT_H