Skip to content

Commit d334ecb

Browse files
committed
Add documentation on shader baking
1 parent 2c708f6 commit d334ecb

File tree

2 files changed

+55
-2
lines changed

2 files changed

+55
-2
lines changed

tutorials/export/feature_tags.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ Here is a list of most feature tags in Godot. Keep in mind they are **case-sensi
132132
+----------------------+-----------------------------------------------------------------------------------------+
133133
| **movie** | :ref:`Movie Maker mode <doc_creating_movies>` is active |
134134
+----------------------+-----------------------------------------------------------------------------------------+
135-
| **shader_baker** | Project was exported with shader baking enabled |
136-
| | (only applies to the exported project, not when running in the editor) |
135+
| **shader_baker** | Project was exported with :ref:`shader baking <doc_pipeline_compilations_shader_baker>` |
136+
| | enabled (only applies to the exported project, not when running in the editor) |
137137
+----------------------+-----------------------------------------------------------------------------------------+
138138
| **dedicated_server** | Project was exported as a :ref:`dedicated server <doc_exporting_for_dedicated_servers>` |
139139
| | (only applies to the exported project, not when running in the editor) |

tutorials/performance/pipeline_compilations.rst

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,3 +208,56 @@ you can attach the effect as a child of the player as an invisible node. Make
208208
sure to disable the script attached to the hidden node or to hide any other
209209
nodes that could cause issues, which can be done by enabling **Editable
210210
Children** on the node.
211+
212+
.. _doc_pipeline_compilations_shader_baker:
213+
214+
Shader baker
215+
------------
216+
217+
Since Godot 4.5, you can choose to bake shaders on export to improve initial
218+
startup time. This will generally not resolve existing stutters, but it will
219+
reduce the time it takes to load the game for the first time. This is especially
220+
the case when using Direct3D 12 or Metal, which have significantly slower initial
221+
shader compilation times than Vulkan due to the conversion step required.
222+
Godot's own shaders use GLSL and SPIR-V, but Direct3D 12 and Metal use
223+
different formats.
224+
225+
.. note::
226+
227+
The shader baker can only bake the source into the intermediate format
228+
(SPIR-V for Vulkan, DXIL for Direct3D 12, MIL for Metal). It cannot bake
229+
the intermediate format into the final pipeline, as this is
230+
dependent on the GPU driver and the hardware.
231+
232+
The shader baker is not a replacement for pipeline precompilation,
233+
but it aims to complement it.
234+
235+
When enabled, the shader baker will bundle compiled shader code into the PCK,
236+
which results in the shader compilation step being skipped entirely.
237+
The downside is that exporting will take slightly longer. The PCK file
238+
will be larger by a few megabytes.
239+
240+
The shader baker is disabled by default, but you can enable it in each
241+
export preset in the Export dialog by ticking the :ui:`Shader Baker > Enabled`
242+
export option.
243+
244+
Note that shader baking will only be able to export shaders for drivers supported
245+
by the platform the editor is currently running on:
246+
247+
- The editor running on Windows can export shaders for Vulkan and Direct3D 12.
248+
- The editor running on macOS can export shaders for Vulkan and Metal.
249+
- The editor running on Linux can export shaders for Vulkan only.
250+
- The editor running on Android can export shaders for Vulkan only.
251+
252+
The shader baker will only export shaders that match the
253+
``rendering/rendering_device/driver`` project setting for the target platform.
254+
255+
.. note::
256+
257+
The shader baker is only supported for the Forward+ and Mobile renderers.
258+
It will have no effect if the project uses the Compatibility renderer,
259+
or for users who make use of the Compatibility fallback due to their
260+
hardware not supporting the Forward+ or Mobile renderer.
261+
262+
This also means the shader baker is not supported on the web platform,
263+
as the web platform only supports the Compatibility renderer.

0 commit comments

Comments
 (0)