X Tutup
Skip to content

Disable shader baker when exporting as dedicated server#112361

Merged
akien-mga merged 1 commit intogodotengine:masterfrom
Calinou:export-dedicated-server-no-shader-baker
Dec 9, 2025
Merged

Disable shader baker when exporting as dedicated server#112361
akien-mga merged 1 commit intogodotengine:masterfrom
Calinou:export-dedicated-server-no-shader-baker

Conversation

@Calinou
Copy link
Member

@Calinou Calinou commented Nov 3, 2025

Dedicated server exports don't perform any rendering, so there's no point in including baked shaders. Doing so saves a few MBs in PCK size if the shader baker was enabled in the export options.

Testing project: test_export_dedicated_server.zip

Preview

File sizes in bytes for ZIP main packs before and after this PR:

1799328 client_master.zip
1793511 client_pr.zip

1791818 server_master.zip
   2056 server_pr.zip

I exported as ZIP so it's easy to inspect, but you get similar savings in PCK too.

client_master.zip
client_pr.zip

server_master.zip
server_pr.zip

Dedicated server exports don't perform any rendering, so there's no point
in including baked shaders. Doing so saves a few MBs in PCK size if the
shader baker was enabled in the export options.
@Calinou Calinou added this to the 4.6 milestone Nov 3, 2025
@Calinou Calinou requested review from a team as code owners November 3, 2025 23:27
@Calinou Calinou requested review from a team as code owners November 3, 2025 23:27
@Calinou Calinou requested a review from a team November 3, 2025 23:27
@Calinou Calinou added topic:export cherrypick:4.5 Considered for cherry-picking into a future 4.5.x release labels Nov 3, 2025
Copy link
Member

@clayjohn clayjohn left a comment

Choose a reason for hiding this comment

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

Shouldn't this just force disable "shader_baker/enabled" when using a dedicated server so that we don't have to add checks in multiple places?

@Calinou
Copy link
Member Author

Calinou commented Nov 5, 2025

Shouldn't this just force disable "shader_baker/enabled" when using a dedicated server so that we don't have to add checks in multiple places?

Do you mean switching the export mode should automatically uncheck the shader_baker/enabled option if it's currently checked? This may lead to inconsistent state if you check it later on, unless we hide the checkbox while the export mode is set to Export as dedicated server.

If we can figure out a consistent way to do it, then it's probably a better idea.

@akien-mga
Copy link
Member

Shouldn't this just force disable "shader_baker/enabled" when using a dedicated server so that we don't have to add checks in multiple places?

Do you mean switching the export mode should automatically uncheck the shader_baker/enabled option if it's currently checked? This may lead to inconsistent state if you check it later on, unless we hide the checkbox while the export mode is set to Export as dedicated server.

If we can figure out a consistent way to do it, then it's probably a better idea.

I think Clay was suggesting to replace:

if (p_preset->get("shader_baker/enabled")) {

with:

if (p_preset->get("shader_baker/enabled") && !p_preset->is_dedicated_server()) {

to always force skipping it without changing the configuration.
You'd add something like "The option is ignored when exporting as dedicated server." in the docs.

CC @dsnopek

@Calinou
Copy link
Member Author

Calinou commented Nov 28, 2025

to always force skipping it without changing the configuration.

This seems to be already what the PR is doing, except I think Clay was referring to a different location in the code (not sure which one).

@KoBeWi
Copy link
Member

KoBeWi commented Dec 2, 2025

You could turn off the baker setting in _export_type_changed(), but it would be nice to also make the setting disabled/hidden, which has to be done in multiple places too, which isn't really an improvement.

Though you could make the condition less repetitive by adding is_shader_baker_enabled() method, which does the double check you perform now.

Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

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

I think it's good enough as is.

@akien-mga akien-mga merged commit 342ba80 into godotengine:master Dec 9, 2025
20 checks passed
@akien-mga
Copy link
Member

Thanks!

@Calinou Calinou deleted the export-dedicated-server-no-shader-baker branch December 12, 2025 01:22
@akien-mga
Copy link
Member

Cherry-picked for 4.5.2.

@akien-mga akien-mga removed the cherrypick:4.5 Considered for cherry-picking into a future 4.5.x release label Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shader baker still exports a shader cache for dedicated server exports

4 participants

X Tutup