Skip to content

Conversation

@blueskythlikesclouds
Copy link
Contributor

@blueskythlikesclouds blueskythlikesclouds commented Oct 17, 2025

Follow-up PR to #111356.

Shader Conversion Time Reduction

Partner PR: godotengine/godot-nir-static#23

Reduces shader conversion time up to 2x - 2.5x depending on the project. In TPS Demo, the loading screen goes from 82 seconds to 33 seconds on my system. For reference, Vulkan is 15 seconds.

NOTE: If you want to make a comparison yourself, you need to clear both Godot and driver shader caches before each launch to have a fair comparison:

  • Editor shader cache: project/.godot/shader_cache
  • Game shader cache: %APPDATA%/Godot/app_userdata/project/shader_cache
  • NVIDIA shader cache: %LOCALAPPDATA%/NVIDIA
  • AMD shader cache: %LOCALAPPDATA%/AMD

Specialization Constants Bitmasking Fix

Partner PR: godotengine/godot-nir-static#22

Old behavior used to set the second MSB to 1, then mask that out inside the DXIL shader. We shouldn't do that anymore now that we allow all of the specialization constant bits.

This was causing less shadow map samples to be used, notably with the "Soft High (Slow)" mode for "Soft Shadow Filter Quality" parameter:

Upstream This PR
Upstream PR

@blueskythlikesclouds blueskythlikesclouds force-pushed the fix-spec-constant-bitmasking branch from 9745048 to 8895dfa Compare November 3, 2025 09:15
@blueskythlikesclouds blueskythlikesclouds changed the title Fix second MSB in specialization constants getting masked out in D3D12. D3D12: Greatly reduce shader conversion time & fix spec constant bitmasking. Nov 3, 2025
@blueskythlikesclouds blueskythlikesclouds marked this pull request as ready for review November 3, 2025 10:45
@blueskythlikesclouds blueskythlikesclouds requested review from a team as code owners November 3, 2025 10:45
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.

Looks good.

We should also update the build scripts used by official builds here:
https://github.com/godotengine/godot-build-scripts/blob/main/build.sh#L193-L195

I'll send a PR and make sure to re-download the deps for the next 4.6 build.

Is this update suitable as is for potential 4.5.x too, or would be need to cherry-pick the removal of the validation check?

@blueskythlikesclouds
Copy link
Contributor Author

I think this should be 4.6 only, since that's the version we want to hopefully default to D3D12.

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.

4 participants