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

Shader per-instance uniform error spam if more than 1 mesh with that material is used in the editor #55253

Closed
Tracked by #55871
Whimfoome opened this issue Nov 23, 2021 · 4 comments

Comments

@Whimfoome
Copy link

Whimfoome commented Nov 23, 2021

Godot version

4.0.dev.mono (1e71cab)

System information

Arch Linux, AMDGPU, Vulkan Mobile (Project Renderer)

Issue description

When you add shader material to a mesh, you are able to use instance uniform, so every instance can be with different value.

It works fine, until you add more than 1 of that mesh to a scene. Or something like that, I can't debug it exactly.

Now when you reload the editor and open that scene, I get somewhere like 3000 errors per second and you don't see the meshes. You can stop it by going to the original mesh scene and open it. Once opened you no longer get errors, even in the main scene.

This doesn't really affect the game, but it's really annoying since I have to open that scene every time I open my editor, or I get flooded by errors, and Godot crashes.

image

Error messages follow this pattern:

Uniforms supplied for set (3):
  Set: 3 Binding: 0 Type: UniformBuffer Length: 112
  Set: 3 Binding: 1 Type: Texture Length: 1
  Set: 3 Binding: 2 Type: Texture Length: 1
  Set: 3 Binding: 3 Type: Texture Length: 1
  are not the same format as required by the pipeline shader. Pipeline shader requires the following bindings:
  Set: 0 Binding: 1 Type: Sampler Length: 12
  Set: 0 Binding: 2 Type: Sampler Length: 1
  Set: 0 Binding: 3 Type: Sampler Length: 1
  Set: 0 Binding: 4 Type: Sampler Length: 1
  Set: 0 Binding: 5 Type: StorageBuffer Length: 0
  Set: 0 Binding: 6 Type: StorageBuffer Length: 0
  Set: 0 Binding: 7 Type: StorageBuffer Length: 0
  Set: 0 Binding: 8 Type: UniformBuffer Length: 4224
  Set: 0 Binding: 9 Type: StorageBuffer Length: 0
  Set: 0 Binding: 10 Type: StorageBuffer Length: 0
  Set: 0 Binding: 11 Type: Texture Length: 1
  Set: 0 Binding: 12 Type: Texture Length: 1
  Set: 0 Binding: 13 Type: StorageBuffer Length: 0
  Set: 0 Binding: 14 Type: StorageBuffer Length: 0
  Set: 1 Binding: 0 Type: UniformBuffer Length: 2784
  Set: 1 Binding: 2 Type: Texture Length: 1
  Set: 1 Binding: 3 Type: Texture Length: 1
  Set: 1 Binding: 4 Type: Texture Length: 1
  Set: 1 Binding: 5 Type: Texture Length: 1
  Set: 1 Binding: 6 Type: Texture Length: 2
  Set: 1 Binding: 9 Type: Texture Length: 1
  Set: 1 Binding: 10 Type: Texture Length: 1
  Set: 2 Binding: 0 Type: StorageBuffer Length: 0
  Set: 3 Binding: 0 Type: UniformBuffer Length: 16
  Set: 3 Binding: 1 Type: Texture Length: 1

Steps to reproduce

  1. Open minimal reproduction project
  2. When you open Scene.tscn, you should get many errors, and you shouldn't be able to see the Spheres.
  3. Open Sphere.tscn
  4. Open Scene.tscn and the Spheres should display properly, without errors.

This only affects the Editor, no errors are shown in the actual game.

Minimal reproduction project

ShaderInstanceError.zip

@Calinou Calinou added this to the 4.0 milestone Nov 23, 2021
@Calinou Calinou changed the title Shader Instance Uniform 3000 errors/sec if more than 1 Mesh with that material (Editor only) Shader per-instance uniform error spam if more than 1 mesh with that material is used in the editor Nov 23, 2021
@Whimfoome
Copy link
Author

Update: Happens only on Vulkan Forward Mobile renderer

@Whimfoome Whimfoome changed the title Shader per-instance uniform error spam if more than 1 mesh with that material is used in the editor Vulkan Mobile backend: Shader per-instance uniform error spam if more than 1 mesh with that material is used in the editor Dec 12, 2021
@Whimfoome
Copy link
Author

Maybe related to this issue. When opening multiple scenes with the same mesh inside, sometimes this mesh can only be seen in one scene only, in the others you get a bunch of error messages.

@Whimfoome
Copy link
Author

Okay, tried with newer version of Godot. Maybe it's a caching problem.

Now, you don't have to open every problematic file to fix the errors, you have to just open the main scene, close it, and open it again.

Now I see that the Godot editor remembers my last opened tabs of the project, and when I reload it, it's as if I haven't closed it. Without being aware of this feature, it led me to make a wrong assumption and though the issue was because of the Vulkan Mobile backend, but it happens on Vulkan Clustered too.

This new feature seems to cache the scene or something like that, and most of the times, if I close the project with this scene opened, and open the project again, there aren't any errors; but's it's really inconsistent and doesn't work every time.

@Whimfoome Whimfoome changed the title Vulkan Mobile backend: Shader per-instance uniform error spam if more than 1 mesh with that material is used in the editor Shader per-instance uniform error spam if more than 1 mesh with that material is used in the editor Dec 14, 2021
@Whimfoome
Copy link
Author

Seems like it's fixed in the latest alpha. Amazing!

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

2 participants