godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.6k stars 21.1k forks source link

Import glsl shaders in headless mode #94734

Open TCROC opened 3 months ago

TCROC commented 3 months ago

Tested versions

4.3.beta.mono.custom_build.ba7c5b0c8

System information

Godot v4.3.beta.mono (ba7c5b0c8) - Pop!_OS 22.04 LTS - Wayland - Vulkan (Forward+) - dedicated Intel(R) Arc(tm) A750 Graphics (DG2) - AMD Ryzen 7 5800X 8-Core Processor (16 Threads)

Issue description

Godot currently doesn't support importing glsl shaders in a headless context. This creates a problem for continuous integration / pipelines. @clayjohn worded it perfectly in the rocket chat so I'll just quote it here:

This is a very valuable workflow when you are targeting multiple platforms and becomes super important when working with a team. Basically everyone on the team can work on the platform of their choice, then the CI makes an export build for all target platforms and then you can test release builds on all platforms

Since CI doesn't have a GPU, you have to be able to import all resources, then export the game without access to a GPU. Ultimately, the game will be played on a device with a GPU, but the import/export process happens without one

This appears to be the PR that disabled glsl imports in headless mode: https://github.com/godotengine/godot/pull/92539

I tried simply reverting that PR and interestingly, it does seem to import the glsl shader. However, it crashes in the exported project when that shader is loaded if it wasn't previously loaded in a non-headless context.

Steps to reproduce

  1. Clone the proton scatter repo or use the zipped mrp (which is also just the proton scatter repo): https://github.com/HungryProton/scatter.git
  2. Open in godot
  3. Notice that the trees are loading in the showcase scene.
  4. Create an export preset
  5. Delete the .godot folder in the project directory so there aren't any cached imports.
  6. Run the command: godot --headless --path path/to/project --import
  7. Notice the errors regarding failed glsl imports.
  8. Run the command: godot --headless --path path/to/project --export-debug PresetName path/to/export/game.exe
  9. Notice the errors regarding glsl
  10. Start the exported game and notice that the trees no longer load

Minimal reproduction project (MRP)

scatter.zip

https://github.com/HungryProton/scatter.git

TCROC commented 3 days ago

@Repiteo this issue shouldn't be closed. The PRs that went through were for separate issues. I believe they may have even referenced the fact that they don't resolve this issue. I can see how an automated system may have incorrectly attached this issue to one of those PRs 😅

TCROC commented 3 days ago

@akien-mga @AThousandShips This issue should still be open.

Thanks everyone :)

AThousandShips commented 3 days ago

The reason this was closed is you wrote "when issue gets resolved: #94734", you linked it yourself, make sure you pay attention to the special labels (and pay attention to the side bar where they are listed)

TCROC commented 3 days ago

Ah I see. I will pay attention to it going into the future. Thanks for the heads up :)