From 9308d20d1b33d96b1ec59080ef83dbfd3282ecb6 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Wed, 27 Sep 2023 21:15:17 +0300 Subject: [PATCH 1/7] [iOS] Fix build with Xcode 15. (cherry picked from commit e1c7104e46fd3d2f97d365cb4b816b9c78e9e5df) --- .../godot_ios.xcodeproj/project.pbxproj | 12 +++++------ platform/ios/detect.py | 10 +++++----- platform/ios/display_server_ios.mm | 20 ++++++++----------- platform/ios/godot_view.mm | 6 +++--- platform/ios/view_controller.mm | 4 +--- 5 files changed, 23 insertions(+), 29 deletions(-) diff --git a/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj b/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj index 09e8bf4cc74d..cc2b1c64f88a 100644 --- a/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj +++ b/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj @@ -254,8 +254,8 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; - OTHER_LDFLAGS = "$linker_flags"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + OTHER_LDFLAGS = "-ld_classic $linker_flags"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "$targeted_device_family"; }; @@ -293,8 +293,8 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; - OTHER_LDFLAGS = "$linker_flags"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + OTHER_LDFLAGS = "-ld_classic $linker_flags"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "$targeted_device_family"; VALIDATE_PRODUCT = YES; @@ -314,7 +314,7 @@ CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"; DEVELOPMENT_TEAM = $team_id; INFOPLIST_FILE = "$binary/$binary-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -350,7 +350,7 @@ CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"; DEVELOPMENT_TEAM = $team_id; INFOPLIST_FILE = "$binary/$binary-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/platform/ios/detect.py b/platform/ios/detect.py index e11c0b7d917a..40eb61abc8e2 100644 --- a/platform/ios/detect.py +++ b/platform/ios/detect.py @@ -103,13 +103,13 @@ def configure(env: "Environment"): if env["ios_simulator"]: detect_darwin_sdk_path("iossimulator", env) - env.Append(ASFLAGS=["-mios-simulator-version-min=11.0"]) - env.Append(CCFLAGS=["-mios-simulator-version-min=11.0"]) + env.Append(ASFLAGS=["-mios-simulator-version-min=12.0"]) + env.Append(CCFLAGS=["-mios-simulator-version-min=12.0"]) env.extra_suffix = ".simulator" + env.extra_suffix else: detect_darwin_sdk_path("ios", env) - env.Append(ASFLAGS=["-miphoneos-version-min=11.0"]) - env.Append(CCFLAGS=["-miphoneos-version-min=11.0"]) + env.Append(ASFLAGS=["-miphoneos-version-min=12.0"]) + env.Append(CCFLAGS=["-miphoneos-version-min=12.0"]) if env["arch"] == "x86_64": if not env["ios_simulator"]: @@ -154,7 +154,7 @@ def configure(env: "Environment"): env.Append(CPPDEFINES=["VULKAN_ENABLED"]) if env["opengl3"]: - env.Append(CPPDEFINES=["GLES3_ENABLED"]) + env.Append(CPPDEFINES=["GLES3_ENABLED", "GLES_SILENCE_DEPRECATION"]) env.Prepend( CPPPATH=[ "$IOS_SDK_PATH/System/Library/Frameworks/OpenGLES.framework/Headers", diff --git a/platform/ios/display_server_ios.mm b/platform/ios/display_server_ios.mm index 7d91274a0c5a..108d674957b3 100644 --- a/platform/ios/display_server_ios.mm +++ b/platform/ios/display_server_ios.mm @@ -355,19 +355,15 @@ } Rect2i DisplayServerIOS::get_display_safe_area() const { - if (@available(iOS 11, *)) { - UIEdgeInsets insets = UIEdgeInsetsZero; - UIView *view = AppDelegate.viewController.godotView; - if ([view respondsToSelector:@selector(safeAreaInsets)]) { - insets = [view safeAreaInsets]; - } - float scale = screen_get_scale(); - Size2i insets_position = Size2i(insets.left, insets.top) * scale; - Size2i insets_size = Size2i(insets.left + insets.right, insets.top + insets.bottom) * scale; - return Rect2i(screen_get_position() + insets_position, screen_get_size() - insets_size); - } else { - return Rect2i(screen_get_position(), screen_get_size()); + UIEdgeInsets insets = UIEdgeInsetsZero; + UIView *view = AppDelegate.viewController.godotView; + if ([view respondsToSelector:@selector(safeAreaInsets)]) { + insets = [view safeAreaInsets]; } + float scale = screen_get_scale(); + Size2i insets_position = Size2i(insets.left, insets.top) * scale; + Size2i insets_size = Size2i(insets.left + insets.right, insets.top + insets.bottom) * scale; + return Rect2i(screen_get_position() + insets_position, screen_get_size() - insets_size); } int DisplayServerIOS::get_screen_count() const { diff --git a/platform/ios/godot_view.mm b/platform/ios/godot_view.mm index 4c9a75fdc0bb..ff8a4f892134 100644 --- a/platform/ios/godot_view.mm +++ b/platform/ios/godot_view.mm @@ -82,10 +82,10 @@ @implementation GodotView layer = [GodotMetalLayer layer]; #endif } else if ([driverName isEqualToString:@"opengl3"]) { - if (@available(iOS 13, *)) { - NSLog(@"OpenGL ES is deprecated on iOS 13"); - } +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" // OpenGL is deprecated in iOS 12.0 layer = [GodotOpenGLLayer layer]; +#pragma clang diagnostic pop } else { return nil; } diff --git a/platform/ios/view_controller.mm b/platform/ios/view_controller.mm index 0ef61da64654..1f55670b683b 100644 --- a/platform/ios/view_controller.mm +++ b/platform/ios/view_controller.mm @@ -161,9 +161,7 @@ - (void)viewDidLoad { [self observeKeyboard]; [self displayLoadingOverlay]; - if (@available(iOS 11.0, *)) { - [self setNeedsUpdateOfScreenEdgesDeferringSystemGestures]; - } + [self setNeedsUpdateOfScreenEdgesDeferringSystemGestures]; } - (void)observeKeyboard { From df0ebc6dfc2879927d6fe3e18a6f21cb3776cda3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Mon, 25 Sep 2023 10:39:30 +0200 Subject: [PATCH 2/7] SCons: Fix Python 3.12 SyntaxError with regex escape sequences (cherry picked from commit b362976504c3346b9f34b69dcad0838d1d381037) --- methods.py | 14 +++++++------- platform/linuxbsd/detect.py | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/methods.py b/methods.py index a6416ccdd29a..7067c2194618 100644 --- a/methods.py +++ b/methods.py @@ -1016,13 +1016,13 @@ def get_compiler_version(env): else: # TODO: Implement for MSVC return None match = re.search( - "(?:(?<=version )|(?<=\) )|(?<=^))" - "(?P\d+)" - "(?:\.(?P\d*))?" - "(?:\.(?P\d*))?" - "(?:-(?P[0-9a-zA-Z-]*))?" - "(?:\+(?P[0-9a-zA-Z-]*))?" - "(?: (?P[0-9]{8}|[0-9]{6})(?![0-9a-zA-Z]))?", + r"(?:(?<=version )|(?<=\) )|(?<=^))" + r"(?P\d+)" + r"(?:\.(?P\d*))?" + r"(?:\.(?P\d*))?" + r"(?:-(?P[0-9a-zA-Z-]*))?" + r"(?:\+(?P[0-9a-zA-Z-]*))?" + r"(?: (?P[0-9]{8}|[0-9]{6})(?![0-9a-zA-Z]))?", version, ) if match is not None: diff --git a/platform/linuxbsd/detect.py b/platform/linuxbsd/detect.py index a723bb5d584d..571d2a47d850 100644 --- a/platform/linuxbsd/detect.py +++ b/platform/linuxbsd/detect.py @@ -455,7 +455,7 @@ def configure(env: "Environment"): linker_version_str = subprocess.check_output( [env.subst(env["LINK"]), "-Wl,--version"] + env.subst(env["LINKFLAGS"]) ).decode("utf-8") - gnu_ld_version = re.search("^GNU ld [^$]*(\d+\.\d+)$", linker_version_str, re.MULTILINE) + gnu_ld_version = re.search(r"^GNU ld [^$]*(\d+\.\d+)$", linker_version_str, re.MULTILINE) if not gnu_ld_version: print( "Warning: Creating export template binaries enabled for PCK embedding is currently only supported with GNU ld, not gold, LLD or mold." From 6b37ad40d74d630d30d4e966fb82f61246b44865 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Sat, 16 Sep 2023 00:21:31 +0200 Subject: [PATCH 3/7] Web: Disable raycast module by default (no occlusion culling) This means no CPU occlusion culling (and not compiling Embree), unless you compile custom export templates with `module_raycast_enabled=yes`. This reduces the memory footprint significantly, and binary size. Fixes #70621. Co-authored-by: Hugo Locurcio (cherry picked from commit 8c40edf8c04cacfc88b77e80a541c648d1c2261c) --- doc/classes/OccluderInstance3D.xml | 1 + doc/classes/ProjectSettings.xml | 1 + doc/classes/Viewport.xml | 1 + platform/web/detect.py | 2 ++ 4 files changed, 5 insertions(+) diff --git a/doc/classes/OccluderInstance3D.xml b/doc/classes/OccluderInstance3D.xml index e297cf8f6ebe..cdaee3ff0d2a 100644 --- a/doc/classes/OccluderInstance3D.xml +++ b/doc/classes/OccluderInstance3D.xml @@ -9,6 +9,7 @@ The occlusion culling system works by rendering the occluders on the CPU in parallel using [url=https://www.embree.org/]Embree[/url], drawing the result to a low-resolution buffer then using this to cull 3D nodes individually. In the 3D editor, you can preview the occlusion culling buffer by choosing [b]Perspective > Debug Advanced... > Occlusion Culling Buffer[/b] in the top-left corner of the 3D viewport. The occlusion culling buffer quality can be adjusted in the Project Settings. [b]Baking:[/b] Select an [OccluderInstance3D] node, then use the [b]Bake Occluders[/b] button at the top of the 3D editor. Only opaque materials will be taken into account; transparent materials (alpha-blended or alpha-tested) will be ignored by the occluder generation. [b]Note:[/b] Occlusion culling is only effective if [member ProjectSettings.rendering/occlusion_culling/use_occlusion_culling] is [code]true[/code]. Enabling occlusion culling has a cost on the CPU. Only enable occlusion culling if you actually plan to use it. Large open scenes with few or no objects blocking the view will generally not benefit much from occlusion culling. Large open scenes generally benefit more from mesh LOD and visibility ranges ([member GeometryInstance3D.visibility_range_begin] and [member GeometryInstance3D.visibility_range_end]) compared to occlusion culling. + [b]Note:[/b] Due to memory constraints, occlusion culling is not supported by default in Web export templates. It can be enabled by compiling custom Web export templates with [code]module_raycast_enabled=yes[/code]. diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 21d5c30ae998..de893e58f402 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -2487,6 +2487,7 @@ If [code]true[/code], [OccluderInstance3D] nodes will be usable for occlusion culling in 3D in the root viewport. In custom viewports, [member Viewport.use_occlusion_culling] must be set to [code]true[/code] instead. [b]Note:[/b] Enabling occlusion culling has a cost on the CPU. Only enable occlusion culling if you actually plan to use it. Large open scenes with few or no objects blocking the view will generally not benefit much from occlusion culling. Large open scenes generally benefit more from mesh LOD and visibility ranges ([member GeometryInstance3D.visibility_range_begin] and [member GeometryInstance3D.visibility_range_end]) compared to occlusion culling. + [b]Note:[/b] Due to memory constraints, occlusion culling is not supported by default in Web export templates. It can be enabled by compiling custom Web export templates with [code]module_raycast_enabled=yes[/code]. Number of cubemaps to store in the reflection atlas. The number of [ReflectionProbe]s in a scene will be limited by this amount. A higher number requires more VRAM. diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml index e78404250798..eb9f96d8cb1a 100644 --- a/doc/classes/Viewport.xml +++ b/doc/classes/Viewport.xml @@ -351,6 +351,7 @@ If [code]true[/code], [OccluderInstance3D] nodes will be usable for occlusion culling in 3D for this viewport. For the root viewport, [member ProjectSettings.rendering/occlusion_culling/use_occlusion_culling] must be set to [code]true[/code] instead. [b]Note:[/b] Enabling occlusion culling has a cost on the CPU. Only enable occlusion culling if you actually plan to use it, and think whether your scene can actually benefit from occlusion culling. Large, open scenes with few or no objects blocking the view will generally not benefit much from occlusion culling. Large open scenes generally benefit more from mesh LOD and visibility ranges ([member GeometryInstance3D.visibility_range_begin] and [member GeometryInstance3D.visibility_range_end]) compared to occlusion culling. + [b]Note:[/b] Due to memory constraints, occlusion culling is not supported by default in Web export templates. It can be enabled by compiling custom Web export templates with [code]module_raycast_enabled=yes[/code]. Enables Temporal Anti-Aliasing for this viewport. TAA works by jittering the camera and accumulating the images of the last rendered frames, motion vector rendering is used to account for camera and object motion. diff --git a/platform/web/detect.py b/platform/web/detect.py index 781560cf6109..24125dc4461b 100644 --- a/platform/web/detect.py +++ b/platform/web/detect.py @@ -60,6 +60,8 @@ def get_flags(): ("target", "template_debug"), ("builtin_pcre2_with_jit", False), ("vulkan", False), + # Embree is heavy and requires too much memory (GH-70621). + ("module_raycast_enabled", False), # Use -Os to prioritize optimizing for reduced file size. This is # particularly valuable for the web platform because it directly # decreases download time. From 33b965367c3871dc96ae50b3d834d9ff062b753c Mon Sep 17 00:00:00 2001 From: Nomad1 Date: Sun, 17 Sep 2023 11:11:35 -0230 Subject: [PATCH 4/7] Fixed VS 2022 Mac compatibility Visual Studio 2022 on Mac marks the project as invalid if the project Guid is set. Easiest way to fix it is to remove outdated 'EnableGodotProjectTypeGuid' and other Guid references (cherry picked from commit a119365d4e64bbeb97a966bb4219c34241896e86) --- .../mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.props | 2 -- .../mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.targets | 5 ----- 2 files changed, 7 deletions(-) diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.props b/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.props index b0bee795f8d2..9179b1428a3d 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.props +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.props @@ -4,8 +4,6 @@ true - - {8F3E2DF0-C35C-4265-82FC-BEA011F4A7ED} diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.targets b/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.targets index 859ea52c931b..4dcc96a1f67a 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.targets +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.targets @@ -1,11 +1,6 @@ - - true - $(GodotProjectTypeGuid);$(DefaultProjectTypeGuid) - -