diff options
-rw-r--r-- | core/core_constants.cpp | 2 | ||||
-rw-r--r-- | core/extension/gdextension.cpp | 6 | ||||
-rw-r--r-- | core/extension/gdextension.h | 3 | ||||
-rw-r--r-- | core/extension/gdextension_compat_hashes.cpp | 4 | ||||
-rw-r--r-- | core/extension/gdextension_compat_hashes.h | 1 | ||||
-rw-r--r-- | core/extension/gdextension_manager.cpp | 6 | ||||
-rw-r--r-- | core/extension/gdextension_manager.h | 1 | ||||
-rw-r--r-- | core/register_core_types.cpp | 1 | ||||
-rw-r--r-- | drivers/vulkan/rendering_device_vulkan.cpp | 3 | ||||
-rw-r--r-- | editor/editor_node.cpp | 3 | ||||
-rw-r--r-- | editor/editor_themes.cpp | 25 | ||||
-rw-r--r-- | editor/editor_themes.h | 9 | ||||
-rw-r--r-- | editor/project_manager.cpp | 4 | ||||
-rw-r--r-- | modules/navigation/nav_region.cpp | 4 | ||||
-rw-r--r-- | scene/resources/particle_process_material.cpp | 28 |
15 files changed, 70 insertions, 30 deletions
diff --git a/core/core_constants.cpp b/core/core_constants.cpp index 33b3271495..2f70fdf219 100644 --- a/core/core_constants.cpp +++ b/core/core_constants.cpp @@ -794,6 +794,8 @@ void register_global_constants() { void unregister_global_constants() { _global_constants.clear(); + _global_constants_map.clear(); + _global_enums.clear(); } int CoreConstants::get_global_constant_count() { diff --git a/core/extension/gdextension.cpp b/core/extension/gdextension.cpp index 8fb1aab6dc..26512d0c56 100644 --- a/core/extension/gdextension.cpp +++ b/core/extension/gdextension.cpp @@ -664,7 +664,7 @@ void GDExtension::_get_library_path(GDExtensionClassLibraryPtr p_library, GDExte memnew_placement(r_path, String(self->library_path)); } -HashMap<StringName, GDExtensionInterfaceFunctionPtr> gdextension_interface_functions; +HashMap<StringName, GDExtensionInterfaceFunctionPtr> GDExtension::gdextension_interface_functions; void GDExtension::register_interface_function(StringName p_function_name, GDExtensionInterfaceFunctionPtr p_function_pointer) { ERR_FAIL_COND_MSG(gdextension_interface_functions.has(p_function_name), "Attempt to register interface function '" + p_function_name + "', which appears to be already registered."); @@ -836,6 +836,10 @@ void GDExtension::initialize_gdextensions() { register_interface_function("get_library_path", (GDExtensionInterfaceFunctionPtr)&GDExtension::_get_library_path); } +void GDExtension::finalize_gdextensions() { + gdextension_interface_functions.clear(); +} + Error GDExtensionResourceLoader::load_gdextension_resource(const String &p_path, Ref<GDExtension> &p_extension) { ERR_FAIL_COND_V_MSG(p_extension.is_valid() && p_extension->is_library_open(), ERR_ALREADY_IN_USE, "Cannot load GDExtension resource into already opened library."); diff --git a/core/extension/gdextension.h b/core/extension/gdextension.h index d71b1f9704..bab3bcd198 100644 --- a/core/extension/gdextension.h +++ b/core/extension/gdextension.h @@ -106,6 +106,8 @@ class GDExtension : public Resource { void clear_instance_bindings(); #endif + static HashMap<StringName, GDExtensionInterfaceFunctionPtr> gdextension_interface_functions; + protected: static void _bind_methods(); @@ -153,6 +155,7 @@ public: static void register_interface_function(StringName p_function_name, GDExtensionInterfaceFunctionPtr p_function_pointer); static GDExtensionInterfaceFunctionPtr get_interface_function(StringName p_function_name); static void initialize_gdextensions(); + static void finalize_gdextensions(); GDExtension(); ~GDExtension(); diff --git a/core/extension/gdextension_compat_hashes.cpp b/core/extension/gdextension_compat_hashes.cpp index 9c8d6b3e7f..2dac4a3a5d 100644 --- a/core/extension/gdextension_compat_hashes.cpp +++ b/core/extension/gdextension_compat_hashes.cpp @@ -840,4 +840,8 @@ void GDExtensionCompatHashes::initialize() { // clang-format on } +void GDExtensionCompatHashes::finalize() { + mappings.clear(); +} + #endif // DISABLE_DEPRECATED diff --git a/core/extension/gdextension_compat_hashes.h b/core/extension/gdextension_compat_hashes.h index 3a66ef0b97..29393dcb2d 100644 --- a/core/extension/gdextension_compat_hashes.h +++ b/core/extension/gdextension_compat_hashes.h @@ -48,6 +48,7 @@ class GDExtensionCompatHashes { public: static void initialize(); + static void finalize(); static bool lookup_current_hash(const StringName &p_class, const StringName &p_method, uint32_t p_legacy_hash, uint32_t *r_current_hash); static bool get_legacy_hashes(const StringName &p_class, const StringName &p_method, Array &r_hashes); }; diff --git a/core/extension/gdextension_manager.cpp b/core/extension/gdextension_manager.cpp index 0dc84f685f..a4d032f22f 100644 --- a/core/extension/gdextension_manager.cpp +++ b/core/extension/gdextension_manager.cpp @@ -293,3 +293,9 @@ GDExtensionManager::GDExtensionManager() { GDExtensionCompatHashes::initialize(); #endif } + +GDExtensionManager::~GDExtensionManager() { +#ifndef DISABLE_DEPRECATED + GDExtensionCompatHashes::finalize(); +#endif +} diff --git a/core/extension/gdextension_manager.h b/core/extension/gdextension_manager.h index 8cd6d5a3e2..9386e356bb 100644 --- a/core/extension/gdextension_manager.h +++ b/core/extension/gdextension_manager.h @@ -86,6 +86,7 @@ public: void reload_extensions(); GDExtensionManager(); + ~GDExtensionManager(); }; VARIANT_ENUM_CAST(GDExtensionManager::LoadStatus) diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp index b4ac533779..4ad9dd43c4 100644 --- a/core/register_core_types.cpp +++ b/core/register_core_types.cpp @@ -360,6 +360,7 @@ void unregister_core_extensions() { if (_is_core_extensions_registered) { gdextension_manager->deinitialize_extensions(GDExtension::INITIALIZATION_LEVEL_CORE); } + GDExtension::finalize_gdextensions(); } void unregister_core_types() { diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp index 5c68149a5f..a9f77c9072 100644 --- a/drivers/vulkan/rendering_device_vulkan.cpp +++ b/drivers/vulkan/rendering_device_vulkan.cpp @@ -4639,8 +4639,9 @@ String RenderingDeviceVulkan::_shader_uniform_debug(RID p_shader, int p_set) { // Version 1: initial. // Version 2: Added shader name. // Version 3: Added writable. +// Version 4: 64-bit vertex input mask. -#define SHADER_BINARY_VERSION 3 +#define SHADER_BINARY_VERSION 4 String RenderingDeviceVulkan::shader_get_binary_cache_key() const { return "Vulkan-SV" + itos(SHADER_BINARY_VERSION); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index dc3afc2f1d..dcc9255dc6 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -6951,6 +6951,7 @@ EditorNode::EditorNode() { // Exporters might need the theme. EditorColorMap::create(); + EditorTheme::initialize(); theme = create_custom_theme(); DisplayServer::set_early_window_clear_color_override(true, theme->get_color(SNAME("background"), EditorStringName(Editor))); @@ -8038,6 +8039,8 @@ EditorNode::~EditorNode() { memdelete(progress_hb); EditorSettings::destroy(); + EditorColorMap::finish(); + EditorTheme::finalize(); GDExtensionEditorPlugins::editor_node_add_plugin = nullptr; GDExtensionEditorPlugins::editor_node_remove_plugin = nullptr; diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index f5be91c6de..bf0c5392c1 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -55,7 +55,7 @@ void EditorColorMap::add_conversion_color_pair(const String p_from_color, const color_conversion_map[Color::html(p_from_color)] = Color::html(p_to_color); } -void EditorColorMap::add_conversion_exception(const StringName p_icon_name) { +void EditorColorMap::add_conversion_exception(const StringName &p_icon_name) { color_conversion_exceptions.insert(p_icon_name); } @@ -63,7 +63,7 @@ void EditorColorMap::create() { // Some of the colors below are listed for completeness sake. // This can be a basis for proper palette validation later. - // Convert: FROM TO + // Convert: FROM TO add_conversion_color_pair("#478cbf", "#478cbf"); // Godot Blue add_conversion_color_pair("#414042", "#414042"); // Godot Gray @@ -215,6 +215,11 @@ void EditorColorMap::create() { add_conversion_exception("Breakpoint"); } +void EditorColorMap::finish() { + color_conversion_map.clear(); + color_conversion_exceptions.clear(); +} + Vector<StringName> EditorTheme::editor_theme_types; // TODO: Refactor these and corresponding Theme methods to use the bool get_xxx(r_value) pattern internally. @@ -301,13 +306,15 @@ Ref<StyleBox> EditorTheme::get_stylebox(const StringName &p_name, const StringNa } } -EditorTheme::EditorTheme() { - if (editor_theme_types.is_empty()) { - editor_theme_types.append(EditorStringName(Editor)); - editor_theme_types.append(EditorStringName(EditorFonts)); - editor_theme_types.append(EditorStringName(EditorIcons)); - editor_theme_types.append(EditorStringName(EditorStyles)); - } +void EditorTheme::initialize() { + editor_theme_types.append(EditorStringName(Editor)); + editor_theme_types.append(EditorStringName(EditorFonts)); + editor_theme_types.append(EditorStringName(EditorIcons)); + editor_theme_types.append(EditorStringName(EditorStyles)); +} + +void EditorTheme::finalize() { + editor_theme_types.clear(); } // Editor theme generatior. diff --git a/editor/editor_themes.h b/editor/editor_themes.h index 7ca0050103..7d913ccc40 100644 --- a/editor/editor_themes.h +++ b/editor/editor_themes.h @@ -45,12 +45,14 @@ class EditorColorMap { static HashSet<StringName> color_conversion_exceptions; public: - static void create(); static void add_conversion_color_pair(const String p_from_color, const String p_to_color); - static void add_conversion_exception(const StringName p_icon_name); + static void add_conversion_exception(const StringName &p_icon_name); static HashMap<Color, Color> &get_color_conversion_map() { return color_conversion_map; }; static HashSet<StringName> &get_color_conversion_exceptions() { return color_conversion_exceptions; }; + + static void create(); + static void finish(); }; class EditorTheme : public Theme { @@ -66,7 +68,8 @@ public: virtual Ref<Texture2D> get_icon(const StringName &p_name, const StringName &p_theme_type) const override; virtual Ref<StyleBox> get_stylebox(const StringName &p_name, const StringName &p_theme_type) const override; - EditorTheme(); + static void initialize(); + static void finalize(); }; Ref<Theme> create_editor_theme(Ref<Theme> p_theme = nullptr); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index c9555554e1..de807c79e0 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -2845,6 +2845,7 @@ ProjectManager::ProjectManager() { } EditorColorMap::create(); + EditorTheme::initialize(); Ref<Theme> theme = create_custom_theme(); DisplayServer::set_early_window_clear_color_override(true, theme->get_color(SNAME("background"), EditorStringName(Editor))); @@ -3297,6 +3298,9 @@ ProjectManager::~ProjectManager() { if (EditorSettings::get_singleton()) { EditorSettings::destroy(); } + + EditorColorMap::finish(); + EditorTheme::finalize(); } void ProjectTag::_notification(int p_what) { diff --git a/modules/navigation/nav_region.cpp b/modules/navigation/nav_region.cpp index 3675aae518..09697c7be0 100644 --- a/modules/navigation/nav_region.cpp +++ b/modules/navigation/nav_region.cpp @@ -125,11 +125,11 @@ void NavRegion::update_polygons() { #ifdef DEBUG_ENABLED if (!Math::is_equal_approx(double(map->get_cell_size()), double(mesh->get_cell_size()))) { - ERR_PRINT_ONCE(vformat("Navigation map synchronization error. Attempted to update a navigation region with a navigation mesh that uses a `cell_size` of %s while assigned to a navigation map set to a `cell_size` of %s. The cell size for navigation maps can be changed by using the NavigationServer map_set_cell_size() function. The cell size for default navigation maps can also be changed in the ProjectSettings.", double(map->get_cell_size()), double(mesh->get_cell_size()))); + ERR_PRINT_ONCE(vformat("Navigation map synchronization error. Attempted to update a navigation region with a navigation mesh that uses a `cell_size` of %s while assigned to a navigation map set to a `cell_size` of %s. The cell size for navigation maps can be changed by using the NavigationServer map_set_cell_size() function. The cell size for default navigation maps can also be changed in the ProjectSettings.", double(mesh->get_cell_size()), double(map->get_cell_size()))); } if (!Math::is_equal_approx(double(map->get_cell_height()), double(mesh->get_cell_height()))) { - ERR_PRINT_ONCE(vformat("Navigation map synchronization error. Attempted to update a navigation region with a navigation mesh that uses a `cell_height` of %s while assigned to a navigation map set to a `cell_height` of %s. The cell height for navigation maps can be changed by using the NavigationServer map_set_cell_height() function. The cell height for default navigation maps can also be changed in the ProjectSettings.", double(map->get_cell_height()), double(mesh->get_cell_height()))); + ERR_PRINT_ONCE(vformat("Navigation map synchronization error. Attempted to update a navigation region with a navigation mesh that uses a `cell_height` of %s while assigned to a navigation map set to a `cell_height` of %s. The cell height for navigation maps can be changed by using the NavigationServer map_set_cell_height() function. The cell height for default navigation maps can also be changed in the ProjectSettings.", double(mesh->get_cell_height()), double(map->get_cell_height()))); } if (map && Math::rad_to_deg(map->get_up().angle_to(transform.basis.get_column(1))) >= 90.0f) { diff --git a/scene/resources/particle_process_material.cpp b/scene/resources/particle_process_material.cpp index 3e710e1f27..ff0a6431bd 100644 --- a/scene/resources/particle_process_material.cpp +++ b/scene/resources/particle_process_material.cpp @@ -564,7 +564,7 @@ void ParticleProcessMaterial::_update_shader() { code += " params.lifetime = (1.0 - lifetime_randomness * rand_from_seed(alt_seed));\n"; code += " params.color = color_value;\n"; if (color_initial_ramp.is_valid()) { - code += " params.color = texture(color_initial_ramp, vec2(rand_from_seed(alt_seed)));\n"; + code += " params.color *= texture(color_initial_ramp, vec2(rand_from_seed(alt_seed)));\n"; } if (emission_color_texture.is_valid() && (emission_shape == EMISSION_SHAPE_POINTS || emission_shape == EMISSION_SHAPE_DIRECTED_POINTS)) { code += " int point = min(emission_texture_point_count - 1, int(rand_from_seed(alt_seed) * float(emission_texture_point_count)));\n"; @@ -663,7 +663,7 @@ void ParticleProcessMaterial::_update_shader() { // No reason to run all these expensive calculation below if we have no orbit velocity // HOWEVER // May be a bad idea for fps consistency? - code += "if(abs(param.orbit_velocity) < 0.01){ return vec3(0.0);}\n"; + code += "if(abs(param.orbit_velocity) < 0.01 || delta < 0.001){ return vec3(0.0);}\n"; code += "\n"; code += " vec3 displacement = vec3(0.);\n"; code += " float pi = 3.14159;\n"; @@ -678,7 +678,7 @@ void ParticleProcessMaterial::_update_shader() { code += " vec3 pos = transform[3].xyz;\n"; code += " vec3 org = emission_transform[3].xyz;\n"; code += " vec3 diff = pos - org;\n"; - code += " float ang = orbit_amount * delta * pi * 2.0;\n"; + code += " float ang = orbit_amount * pi * 2.0;\n"; code += " mat2 rot = mat2(vec2(cos(ang), -sin(ang)), vec2(sin(ang), cos(ang)));\n"; code += " displacement.xy -= diff.xy;\n"; code += " displacement.xy += rot * diff.xy;\n"; @@ -727,7 +727,7 @@ void ParticleProcessMaterial::_update_shader() { code += " displacement += new_pos - local_pos;\n"; code += "\n"; } - code += " return (emission_transform * vec4(displacement, 0.0)).xyz;\n"; + code += " return (emission_transform * vec4(displacement/delta, 0.0)).xyz;\n"; code += "}\n"; code += "\n"; code += "\n"; @@ -758,7 +758,7 @@ void ParticleProcessMaterial::_update_shader() { code += "}\n"; - code += "vec3 process_radial_displacement(DynamicsParameters param, float lifetime, inout uint alt_seed, mat4 transform, mat4 emission_transform, float delta){\n"; + code += "vec3 process_radial_displacement(DynamicsParameters param, float lifetime, inout uint alt_seed, mat4 transform, mat4 emission_transform){\n"; code += " vec3 radial_displacement = vec3(0.0);\n"; code += " float radial_displacement_multiplier = 1.0;\n"; if (tex_parameters[PARAM_RADIAL_VELOCITY].is_valid()) { @@ -773,10 +773,10 @@ void ParticleProcessMaterial::_update_shader() { code += " radial_displacement = normalize(radial_displacement) * min(abs((radial_displacement_multiplier * param.radial_velocity)), length(transform[3].xyz - global_pivot));\n"; code += " }\n"; code += " \n"; - code += " return radial_displacement * delta;\n"; + code += " return radial_displacement;\n"; code += "}\n"; if (tex_parameters[PARAM_DIRECTIONAL_VELOCITY].is_valid()) { - code += "vec3 process_directional_displacement(DynamicsParameters param, float lifetime_percent,mat4 transform, mat4 emission_transform, float delta){\n"; + code += "vec3 process_directional_displacement(DynamicsParameters param, float lifetime_percent,mat4 transform, mat4 emission_transform){\n"; code += " vec3 displacement = vec3(0.);\n"; if (directional_velocity_global) { code += " displacement = texture(directional_velocity_curve, vec2(lifetime_percent)).xyz * param.directional_velocity;\n"; @@ -784,7 +784,7 @@ void ParticleProcessMaterial::_update_shader() { } else { code += " displacement = texture(directional_velocity_curve, vec2(lifetime_percent)).xyz * param.directional_velocity;\n"; } - code += " return displacement * delta;\n"; + code += " return displacement;\n"; code += "}\n"; } @@ -809,9 +809,6 @@ void ParticleProcessMaterial::_update_shader() { code += "void start() {\n"; code += " uint base_number = NUMBER;\n"; code += " uint alt_seed = hash(base_number + uint(1) + RANDOM_SEED);\n"; - code += " if (rand_from_seed(alt_seed) > AMOUNT_RATIO) {\n"; - code += " ACTIVE = false;\n"; - code += " }\n"; code += " DisplayParameters params;\n"; code += " calculate_initial_display_params(params, alt_seed);\n"; code += " // reset alt seed?\n"; @@ -821,6 +818,9 @@ void ParticleProcessMaterial::_update_shader() { code += " PhysicalParameters physics_params;\n"; code += " calculate_initial_physical_params(physics_params, alt_seed);\n"; code += " process_display_param(params, 0.0);\n"; + code += " if (rand_from_seed(alt_seed) > AMOUNT_RATIO) {\n"; + code += " ACTIVE = false;\n"; + code += " }\n"; code += " \n"; code += " float pi = 3.14159;\n"; code += " float degree_to_rad = pi / 180.0;\n"; @@ -898,10 +898,10 @@ void ParticleProcessMaterial::_update_shader() { } code += " // calculate all velocity\n"; code += " \n"; - code += " controlled_displacement += process_radial_displacement(dynamic_params, lifetime_percent, alt_seed, TRANSFORM, EMISSION_TRANSFORM, DELTA);\n"; + code += " controlled_displacement += process_radial_displacement(dynamic_params, lifetime_percent, alt_seed, TRANSFORM, EMISSION_TRANSFORM);\n"; code += " \n"; if (tex_parameters[PARAM_DIRECTIONAL_VELOCITY].is_valid()) { - code += " controlled_displacement += process_directional_displacement(dynamic_params, lifetime_percent, TRANSFORM, EMISSION_TRANSFORM, DELTA);\n"; + code += " controlled_displacement += process_directional_displacement(dynamic_params, lifetime_percent, TRANSFORM, EMISSION_TRANSFORM);\n"; } code += " \n"; code += " process_physical_parameters(physics_params, lifetime_percent);\n"; @@ -973,7 +973,7 @@ void ParticleProcessMaterial::_update_shader() { code += " ACTIVE = false;\n"; code += " }\n"; } - code += " vec3 final_velocity = controlled_displacement/DELTA + VELOCITY;\n"; + code += " vec3 final_velocity = controlled_displacement + VELOCITY;\n"; code += " \n"; code += " // turbulence before limiting\n"; if (turbulence_enabled) { |