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

Hide menu BackgroundCache node to fully benefit from async. pipeline compilation #191

Merged
merged 1 commit into from
Oct 4, 2024

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Sep 23, 2024

Explanation courtesy of @DarioSamo:

This was an attempt by the game to cache the pipelines ahead of time for the bullet. However, the title screen does not use SDFGI or VoxelGI, so the ubershader pipeline pre-compilation is not detecting it should create these pipelines.

The extra two to four pipelines we're seeing on the first shot are the new pipelines encountered due to the fact the effect only gets enabled when starting the game, but the instancing of this bullet ahead of time is not done there instead.

Merely instancing the bullet scene as hidden fixes this issue immediately, as hidden surfaces are added to the cache.

A side effect of this change is that menu.tscn no longer needs to store a lot of properties, so it becomes a lot smaller and should load faster too.

This change requires Godot 4.4 (master branch).

@DarioSamo
Copy link

This doesn't seem quite correct. In theory the real effective way is that this trick is no longer required. I'll verify if this is the case by deleting the node altogether.

@DarioSamo
Copy link

DarioSamo commented Sep 25, 2024

These are actually what need to be done on the PR.

  • Background cache node from the menu needs to be deleted. It's no longer useful and it actually reduces initial load times. It's best to let the real loading screen take care of compiling the red robot's pipelines in parallel.
  • An invisible version of the bullet scene needs to be attached to the player and hidden in the tree. The sound effect of that particular bullet instance needs to be muted as well. This allows the surface construction step on the first frame to detect the particle effect and pre-compile its pipelines.
  • The same needs to be repeated for the impact effect on the red robot, which is only instantiated when the robot shoots at the player. Luckily no SFX is attached to this one.

…compilation

This was an attempt by the game to cache the pipelines ahead of time
for the bullet. However, the title screen does not use SDFGI or VoxelGI,
so the ubershader pipeline pre-compilation is not detecting it should
create these pipelines.

The extra two to four pipelines we're seeing on the first shot are the
new pipelines encountered due to the fact the effect only gets enabled
when starting the game, but the instancing of this bullet ahead of time
is not done there instead.

Merely instancing the bullet scene as hidden fixes this issue immediately,
as hidden surfaces are added to the cache.
@Calinou Calinou force-pushed the use-async-pipeline-compilation branch from 39b652f to e80c507 Compare September 25, 2024 20:58
@Calinou
Copy link
Member Author

Calinou commented Sep 25, 2024

These are actually what need to be done on the PR.

I've applied all 3 suggestions.

@DarioSamo
Copy link

I can confirm the latest version works as intended. 👍

@DarioSamo
Copy link

godotengine/godot#90400 is merged, so we can go ahead with this as well.

@Calinou Calinou merged commit 3a92da2 into godotengine:master Oct 4, 2024
1 check passed
@Calinou Calinou deleted the use-async-pipeline-compilation branch October 4, 2024 18:59
emrecrpnl pushed a commit to emrecrpnl/tps-demo that referenced this pull request Oct 8, 2024
…compilation (godotengine#191)

This was an attempt by the game to cache the pipelines ahead of time
for the bullet. However, the title screen does not use SDFGI or VoxelGI,
so the ubershader pipeline pre-compilation is not detecting it should
create these pipelines.

The extra two to four pipelines we're seeing on the first shot are the
new pipelines encountered due to the fact the effect only gets enabled
when starting the game, but the instancing of this bullet ahead of time
is not done there instead.

Merely instancing the bullet scene as hidden fixes this issue immediately,
as hidden surfaces are added to the cache.
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.

3 participants