diff options
-rw-r--r-- | doc/classes/Button.xml | 2 | ||||
-rw-r--r-- | doc/classes/EditorExportPlugin.xml | 10 | ||||
-rw-r--r-- | drivers/vulkan/SCsub | 4 | ||||
-rw-r--r-- | drivers/vulkan/rendering_context_driver_vulkan.cpp | 9 | ||||
-rw-r--r-- | editor/plugins/sprite_frames_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | modules/gdscript/gdscript_cache.cpp | 31 | ||||
-rw-r--r-- | modules/gdscript/gdscript_cache.h | 2 | ||||
-rw-r--r-- | platform/web/SCsub | 2 | ||||
-rw-r--r-- | platform/web/js/libs/library_godot_javascript_singleton.js | 16 | ||||
-rw-r--r-- | platform/windows/detect.py | 22 | ||||
-rw-r--r-- | scene/gui/button.cpp | 2 |
11 files changed, 70 insertions, 32 deletions
diff --git a/doc/classes/Button.xml b/doc/classes/Button.xml index 98f25ed573..68fb918904 100644 --- a/doc/classes/Button.xml +++ b/doc/classes/Button.xml @@ -119,7 +119,7 @@ Icon modulate [Color] used when the [Button] is being pressed. </theme_item> <theme_item name="align_to_largest_stylebox" data_type="constant" type="int" default="0"> - This constant acts as a boolean. If [code]true[/code], text and icon are always aligned to the largest stylebox margins, otherwise it's aligned to the current button state stylebox margins. + This constant acts as a boolean. If [code]true[/code], the minimum size of the button and text/icon alignment is always based on the largest stylebox margins, otherwise it's based on the current button state stylebox margins. </theme_item> <theme_item name="h_separation" data_type="constant" type="int" default="4"> The horizontal space between [Button]'s icon and text. Negative values will be treated as [code]0[/code] when used. diff --git a/doc/classes/EditorExportPlugin.xml b/doc/classes/EditorExportPlugin.xml index 3e2b3ea111..4d304cf5fd 100644 --- a/doc/classes/EditorExportPlugin.xml +++ b/doc/classes/EditorExportPlugin.xml @@ -17,7 +17,7 @@ <param index="1" name="features" type="PackedStringArray" /> <description> Return [code]true[/code] if this plugin will customize resources based on the platform and features used. - When enabled, [method _get_customization_configuration_hash], [method _customize_resource] and [method _customize_scene] will be called and must be implemented. + When enabled, [method _get_customization_configuration_hash] and [method _customize_resource] will be called and must be implemented. </description> </method> <method name="_begin_customize_scenes" qualifiers="virtual const"> @@ -25,7 +25,8 @@ <param index="0" name="platform" type="EditorExportPlatform" /> <param index="1" name="features" type="PackedStringArray" /> <description> - Return true if this plugin will customize scenes based on the platform and features used. + Return [code]true[/code] if this plugin will customize scenes based on the platform and features used. + When enabled, [method _get_customization_configuration_hash] and [method _customize_scene] will be called and must be implemented. </description> </method> <method name="_customize_resource" qualifiers="virtual"> @@ -35,6 +36,7 @@ <description> Customize a resource. If changes are made to it, return the same or a new resource. Otherwise, return [code]null[/code]. The [i]path[/i] argument is only used when customizing an actual file, otherwise this means that this resource is part of another one and it will be empty. + Calling [method skip] inside this callback will make the file not included in the export. Implementing this method is required if [method _begin_customize_resources] returns [code]true[/code]. </description> </method> @@ -44,6 +46,7 @@ <param index="1" name="path" type="String" /> <description> Customize a scene. If changes are made to it, return the same or a new scene. Otherwise, return [code]null[/code]. If a new scene is returned, it is up to you to dispose of the old one. + Calling [method skip] inside this callback will make the file not included in the export. Implementing this method is required if [method _begin_customize_scenes] returns [code]true[/code]. </description> </method> @@ -81,8 +84,9 @@ <param index="1" name="type" type="String" /> <param index="2" name="features" type="PackedStringArray" /> <description> - Virtual method to be overridden by the user. Called for each exported file, providing arguments that can be used to identify the file. [param path] is the path of the file, [param type] is the [Resource] represented by the file (e.g. [PackedScene]) and [param features] is the list of features for the export. + Virtual method to be overridden by the user. Called for each exported file, except for imported resources (resources that have an associated [code].import[/code] file). The arguments can be used to identify the file. [param path] is the path of the file, [param type] is the [Resource] represented by the file (e.g. [PackedScene]), and [param features] is the list of features for the export. Calling [method skip] inside this callback will make the file not included in the export. + Use [method _customize_resource] for imported resources that are not handled by this function. </description> </method> <method name="_get_android_dependencies" qualifiers="virtual const"> diff --git a/drivers/vulkan/SCsub b/drivers/vulkan/SCsub index 80d5f35305..1efef5ad77 100644 --- a/drivers/vulkan/SCsub +++ b/drivers/vulkan/SCsub @@ -16,14 +16,14 @@ if env["use_volk"]: if env["platform"] == "android": env.AppendUnique(CPPDEFINES=["VK_USE_PLATFORM_ANDROID_KHR"]) elif env["platform"] == "ios": - env.AppendUnique(CPPDEFINES=["VK_USE_PLATFORM_IOS_MVK"]) + env.AppendUnique(CPPDEFINES=["VK_USE_PLATFORM_IOS_MVK", "VK_USE_PLATFORM_METAL_EXT"]) elif env["platform"] == "linuxbsd": if env["x11"]: env.AppendUnique(CPPDEFINES=["VK_USE_PLATFORM_XLIB_KHR"]) if env["wayland"]: env.AppendUnique(CPPDEFINES=["VK_USE_PLATFORM_WAYLAND_KHR"]) elif env["platform"] == "macos": - env.AppendUnique(CPPDEFINES=["VK_USE_PLATFORM_MACOS_MVK"]) + env.AppendUnique(CPPDEFINES=["VK_USE_PLATFORM_MACOS_MVK", "VK_USE_PLATFORM_METAL_EXT"]) elif env["platform"] == "windows": env.AppendUnique(CPPDEFINES=["VK_USE_PLATFORM_WIN32_KHR"]) diff --git a/drivers/vulkan/rendering_context_driver_vulkan.cpp b/drivers/vulkan/rendering_context_driver_vulkan.cpp index 7cba820978..fe2ff5e0da 100644 --- a/drivers/vulkan/rendering_context_driver_vulkan.cpp +++ b/drivers/vulkan/rendering_context_driver_vulkan.cpp @@ -102,6 +102,10 @@ Error RenderingContextDriverVulkan::_initialize_instance_extensions() { // This extension allows us to use the properties2 features to query additional device capabilities. _register_requested_instance_extension(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, false); +#if defined(USE_VOLK) && (defined(MACOS_ENABLED) || defined(IOS_ENABLED)) + _register_requested_instance_extension(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME, true); +#endif + // Only enable debug utils in verbose mode or DEV_ENABLED. // End users would get spammed with messages of varying verbosity due to the // mess that thirdparty layers/extensions and drivers seem to leave in their @@ -360,6 +364,11 @@ Error RenderingContextDriverVulkan::_initialize_instance() { VkInstanceCreateInfo instance_info = {}; instance_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; + +#if defined(USE_VOLK) && (defined(MACOS_ENABLED) || defined(IOS_ENABLED)) + instance_info.flags = VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR; +#endif + instance_info.pApplicationInfo = &app_info; instance_info.enabledExtensionCount = enabled_extension_names.size(); instance_info.ppEnabledExtensionNames = enabled_extension_names.ptr(); diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index 27056a6cc4..48087e3166 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -953,7 +953,7 @@ void SpriteFramesEditor::_sync_animation() { } void SpriteFramesEditor::_select_animation(const String &p_name, bool p_update_node) { - if (!frames->has_animation(p_name)) { + if (frames.is_null() || !frames->has_animation(p_name)) { return; } edited_anim = p_name; diff --git a/modules/gdscript/gdscript_cache.cpp b/modules/gdscript/gdscript_cache.cpp index c56ae0fb14..7c9fba799d 100644 --- a/modules/gdscript/gdscript_cache.cpp +++ b/modules/gdscript/gdscript_cache.cpp @@ -42,6 +42,10 @@ GDScriptParserRef::Status GDScriptParserRef::get_status() const { return status; } +String GDScriptParserRef::get_path() const { + return path; +} + uint32_t GDScriptParserRef::get_source_hash() const { return source_hash; } @@ -131,9 +135,7 @@ void GDScriptParserRef::clear() { GDScriptParserRef::~GDScriptParserRef() { clear(); - - MutexLock lock(GDScriptCache::singleton->mutex); - GDScriptCache::singleton->parser_map.erase(path); + GDScriptCache::remove_parser(path); } GDScriptCache *GDScriptCache::singleton = nullptr; @@ -154,6 +156,11 @@ void GDScriptCache::move_script(const String &p_from, const String &p_to) { } singleton->parser_map.erase(p_from); + if (singleton->parser_inverse_dependencies.has(p_from) && !p_from.is_empty()) { + singleton->parser_inverse_dependencies[p_to] = singleton->parser_inverse_dependencies[p_from]; + } + singleton->parser_inverse_dependencies.erase(p_from); + if (singleton->shallow_gdscript_cache.has(p_from) && !p_from.is_empty()) { singleton->shallow_gdscript_cache[p_to] = singleton->shallow_gdscript_cache[p_from]; } @@ -177,13 +184,11 @@ void GDScriptCache::remove_script(const String &p_path) { } if (singleton->parser_map.has(p_path)) { - // Keep a local reference until it goes out of scope. - // Clearing it can trigger a reference to itself to go out of scope, destructing it before clear finishes. - Ref<GDScriptParserRef> parser_ref = singleton->parser_map[p_path]; - singleton->parser_map.erase(p_path); - parser_ref->clear(); + singleton->parser_map[p_path]->clear(); } + remove_parser(p_path); + singleton->dependencies.erase(p_path); singleton->shallow_gdscript_cache.erase(p_path); singleton->full_gdscript_cache.erase(p_path); @@ -194,6 +199,7 @@ Ref<GDScriptParserRef> GDScriptCache::get_parser(const String &p_path, GDScriptP Ref<GDScriptParserRef> ref; if (!p_owner.is_empty()) { singleton->dependencies[p_owner].insert(p_path); + singleton->parser_inverse_dependencies[p_path].insert(p_owner); } if (singleton->parser_map.has(p_path)) { ref = Ref<GDScriptParserRef>(singleton->parser_map[p_path]); @@ -225,6 +231,13 @@ void GDScriptCache::remove_parser(const String &p_path) { MutexLock lock(singleton->mutex); // Can't clear the parser because some other parser might be currently using it in the chain of calls. singleton->parser_map.erase(p_path); + + // Have to copy while iterating, because parser_inverse_dependencies is modified. + HashSet<String> ideps = singleton->parser_inverse_dependencies[p_path]; + singleton->parser_inverse_dependencies.erase(p_path); + for (String idep_path : ideps) { + remove_parser(idep_path); + } } String GDScriptCache::get_source_code(const String &p_path) { @@ -417,6 +430,8 @@ void GDScriptCache::clear() { } singleton->cleared = true; + singleton->parser_inverse_dependencies.clear(); + RBSet<Ref<GDScriptParserRef>> parser_map_refs; for (KeyValue<String, GDScriptParserRef *> &E : singleton->parser_map) { parser_map_refs.insert(E.value); diff --git a/modules/gdscript/gdscript_cache.h b/modules/gdscript/gdscript_cache.h index 16121cc082..c927317e19 100644 --- a/modules/gdscript/gdscript_cache.h +++ b/modules/gdscript/gdscript_cache.h @@ -65,6 +65,7 @@ private: public: Status get_status() const; + String get_path() const; uint32_t get_source_hash() const; GDScriptParser *get_parser(); GDScriptAnalyzer *get_analyzer(); @@ -82,6 +83,7 @@ class GDScriptCache { HashMap<String, Ref<GDScript>> full_gdscript_cache; HashMap<String, Ref<GDScript>> static_gdscript_cache; HashMap<String, HashSet<String>> dependencies; + HashMap<String, HashSet<String>> parser_inverse_dependencies; friend class GDScript; friend class GDScriptParserRef; diff --git a/platform/web/SCsub b/platform/web/SCsub index 3d36a888d6..e81f2ec516 100644 --- a/platform/web/SCsub +++ b/platform/web/SCsub @@ -71,8 +71,6 @@ if env["dlink_enabled"]: sys_env.Append(LINKFLAGS=["-s", "MAIN_MODULE=1"]) sys_env.Append(LINKFLAGS=["-s", "EXPORT_ALL=1"]) sys_env.Append(LINKFLAGS=["-s", "WARN_ON_UNDEFINED_SYMBOLS=0"]) - # Force exporting the standard library (printf, malloc, etc.) - sys_env["ENV"]["EMCC_FORCE_STDLIBS"] = "libc,libc++,libc++abi" sys_env["CCFLAGS"].remove("-fvisibility=hidden") sys_env["LINKFLAGS"].remove("-fvisibility=hidden") diff --git a/platform/web/js/libs/library_godot_javascript_singleton.js b/platform/web/js/libs/library_godot_javascript_singleton.js index b17fde1544..6bb69bca95 100644 --- a/platform/web/js/libs/library_godot_javascript_singleton.js +++ b/platform/web/js/libs/library_godot_javascript_singleton.js @@ -81,11 +81,16 @@ const GodotJSWrapper = { case 0: return null; case 1: - return !!GodotRuntime.getHeapValue(val, 'i64'); - case 2: - return GodotRuntime.getHeapValue(val, 'i64'); + return Boolean(GodotRuntime.getHeapValue(val, 'i64')); + case 2: { + // `heap_value` may be a bigint. + const heap_value = GodotRuntime.getHeapValue(val, 'i64'); + return heap_value >= Number.MIN_SAFE_INTEGER && heap_value <= Number.MAX_SAFE_INTEGER + ? Number(heap_value) + : heap_value; + } case 3: - return GodotRuntime.getHeapValue(val, 'double'); + return Number(GodotRuntime.getHeapValue(val, 'double')); case 4: return GodotRuntime.parseString(GodotRuntime.getHeapValue(val, '*')); case 24: // OBJECT @@ -110,6 +115,9 @@ const GodotJSWrapper = { } GodotRuntime.setHeapValue(p_exchange, p_val, 'double'); return 3; // FLOAT + } else if (type === 'bigint') { + GodotRuntime.setHeapValue(p_exchange, p_val, 'i64'); + return 2; // INT } else if (type === 'string') { const c_str = GodotRuntime.allocString(p_val); GodotRuntime.setHeapValue(p_exchange, c_str, '*'); diff --git a/platform/windows/detect.py b/platform/windows/detect.py index 8e1abba3bb..fee306a25c 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -500,6 +500,14 @@ def configure_msvc(env: "SConsEnvironment", vcvars_msvc_config): if env["arch"] == "x86_64": env.AppendUnique(CPPDEFINES=["_WIN64"]) + # Sanitizers + prebuilt_lib_extra_suffix = "" + if env["use_asan"]: + env.extra_suffix += ".san" + prebuilt_lib_extra_suffix = ".san" + env.Append(CCFLAGS=["/fsanitize=address"]) + env.Append(LINKFLAGS=["/INFERASANLIBS"]) + ## Libs LIBS = [ @@ -567,7 +575,7 @@ def configure_msvc(env: "SConsEnvironment", vcvars_msvc_config): LIBS += ["WinPixEventRuntime"] env.Append(LIBPATH=[env["mesa_libs"] + "/bin"]) - LIBS += ["libNIR.windows." + env["arch"]] + LIBS += ["libNIR.windows." + env["arch"] + prebuilt_lib_extra_suffix] if env["opengl3"]: env.AppendUnique(CPPDEFINES=["GLES3_ENABLED"]) @@ -575,9 +583,9 @@ def configure_msvc(env: "SConsEnvironment", vcvars_msvc_config): env.AppendUnique(CPPDEFINES=["EGL_STATIC"]) env.Append(LIBPATH=[env["angle_libs"]]) LIBS += [ - "libANGLE.windows." + env["arch"], - "libEGL.windows." + env["arch"], - "libGLES.windows." + env["arch"], + "libANGLE.windows." + env["arch"] + prebuilt_lib_extra_suffix, + "libEGL.windows." + env["arch"] + prebuilt_lib_extra_suffix, + "libGLES.windows." + env["arch"] + prebuilt_lib_extra_suffix, ] LIBS += ["dxgi", "d3d9", "d3d11"] env.Prepend(CPPPATH=["#thirdparty/angle/include"]) @@ -613,12 +621,6 @@ def configure_msvc(env: "SConsEnvironment", vcvars_msvc_config): env.Prepend(CPPPATH=[p for p in str(os.getenv("INCLUDE")).split(";")]) env.Append(LIBPATH=[p for p in str(os.getenv("LIB")).split(";")]) - # Sanitizers - if env["use_asan"]: - env.extra_suffix += ".san" - env.Append(LINKFLAGS=["/INFERASANLIBS"]) - env.Append(CCFLAGS=["/fsanitize=address"]) - # Incremental linking fix env["BUILDERS"]["ProgramOriginal"] = env["BUILDERS"]["Program"] env["BUILDERS"]["Program"] = methods.precious_program diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp index 4e738216de..dd344121e1 100644 --- a/scene/gui/button.cpp +++ b/scene/gui/button.cpp @@ -530,7 +530,7 @@ Size2 Button::get_minimum_size_for_text_and_icon(const String &p_text, Ref<Textu } } - return _get_largest_stylebox_size() + minsize; + return (theme_cache.align_to_largest_stylebox ? _get_largest_stylebox_size() : _get_current_stylebox()->get_minimum_size()) + minsize; } void Button::_shape(Ref<TextParagraph> p_paragraph, String p_text) { |