You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-10 13:00:37 +00:00
Add Metal support for macOS (arm64) and iOS
This commit is contained in:
committed by
Rémi Verschelde
parent
826de7976a
commit
2d0165574d
@@ -1935,6 +1935,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
||||
{
|
||||
String driver_hints = "";
|
||||
String driver_hints_with_d3d12 = "";
|
||||
String driver_hints_with_metal = "";
|
||||
|
||||
{
|
||||
Vector<String> driver_hints_arr;
|
||||
@@ -1947,18 +1948,25 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
||||
driver_hints_arr.push_back("d3d12");
|
||||
#endif
|
||||
driver_hints_with_d3d12 = String(",").join(driver_hints_arr);
|
||||
|
||||
#ifdef METAL_ENABLED
|
||||
// Make metal the preferred and default driver.
|
||||
driver_hints_arr.insert(0, "metal");
|
||||
#endif
|
||||
driver_hints_with_metal = String(",").join(driver_hints_arr);
|
||||
}
|
||||
|
||||
String default_driver = driver_hints.get_slice(",", 0);
|
||||
String default_driver_with_d3d12 = driver_hints_with_d3d12.get_slice(",", 0);
|
||||
String default_driver_with_metal = driver_hints_with_metal.get_slice(",", 0);
|
||||
|
||||
// For now everything defaults to vulkan when available. This can change in future updates.
|
||||
GLOBAL_DEF_RST_NOVAL("rendering/rendering_device/driver", default_driver);
|
||||
GLOBAL_DEF_RST_NOVAL(PropertyInfo(Variant::STRING, "rendering/rendering_device/driver.windows", PROPERTY_HINT_ENUM, driver_hints_with_d3d12), default_driver_with_d3d12);
|
||||
GLOBAL_DEF_RST_NOVAL(PropertyInfo(Variant::STRING, "rendering/rendering_device/driver.linuxbsd", PROPERTY_HINT_ENUM, driver_hints), default_driver);
|
||||
GLOBAL_DEF_RST_NOVAL(PropertyInfo(Variant::STRING, "rendering/rendering_device/driver.android", PROPERTY_HINT_ENUM, driver_hints), default_driver);
|
||||
GLOBAL_DEF_RST_NOVAL(PropertyInfo(Variant::STRING, "rendering/rendering_device/driver.ios", PROPERTY_HINT_ENUM, driver_hints), default_driver);
|
||||
GLOBAL_DEF_RST_NOVAL(PropertyInfo(Variant::STRING, "rendering/rendering_device/driver.macos", PROPERTY_HINT_ENUM, driver_hints), default_driver);
|
||||
GLOBAL_DEF_RST_NOVAL(PropertyInfo(Variant::STRING, "rendering/rendering_device/driver.ios", PROPERTY_HINT_ENUM, driver_hints_with_metal), default_driver_with_metal);
|
||||
GLOBAL_DEF_RST_NOVAL(PropertyInfo(Variant::STRING, "rendering/rendering_device/driver.macos", PROPERTY_HINT_ENUM, driver_hints_with_metal), default_driver_with_metal);
|
||||
|
||||
GLOBAL_DEF_RST("rendering/rendering_device/fallback_to_vulkan", true);
|
||||
GLOBAL_DEF_RST("rendering/rendering_device/fallback_to_d3d12", true);
|
||||
@@ -2232,6 +2240,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
||||
#endif
|
||||
#ifdef D3D12_ENABLED
|
||||
available_drivers.push_back("d3d12");
|
||||
#endif
|
||||
#ifdef METAL_ENABLED
|
||||
available_drivers.push_back("metal");
|
||||
#endif
|
||||
}
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
Reference in New Issue
Block a user