diff options
Diffstat (limited to 'servers/rendering/rendering_server_default.h')
-rw-r--r-- | servers/rendering/rendering_server_default.h | 209 |
1 files changed, 132 insertions, 77 deletions
diff --git a/servers/rendering/rendering_server_default.h b/servers/rendering/rendering_server_default.h index ea8e8aa056..a68c7ddf2c 100644 --- a/servers/rendering/rendering_server_default.h +++ b/servers/rendering/rendering_server_default.h @@ -31,9 +31,8 @@ #ifndef RENDERING_SERVER_DEFAULT_H #define RENDERING_SERVER_DEFAULT_H -#include "core/math/octree.h" #include "core/templates/command_queue_mt.h" -#include "core/templates/ordered_hash_map.h" +#include "core/templates/hash_map.h" #include "renderer_canvas_cull.h" #include "renderer_scene_cull.h" #include "renderer_viewport.h" @@ -69,7 +68,7 @@ class RenderingServerDefault : public RenderingServer { //for printing bool print_gpu_profile = false; - OrderedHashMap<String, float> print_gpu_profile_task_time; + HashMap<String, float> print_gpu_profile_task_time; uint64_t print_frame_profile_ticks_from = 0; uint32_t print_frame_profile_frame_count = 0; @@ -84,7 +83,6 @@ class RenderingServerDefault : public RenderingServer { SafeFlag draw_thread_up; bool create_thread; - SafeNumeric<uint64_t> draw_pending; void _thread_draw(bool p_swap_buffers, double frame_step); void _thread_flush(); @@ -113,7 +111,9 @@ public: _changes_changed(); #else - _FORCE_INLINE_ static void redraw_request() { changes++; } + _FORCE_INLINE_ static void redraw_request() { + changes++; + } #endif #define WRITE_ACTION redraw_request(); @@ -213,25 +213,25 @@ public: FUNC2(texture_set_force_redraw_if_visible, RID, bool) -//from now on, calls forwarded to this singleton + /* SHADER API */ + #undef ServerName #undef server_name -#define ServerName RendererStorage -#define server_name RSG::storage - - /* SHADER API */ +#define ServerName RendererMaterialStorage +#define server_name RSG::material_storage FUNCRIDSPLIT(shader) FUNC2(shader_set_code, RID, const String &) + FUNC2(shader_set_path_hint, RID, const String &) FUNC1RC(String, shader_get_code, RID) - FUNC2SC(shader_get_param_list, RID, List<PropertyInfo> *) + FUNC2SC(get_shader_parameter_list, RID, List<PropertyInfo> *) - FUNC4(shader_set_default_texture_param, RID, const StringName &, RID, int) - FUNC3RC(RID, shader_get_default_texture_param, RID, const StringName &, int) - FUNC2RC(Variant, shader_get_param_default, RID, const StringName &) + 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 &) FUNC1RC(ShaderNativeSourceCode, shader_get_native_source_code, RID) @@ -249,8 +249,15 @@ public: /* MESH API */ +//from now on, calls forwarded to this singleton +#undef ServerName +#undef server_name + +#define ServerName RendererMeshStorage +#define server_name RSG::mesh_storage + virtual RID mesh_create_from_surfaces(const Vector<SurfaceData> &p_surfaces, int p_blend_shape_count = 0) override { - RID mesh = RSG::storage->mesh_allocate(); + RID mesh = RSG::mesh_storage->mesh_allocate(); // TODO once we have RSG::mesh_storage, add can_create_resources_async and call here instead of texture_storage!! @@ -258,16 +265,16 @@ public: if (Thread::get_caller_id() == server_thread) { command_queue.flush_if_pending(); } - RSG::storage->mesh_initialize(mesh); - RSG::storage->mesh_set_blend_shape_count(mesh, p_blend_shape_count); + RSG::mesh_storage->mesh_initialize(mesh); + RSG::mesh_storage->mesh_set_blend_shape_count(mesh, p_blend_shape_count); for (int i = 0; i < p_surfaces.size(); i++) { - RSG::storage->mesh_add_surface(mesh, p_surfaces[i]); + RSG::mesh_storage->mesh_add_surface(mesh, p_surfaces[i]); } } else { - command_queue.push(RSG::storage, &RendererStorage::mesh_initialize, mesh); - command_queue.push(RSG::storage, &RendererStorage::mesh_set_blend_shape_count, mesh, p_blend_shape_count); + 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); for (int i = 0; i < p_surfaces.size(); i++) { - command_queue.push(RSG::storage, &RendererStorage::mesh_add_surface, mesh, p_surfaces[i]); + command_queue.push(RSG::mesh_storage, &RendererMeshStorage::mesh_add_surface, mesh, p_surfaces[i]); } } @@ -342,6 +349,11 @@ public: FUNC2(skeleton_set_base_transform_2d, RID, const Transform2D &) /* Light API */ +#undef ServerName +#undef server_name + +#define ServerName RendererLightStorage +#define server_name RSG::light_storage FUNCRIDSPLIT(directional_light) FUNCRIDSPLIT(omni_light) @@ -383,13 +395,35 @@ public: FUNC2(reflection_probe_set_resolution, RID, int) FUNC2(reflection_probe_set_mesh_lod_threshold, RID, float) + /* 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 &) + FUNC2(lightmap_set_baked_exposure_normalization, RID, float) + 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) + + /* 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) + /* DECAL API */ #undef ServerName #undef server_name -#define ServerName RendererDecalAtlasStorage -#define server_name RSG::decal_atlas_storage +#define ServerName RendererTextureStorage +#define server_name RSG::texture_storage FUNCRIDSPLIT(decal) @@ -409,8 +443,8 @@ public: #undef ServerName #undef server_name -#define ServerName RendererStorage -#define server_name RSG::storage +#define ServerName RendererGI +#define server_name RSG::gi FUNCRIDSPLIT(voxel_gi) @@ -427,26 +461,19 @@ public: FUNC2(voxel_gi_set_dynamic_range, RID, float) FUNC2(voxel_gi_set_propagation, RID, float) FUNC2(voxel_gi_set_energy, RID, float) + FUNC2(voxel_gi_set_baked_exposure_normalization, RID, float) 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) - /* LIGHTMAP */ - - FUNCRIDSPLIT(lightmap) + /* PARTICLES */ - 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 &) - 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) +#undef ServerName +#undef server_name - /* PARTICLES */ +#define ServerName RendererParticlesStorage +#define server_name RSG::particles_storage FUNCRIDSPLIT(particles) @@ -503,6 +530,12 @@ public: /* FOG VOLUME */ +#undef ServerName +#undef server_name + +#define ServerName RendererFog +#define server_name RSG::fog + FUNCRIDSPLIT(fog_volume) FUNC2(fog_volume_set_shape, RID, FogVolumeShape) @@ -511,6 +544,12 @@ public: /* VISIBILITY_NOTIFIER */ +#undef ServerName +#undef server_name + +#define ServerName RendererUtilities +#define server_name RSG::utilities + FUNCRIDSPLIT(visibility_notifier) FUNC2(visibility_notifier_set_aabb, RID, const AABB &) FUNC3(visibility_notifier_set_callbacks, RID, const Callable &, const Callable &) @@ -518,7 +557,7 @@ public: #undef server_name #undef ServerName //from now on, calls forwarded to this singleton -#define ServerName RendererScene +#define ServerName RenderingMethod #define server_name RSG::scene /* CAMERA API */ @@ -530,7 +569,7 @@ public: FUNC2(camera_set_transform, RID, const Transform3D &) FUNC2(camera_set_cull_mask, RID, uint32_t) FUNC2(camera_set_environment, RID, RID) - FUNC2(camera_set_camera_effects, RID, RID) + FUNC2(camera_set_camera_attributes, RID, RID) FUNC2(camera_set_use_vertical_aspect, RID, bool) /* OCCLUDER */ @@ -561,7 +600,7 @@ public: FUNC2(viewport_set_scaling_3d_mode, RID, ViewportScaling3DMode) FUNC2(viewport_set_scaling_3d_scale, RID, float) FUNC2(viewport_set_fsr_sharpness, RID, float) - FUNC2(viewport_set_fsr_mipmap_bias, RID, float) + FUNC2(viewport_set_texture_mipmap_bias, RID, float) FUNC2(viewport_set_update_mode, RID, ViewportUpdateMode) @@ -586,11 +625,13 @@ public: FUNC2(viewport_set_global_canvas_transform, RID, const Transform2D &) FUNC4(viewport_set_canvas_stacking, RID, RID, int, int) - FUNC3(viewport_set_shadow_atlas_size, RID, int, bool) + FUNC3(viewport_set_positional_shadow_atlas_size, RID, int, bool) FUNC3(viewport_set_sdf_oversize_and_scale, RID, ViewportSDFOversize, ViewportSDFScale) - FUNC3(viewport_set_shadow_atlas_quadrant_subdivision, RID, int, int) - FUNC2(viewport_set_msaa, RID, ViewportMSAA) + FUNC3(viewport_set_positional_shadow_atlas_quadrant_subdivision, RID, int, int) + FUNC2(viewport_set_msaa_2d, RID, ViewportMSAA) + FUNC2(viewport_set_msaa_3d, RID, ViewportMSAA) FUNC2(viewport_set_screen_space_aa, RID, ViewportScreenSpaceAA) + FUNC2(viewport_set_use_taa, RID, bool) FUNC2(viewport_set_use_debanding, RID, bool) FUNC2(viewport_set_use_occlusion_culling, RID, bool) FUNC1(viewport_set_occlusion_rays_per_thread, int) @@ -603,18 +644,21 @@ public: FUNC2(viewport_set_measure_render_time, RID, bool) FUNC1RC(double, viewport_get_measured_render_time_cpu, RID) FUNC1RC(double, viewport_get_measured_render_time_gpu, RID) + FUNC1RC(RID, viewport_find_from_screen_attachment, DisplayServer::WindowID) FUNC2(call_set_vsync_mode, DisplayServer::VSyncMode, DisplayServer::WindowID) + FUNC2(viewport_set_vrs_mode, RID, ViewportVRSMode) + FUNC2(viewport_set_vrs_texture, RID, RID) + /* ENVIRONMENT API */ #undef server_name #undef ServerName //from now on, calls forwarded to this singleton -#define ServerName RendererScene +#define ServerName RenderingMethod #define server_name RSG::scene - FUNC2(directional_shadow_atlas_set_size, int, bool) FUNC1(voxel_gi_set_quality, VoxelGIQuality) /* SKY API */ @@ -632,7 +676,7 @@ public: FUNC2(environment_set_sky_custom_fov, RID, float) FUNC2(environment_set_sky_orientation, RID, const Basis &) FUNC2(environment_set_bg_color, RID, const Color &) - FUNC2(environment_set_bg_energy, RID, float) + FUNC3(environment_set_bg_energy, RID, float, float) FUNC2(environment_set_canvas_max_layer, RID, int) FUNC6(environment_set_ambient_light, RID, const Color &, EnvironmentAmbientSource, float, float, EnvironmentReflectionSource) @@ -653,12 +697,12 @@ public: FUNC1(environment_glow_set_use_bicubic_upscale, bool) FUNC1(environment_glow_set_use_high_quality, bool) - FUNC9(environment_set_tonemap, RID, EnvironmentToneMapper, float, float, bool, float, float, float, float) + FUNC4(environment_set_tonemap, RID, EnvironmentToneMapper, float, float) FUNC7(environment_set_adjustment, RID, bool, float, float, float, bool, RID) - FUNC9(environment_set_fog, RID, bool, const Color &, float, float, float, float, float, float) - FUNC13(environment_set_volumetric_fog, RID, bool, float, const Color &, const Color &, float, float, float, float, float, bool, float, float) + FUNC10(environment_set_fog, RID, bool, const Color &, float, float, float, float, float, float, float) + FUNC14(environment_set_volumetric_fog, RID, bool, float, const Color &, const Color &, float, float, float, float, float, bool, float, float, float) FUNC2(environment_set_volumetric_fog_volume_size, int, int) FUNC1(environment_set_volumetric_fog_filter_active, bool) @@ -674,33 +718,40 @@ public: FUNC1(sub_surface_scattering_set_quality, SubSurfaceScatteringQuality) FUNC2(sub_surface_scattering_set_scale, float, float) - /* CAMERA EFFECTS */ + FUNC1(positional_soft_shadow_filter_set_quality, ShadowQuality); + FUNC1(directional_soft_shadow_filter_set_quality, ShadowQuality); + FUNC1(decals_set_filter, RS::DecalFilter); + FUNC1(light_projectors_set_filter, RS::LightProjectorFilter); - FUNCRIDSPLIT(camera_effects) + /* CAMERA ATTRIBUTES */ - FUNC2(camera_effects_set_dof_blur_quality, DOFBlurQuality, bool) - FUNC1(camera_effects_set_dof_blur_bokeh_shape, DOFBokehShape) +#undef server_name +#undef ServerName +//from now on, calls forwarded to this singleton +#define ServerName RendererCameraAttributes +#define server_name RSG::camera_attributes - FUNC8(camera_effects_set_dof_blur, RID, bool, float, float, bool, float, float, float) - FUNC3(camera_effects_set_custom_exposure, RID, bool, float) + FUNCRIDSPLIT(camera_attributes) - FUNC1(shadows_quality_set, ShadowQuality); - FUNC1(directional_shadow_quality_set, ShadowQuality); - FUNC1(decals_set_filter, RS::DecalFilter); - FUNC1(light_projectors_set_filter, RS::LightProjectorFilter); + 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) /* SCENARIO API */ #undef server_name #undef ServerName -#define ServerName RendererScene +#define ServerName RenderingMethod #define server_name RSG::scene FUNCRIDSPLIT(scenario) FUNC2(scenario_set_environment, RID, RID) - FUNC2(scenario_set_camera_effects, RID, RID) + FUNC2(scenario_set_camera_attributes, RID, RID) FUNC2(scenario_set_fallback_environment, RID, RID) /* INSTANCING API */ @@ -743,7 +794,7 @@ public: FUNC2RC(Variant, instance_geometry_get_shader_parameter_default_value, RID, const StringName &) FUNC2C(instance_geometry_get_shader_parameter_list, RID, List<PropertyInfo> *) - FUNC3R(TypedArray<Image>, bake_render_uv2, RID, const Vector<RID> &, const Size2i &) + FUNC3R(TypedArray<Image>, bake_render_uv2, RID, const TypedArray<RID> &, const Size2i &) FUNC1(gi_set_use_half_resolution, bool) @@ -788,7 +839,7 @@ public: FUNC2(canvas_item_set_draw_behind_parent, RID, bool) - FUNC5(canvas_item_add_line, RID, const Point2 &, const Point2 &, const Color &, float) + FUNC6(canvas_item_add_line, RID, const Point2 &, const Point2 &, const Color &, float, bool) FUNC5(canvas_item_add_polyline, RID, const Vector<Point2> &, const Vector<Color> &, float, bool) FUNC4(canvas_item_add_multiline, RID, const Vector<Point2> &, const Vector<Color> &, float) FUNC3(canvas_item_add_rect, RID, const Rect2 &, const Color &) @@ -796,6 +847,7 @@ public: 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) FUNC7(canvas_item_add_msdf_texture_rect_region, RID, const Rect2 &, RID, const Rect2 &, const Color &, int, float) + FUNC5(canvas_item_add_lcd_texture_rect_region, RID, const Rect2 &, RID, const Rect2 &, const Color &) FUNC10(canvas_item_add_nine_patch, RID, const Rect2 &, const Rect2 &, RID, const Vector2 &, const Vector2 &, NinePatchAxisMode, NinePatchAxisMode, bool, const Color &) FUNC6(canvas_item_add_primitive, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, float) FUNC5(canvas_item_add_polygon, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID) @@ -865,24 +917,24 @@ public: FUNC1(canvas_set_shadow_texture_size, int) - /* GLOBAL VARIABLES */ + /* GLOBAL SHADER UNIFORMS */ #undef server_name #undef ServerName //from now on, calls forwarded to this singleton -#define ServerName RendererStorage -#define server_name RSG::storage +#define ServerName RendererMaterialStorage +#define server_name RSG::material_storage - FUNC3(global_variable_add, const StringName &, GlobalVariableType, const Variant &) - FUNC1(global_variable_remove, const StringName &) - FUNC0RC(Vector<StringName>, global_variable_get_list) - FUNC2(global_variable_set, const StringName &, const Variant &) - FUNC2(global_variable_set_override, const StringName &, const Variant &) - FUNC1RC(GlobalVariableType, global_variable_get_type, const StringName &) - FUNC1RC(Variant, global_variable_get, const StringName &) + 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 &) - FUNC1(global_variables_load_settings, bool) - FUNC0(global_variables_clear) + FUNC1(global_shader_parameters_load_settings, bool) + FUNC0(global_shader_parameters_clear) #undef server_name #undef ServerName @@ -916,6 +968,7 @@ public: virtual String get_video_adapter_name() const override; virtual String get_video_adapter_vendor() const override; virtual RenderingDevice::DeviceType get_video_adapter_type() const override; + virtual String get_video_adapter_api_version() const override; virtual void set_frame_profiling_enabled(bool p_enable) override; virtual Vector<FrameProfileArea> get_frame_profile() override; @@ -941,8 +994,10 @@ public: virtual void set_print_gpu_profile(bool p_enable) override; + virtual Size2i get_maximum_viewport_size() const override; + RenderingServerDefault(bool p_create_thread = false); ~RenderingServerDefault(); }; -#endif +#endif // RENDERING_SERVER_DEFAULT_H |