Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document Metal support in Internal rendering architecture #9385

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions about/list_of_features.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,14 @@ Editor
Rendering
---------

3 rendering *methods* (running over 2 rendering *drivers*) are available:

- **Forward+**, running over Vulkan 1.0 (with optional Vulkan 1.1 and 1.2
features). The most advanced graphics backend, suited for desktop platforms
only. Used by default on desktop platforms.
- **Forward Mobile**, running over Vulkan 1.0 (with optional Vulkan 1.1 and 1.2
features). Less features, but renders simple scenes faster. Suited for mobile
and desktop platforms. Used by default on mobile platforms.
3 rendering *methods* (running over 4 rendering *drivers*) are available:

- **Forward+**, running over Vulkan / Direct3D 12 / Metal. The most advanced
graphics backend, suited for desktop platforms only. Used by default on
desktop platforms.
- **Forward Mobile**, running over Vulkan / Direct3D 12 / Metal. Less features,
but renders simple scenes faster. Suited for mobile and desktop platforms.
Used by default on mobile platforms.
Comment on lines +98 to +105
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
3 rendering *methods* (running over 4 rendering *drivers*) are available:
- **Forward+**, running over Vulkan / Direct3D 12 / Metal. The most advanced
graphics backend, suited for desktop platforms only. Used by default on
desktop platforms.
- **Forward Mobile**, running over Vulkan / Direct3D 12 / Metal. Less features,
but renders simple scenes faster. Suited for mobile and desktop platforms.
Used by default on mobile platforms.
Godot 4 includes three renderers:
- **Forward+**. The most advanced renderer, suited for desktop platforms only.
Used by default on desktop platforms. This renderer uses **Vulkan**, **Direct3D 12**,
or **Metal** as the rendering driver, and it uses the **RenderingDevice** backend.
- **Mobile**. Fewer features, but renders simple scenes faster. Suited for mobile
and desktop platforms. Used by default on mobile platforms. This renderer uses
**Vulkan**, **Direct3D 12**, or **Metal** as the rendering driver, and it uses
the **RenderingDevice** backend.

This is what I currently have for this section in #10183. It's word-for-word the same Renderers page summaryin that PR, too.

- **Compatibility**, running over OpenGL 3.3 / OpenGL ES 3.0 / WebGL 2.0. The least
advanced graphics backend, suited for low-end desktop and mobile platforms.
Used by default on the web platform.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ ask in the ``#rendering`` channel of the
recommended to go through an OpenGL tutorial such as
`LearnOpenGL <https://learnopengl.com/>`__.

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

.. _doc_internal_rendering_architecture_methods:

Expand Down Expand Up @@ -108,7 +108,7 @@ Compatibility
.. note::

This is the only rendering method available when using the OpenGL driver.
This rendering method is not available when using Vulkan or Direct3D 12.
This rendering method is not available when using Vulkan, Direct3D 12 or Metal.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This rendering method is not available when using Vulkan, Direct3D 12 or Metal.
This rendering method is not available when using Vulkan, Direct3D 12, or Metal.


This is a traditional (non-clustered) forward renderer. It's intended for old
GPUs that don't have Vulkan support, but still works very efficiently on newer
Expand Down Expand Up @@ -207,18 +207,23 @@ for more information.
Metal
^^^^^

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

MoltenVK makes driver maintenance easy at the cost of some performance overhead.
Also, MoltenVK has several limitations that a native Metal driver implementation
wouldn't have. Both the clustered and mobile
:ref:`doc_internal_rendering_architecture_methods` can be used with a Metal
backend via MoltenVK.
Both the Forward+ and Mobile :ref:`doc_internal_rendering_architecture_methods` can be
used with Metal.

:ref:`doc_internal_rendering_architecture_core_shaders` are shared with the
Vulkan renderer. Shaders are transpiled from GLSL to :abbr:`MSL (Metal Shading Language)`
using SPIRV-Cross.
mhilbrunner marked this conversation as resolved.
Show resolved Hide resolved

A native Metal driver is planned in the future for better performance and
compatibility.
Godot also supports Metal rendering via `MoltenVK <https://github.com/KhronosGroup/MoltenVK>`__,
which is used as a fallback when native Metal support is not available (e.g. on x86 macOS).

**This driver is still experimental and only available in Godot 4.x (TODO) and later.**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**This driver is still experimental and only available in Godot 4.x (TODO) and later.**
**This driver is still experimental and only available in Godot 4.4 and later.**

See the `pull request that introduced Metal support <https://github.com/godotengine/godot/pull/88199>`__
for more information.

OpenGL
^^^^^^
Expand Down Expand Up @@ -247,13 +252,13 @@ Summary of rendering drivers/methods

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

- Vulkan + Forward+
- Vulkan + Forward Mobile
- Vulkan + Forward+ (optionally through MoltenVK on macOS and iOS)
- Vulkan + Forward Mobile (optionally through MoltenVK on macOS and iOS)
- Direct3D 12 + Forward+
- Direct3D 12 + Forward Mobile
- Metal + Forward+ (via MoltenVK)
- Metal + Forward Mobile (via MoltenVK)
- OpenGL + Compatibility
- Metal + Forward+
- Metal + Forward Mobile
- OpenGL + Compatibility (optionally through ANGLE on Windows and macOS)

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

This means that when writing code for modern rendering methods, you don't
actually use the Vulkan or Direct3D 12 APIs directly. While this is still
actually use the Vulkan, Direct3D 12 or Metal APIs directly. While this is still
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
actually use the Vulkan, Direct3D 12 or Metal APIs directly. While this is still
actually use the Vulkan, Direct3D 12, or Metal APIs directly. While this is still

lower-level than an API like OpenGL, this makes working on the renderer easier,
as RenderingDevice will abstract many API-specific quirks for you. The
RenderingDevice presents a similar level of abstraction as Metal or WebGPU.
RenderingDevice presents a similar level of abstraction as WebGPU.

**Vulkan RenderingDevice implementation:**

Expand All @@ -283,6 +288,10 @@ RenderingDevice presents a similar level of abstraction as Metal or WebGPU.

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

**Metal RenderingDevice implementation:**

- `drivers/metal/rendering_device_driver_metal.mm <https://github.com/godotengine/godot/blob/master/drivers/metal/rendering_device_driver_metal.mm>`__

Core rendering classes architecture
-----------------------------------

Expand Down Expand Up @@ -736,7 +745,8 @@ Occlusion culling
^^^^^^^^^^^^^^^^^

While modern GPUs can handle drawing a lot of triangles, the number of draw
calls in complex scenes can still be a bottleneck (even with Vulkan and Direct3D 12).
calls in complex scenes can still be a bottleneck (even with Vulkan, Direct3D 12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
calls in complex scenes can still be a bottleneck (even with Vulkan, Direct3D 12
calls in complex scenes can still be a bottleneck (even with Vulkan, Direct3D 12,

and Metal).

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