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

Global Uniforms can be lost if generated as local instead of saved to filesystem. #62610

Open
MarianoGnu opened this issue Jul 1, 2022 · 0 comments

Comments

@MarianoGnu
Copy link
Contributor

Godot version

v4.0.alpha.custom_build [e75bd53] (local build July 1st 2022)

System information

Windows 10, AMD Radeon RX 5500 XT

Issue description

When creating a Sampler2D Global Uniform, it provides a meni for "New TextureSubclass", so if in example i create a GradientTexture from there, it will work as expected while the editor is open, however ProjectSettings will not store it in the project settings, what it stores is just the filepath to the resource, because this resource is anonimous it simply stores an empty string, and as a result the global uniform fails to be loaded in the next run and simply ignored.
https://i.imgur.com/KvvuPii.png

As a workaround to this issue, the solution is to first store the new texture resource to a file and then Load it from the Global Uniforms tab in the project settings:
https://i.imgur.com/FcmjOay.png

Steps to reproduce

  1. Open ProjectSettings Dialogs, navigate to the Shader Globals tab, and create a new global of type "Sampler2D" and press Add
  2. Press on the dropdown and select New GradientTexture1D
    https://i.imgur.com/bErMXpa.png
  3. Press on the resource to expand the properties and create a new gradient
    https://i.imgur.com/3zvABqB.png
  4. Should look something like this:
    https://i.imgur.com/oK4tbwL.png
    5A. Save the current scene to make sure Project Settings was stored, then kill and relaunch the Editor, and navigate again to the Shader Globals tab on Project Settings dialog
    5B. After following the first 4 steps you can also try the following: right click on the resource and select Save and assign a filepath, then save the current scene, close, and relaunch the editor. Then navigate again to the Shader Globals tab in Project Settings dialog

Expected result
A alternative: "local to project" resource is stored in project settings and saved and loaded
B alternative: when saving the project settings it detects an orphan resource has been assigned and shows a warning to the user asking him to store it into a file
C alternative: completely remove the New Resource and Make Unique options in the menu when assigning a resource and only give options for Load and Quick Load
C neighterway: if a resource is saved from the project setting window (like described in 5B reproduction steps) then store the path to the file just created instead of require to Load it again

Actual result
When navigating again to the Shader Globals tab in Project Settings dialog the global uniform is totally removed like if never added in first place, and any shader referencing them is failing to compile because of missing global uniform
https://i.imgur.com/eZRbEc8.png

Minimal reproduction project

This can be reproduced on any empty project just following the steps (and the result would be the same as uploading an empty project file)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants