From 347f0bd6641abffa7c5a19a3e9ca0b20c158fc18 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pa=CC=84vels=20Nadtoc=CC=8Cajevs?=
<7645683+bruvzg@users.noreply.github.com>
Date: Wed, 25 Nov 2026 14:43:21 +0200
Subject: [PATCH] [Export] Add option to select Metal GPU family for shader
baker.
---
.../shader_baker_export_plugin_platform_metal.cpp | 9 ++++++---
platform/ios/doc_classes/EditorExportPlatformIOS.xml | 3 +++
platform/ios/export/export_plugin.cpp | 1 +
platform/macos/doc_classes/EditorExportPlatformMacOS.xml | 3 +++
platform/macos/export/export_plugin.cpp | 1 +
.../doc_classes/EditorExportPlatformVisionOS.xml | 3 +++
platform/visionos/export/export_plugin.cpp | 1 +
7 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/editor/shader/shader_baker/shader_baker_export_plugin_platform_metal.cpp b/editor/shader/shader_baker/shader_baker_export_plugin_platform_metal.cpp
index 8570b5f164ad3..7bdfffd2111f8 100644
--- a/editor/shader/shader_baker/shader_baker_export_plugin_platform_metal.cpp
+++ b/editor/shader/shader_baker/shader_baker_export_plugin_platform_metal.cpp
@@ -39,14 +39,17 @@ RenderingShaderContainerFormat *ShaderBakerExportPluginPlatformMetal::create_sha
if (os_name == U"macOS") {
min_os_version = (String)p_preset->get("application/min_macos_version_arm64");
+ int min_gpu = p_preset->get("application/min_macos_gpu_family");
// Godot metal doesn't support x86_64 mac so no need to worry about that version
- profile = MetalDeviceProfile::get_profile(MetalDeviceProfile::Platform::macOS, MetalDeviceProfile::GPU::Apple7, min_os_version);
+ profile = MetalDeviceProfile::get_profile(MetalDeviceProfile::Platform::macOS, (MetalDeviceProfile::GPU)min_gpu, min_os_version);
} else if (os_name == U"iOS") {
min_os_version = (String)p_preset->get("application/min_ios_version");
- profile = MetalDeviceProfile::get_profile(MetalDeviceProfile::Platform::iOS, MetalDeviceProfile::GPU::Apple7, min_os_version);
+ int min_gpu = p_preset->get("application/min_ios_gpu_family");
+ profile = MetalDeviceProfile::get_profile(MetalDeviceProfile::Platform::iOS, (MetalDeviceProfile::GPU)min_gpu, min_os_version);
} else if (os_name == U"visionOS") {
min_os_version = (String)p_preset->get("application/min_visionos_version");
- profile = MetalDeviceProfile::get_profile(MetalDeviceProfile::Platform::visionOS, MetalDeviceProfile::GPU::Apple8, min_os_version);
+ int min_gpu = p_preset->get("application/min_visionos_gpu_family");
+ profile = MetalDeviceProfile::get_profile(MetalDeviceProfile::Platform::visionOS, (MetalDeviceProfile::GPU)min_gpu, min_os_version);
} else {
ERR_FAIL_V_MSG(nullptr, vformat("Unsupported platform: %s", os_name));
}
diff --git a/platform/ios/doc_classes/EditorExportPlatformIOS.xml b/platform/ios/doc_classes/EditorExportPlatformIOS.xml
index 4e315ee027327..0d6711a27159f 100644
--- a/platform/ios/doc_classes/EditorExportPlatformIOS.xml
+++ b/platform/ios/doc_classes/EditorExportPlatformIOS.xml
@@ -44,6 +44,9 @@
Interpolation method used to resize application icon.
+
+ The target GPU family for shader baker. See [url=https://developer.apple.com/documentation/metal/mtlgpufamily]MTLGPUFamily[/url].
+
Minimum version of iOS required for this application to run in the [code]major.minor.patch[/code] or [code]major.minor[/code] format, can only contain numeric characters ([code]0-9[/code]) and periods ([code].[/code]).
diff --git a/platform/ios/export/export_plugin.cpp b/platform/ios/export/export_plugin.cpp
index 077aeed4e86ab..eeb100bbe1751 100644
--- a/platform/ios/export/export_plugin.cpp
+++ b/platform/ios/export/export_plugin.cpp
@@ -58,6 +58,7 @@ void EditorExportPlatformIOS::get_export_options(List *r_options)
r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "application/targeted_device_family", PROPERTY_HINT_ENUM, "iPhone,iPad,iPhone & iPad"), 2));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/min_ios_version"), get_minimum_deployment_target()));
+ r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "application/min_ios_gpu_family", PROPERTY_HINT_ENUM, "Apple6:1006,Apple7:1007,Apple8:1008,Apple9:1009"), 1007));
r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "storyboard/image_scale_mode", PROPERTY_HINT_ENUM, "Same as Logo,Center,Scale to Fit,Scale to Fill,Scale"), 0));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "storyboard/custom_image@2x", PROPERTY_HINT_FILE_PATH, "*.png,*.jpg,*.jpeg"), ""));
diff --git a/platform/macos/doc_classes/EditorExportPlatformMacOS.xml b/platform/macos/doc_classes/EditorExportPlatformMacOS.xml
index 076f70708863e..5ead54186089f 100644
--- a/platform/macos/doc_classes/EditorExportPlatformMacOS.xml
+++ b/platform/macos/doc_classes/EditorExportPlatformMacOS.xml
@@ -43,6 +43,9 @@
[b]Note:[/b] Supported when exporting from macOS only, Xcode 26+ required.
[b]Note:[/b] Liquid Glass icons are supported on macOS 26 only, use [member application/icon] to set the icon for older macOS versions.
+
+ The target GPU family for shader baker. See [url=https://developer.apple.com/documentation/metal/mtlgpufamily]MTLGPUFamily[/url].
+
Minimum version of macOS required for this application to run on Apple Silicon Macs, in the [code]major.minor.patch[/code] or [code]major.minor[/code] format, can only contain numeric characters ([code]0-9[/code]) and periods ([code].[/code]).
diff --git a/platform/macos/export/export_plugin.cpp b/platform/macos/export/export_plugin.cpp
index 8ef591389fb56..ce7614bf0aff5 100644
--- a/platform/macos/export/export_plugin.cpp
+++ b/platform/macos/export/export_plugin.cpp
@@ -497,6 +497,7 @@ void EditorExportPlatformMacOS::get_export_options(List *r_options
r_options->push_back(ExportOption(PropertyInfo(Variant::DICTIONARY, "application/copyright_localized", PROPERTY_HINT_LOCALIZABLE_STRING), Dictionary()));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/min_macos_version_x86_64"), "11.00"));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/min_macos_version_arm64"), "13.00"));
+ r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "application/min_macos_gpu_family", PROPERTY_HINT_ENUM, "Apple7:1007,Apple8:1008,Apple9:1009"), 1007));
r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "application/export_angle", PROPERTY_HINT_ENUM, "Auto,Yes,No"), 0, true));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "display/high_res"), true));
diff --git a/platform/visionos/doc_classes/EditorExportPlatformVisionOS.xml b/platform/visionos/doc_classes/EditorExportPlatformVisionOS.xml
index fd3db6e7c94cc..adf1350dd908d 100644
--- a/platform/visionos/doc_classes/EditorExportPlatformVisionOS.xml
+++ b/platform/visionos/doc_classes/EditorExportPlatformVisionOS.xml
@@ -50,6 +50,9 @@
Initial immersion style, only applicable if you have chosen the [code]Immersive[/code] app role. It can be [code]Full[/code] for a VR experience; [code]Mixed[/code] for a mixed reality experience where the rendered content is displayed along with the real environment; or [code]Progressive[/code] for a portal style experience where the user controls the immersion level. Change it at runtime with [member VisionOSXRInterface.immersion_style].
+
+ The target GPU family for shader baker. See [url=https://developer.apple.com/documentation/metal/mtlgpufamily]MTLGPUFamily[/url].
+
diff --git a/platform/visionos/export/export_plugin.cpp b/platform/visionos/export/export_plugin.cpp
index 1bbaf9de256c9..0d7ba053038d6 100644
--- a/platform/visionos/export/export_plugin.cpp
+++ b/platform/visionos/export/export_plugin.cpp
@@ -57,6 +57,7 @@ void EditorExportPlatformVisionOS::get_export_options(List *r_opti
EditorExportPlatformAppleEmbedded::get_export_options(r_options);
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/min_visionos_version"), get_minimum_deployment_target()));
+ r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "application/min_visionos_gpu_family", PROPERTY_HINT_ENUM, "Apple8:1008,Apple9:1009"), 1008));
r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "application/app_role", PROPERTY_HINT_ENUM, "Window,Immersive"), 0));
r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "application/immersion_style", PROPERTY_HINT_ENUM, "Full,Mixed,Progressive"), 1));