Skip to content

Commit a58b91a

Browse files
committed
Document Metal support in Internal rendering architecture
1 parent 68d4c35 commit a58b91a

File tree

1 file changed

+30
-22
lines changed

1 file changed

+30
-22
lines changed

contributing/development/core_and_modules/internal_rendering_architecture.rst

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ ask in the ``#rendering`` channel of the
2020
recommended to go through an OpenGL tutorial such as
2121
`LearnOpenGL <https://learnopengl.com/>`__.
2222

23-
Modern low-level APIs (Vulkan/Direct3D 12) require intermediate
23+
Modern low-level APIs (Vulkan/Direct3D 12/Metal) require intermediate
2424
knowledge of higher-level APIs (OpenGL/Direct3D 11) to be used
2525
effectively. Thankfully, contributors rarely need to work directly with
2626
low-level APIs. Godot's renderers are built entirely on OpenGL and
27-
RenderingDevice, which is our abstraction over Vulkan/Direct3D 12.
27+
RenderingDevice, which is our abstraction over Vulkan/Direct3D 12/Metal.
2828

2929
.. _doc_internal_rendering_architecture_methods:
3030

@@ -109,7 +109,7 @@ Compatibility
109109
.. note::
110110

111111
This is the only rendering method available when using the OpenGL driver.
112-
This rendering method is not available when using Vulkan or Direct3D 12.
112+
This rendering method is not available when using Vulkan, Direct3D 12, or Metal.
113113

114114
This is a traditional (non-clustered) forward renderer. Internally, it is called
115115
**GL Compatibility**. It's intended for old GPUs that don't have Vulkan support,
@@ -208,20 +208,23 @@ for more information.
208208
Metal
209209
~~~~~
210210

211-
Godot supports Metal rendering via `MoltenVK <https://github.com/KhronosGroup/MoltenVK>`__,
212-
as macOS and iOS do not support Vulkan natively.
213-
This is done automatically when specifying the Vulkan driver in the Project Settings.
211+
Godot provides a native Metal driver that works on all Apple Silicon hardware
212+
(macOS ARM). Compared to using the MoltenVK translation layer, this is
213+
significantly faster, particularly in CPU-bound scenarios.
214214

215-
MoltenVK makes driver maintenance easy at the cost of some performance overhead.
216-
Also, MoltenVK has several limitations that a native Metal driver implementation
217-
wouldn't have. Both the clustered and mobile
218-
:ref:`doc_internal_rendering_architecture_methods` can be used with a Metal
219-
backend via MoltenVK.
215+
Both the Forward+ and Mobile :ref:`doc_internal_rendering_architecture_methods` can be
216+
used with Metal.
217+
218+
:ref:`doc_internal_rendering_architecture_core_shaders` are shared with the
219+
Vulkan renderer. Shaders are transpiled from GLSL to :abbr:`MSL (Metal Shading Language)`
220+
using SPIRV-Cross.
220221

221-
.. UPDATE: Planned feature. When the native Metal driver is implemented, update this.
222+
Godot also supports Metal rendering via `MoltenVK <https://github.com/KhronosGroup/MoltenVK>`__,
223+
which is used as a fallback when native Metal support is not available (e.g. on x86 macOS).
222224

223-
A native Metal driver is planned in the future for better performance and
224-
compatibility.
225+
**This driver is still experimental and only available in Godot 4.4 and later.**
226+
See the `pull request that introduced Metal support <https://github.com/godotengine/godot/pull/88199>`__
227+
for more information.
225228

226229
OpenGL
227230
~~~~~~
@@ -250,13 +253,13 @@ Summary of rendering drivers/methods
250253

251254
The following rendering API + rendering method combinations are currently possible:
252255

253-
- Vulkan + Forward+
254-
- Vulkan + Mobile
256+
- Vulkan + Forward+ (optionally through MoltenVK on macOS and iOS)
257+
- Vulkan + Mobile (optionally through MoltenVK on macOS and iOS)
255258
- Direct3D 12 + Forward+
256259
- Direct3D 12 + Mobile
257-
- Metal + Forward+ (via MoltenVK)
258-
- Metal + Mobile (via MoltenVK)
259-
- OpenGL + Compatibility
260+
- Metal + Forward+
261+
- Metal + Mobile
262+
- OpenGL + Compatibility (optionally through ANGLE on Windows and macOS)
260263

261264
Each combination has its own limitations and performance characteristics. Make
262265
sure to test your changes on all rendering methods if possible before opening a
@@ -273,10 +276,10 @@ To make the complexity of modern low-level graphics APIs more manageable,
273276
Godot uses its own abstraction called RenderingDevice.
274277

275278
This means that when writing code for modern rendering methods, you don't
276-
actually use the Vulkan or Direct3D 12 APIs directly. While this is still
279+
actually use the Vulkan, Direct3D 12, or Metal APIs directly. While this is still
277280
lower-level than an API like OpenGL, this makes working on the renderer easier,
278281
as RenderingDevice will abstract many API-specific quirks for you. The
279-
RenderingDevice presents a similar level of abstraction as Metal or WebGPU.
282+
RenderingDevice presents a similar level of abstraction as WebGPU.
280283

281284
**Vulkan RenderingDevice implementation:**
282285

@@ -286,6 +289,10 @@ RenderingDevice presents a similar level of abstraction as Metal or WebGPU.
286289

287290
- `drivers/d3d12/rendering_device_driver_d3d12.cpp <https://github.com/godotengine/godot/blob/master/drivers/d3d12/rendering_device_driver_d3d12.cpp>`__
288291

292+
**Metal RenderingDevice implementation:**
293+
294+
- `drivers/metal/rendering_device_driver_metal.mm <https://github.com/godotengine/godot/blob/master/drivers/metal/rendering_device_driver_metal.mm>`__
295+
289296
Core rendering classes architecture
290297
-----------------------------------
291298

@@ -743,7 +750,8 @@ Occlusion culling
743750
~~~~~~~~~~~~~~~~~
744751

745752
While modern GPUs can handle drawing a lot of triangles, the number of draw
746-
calls in complex scenes can still be a bottleneck (even with Vulkan and Direct3D 12).
753+
calls in complex scenes can still be a bottleneck (even with Vulkan, Direct3D 12,
754+
and Metal).
747755

748756
Godot 4 supports occlusion culling to reduce overdraw (when the depth prepass
749757
is disabled) and reduce vertex throughput.

0 commit comments

Comments
 (0)