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

Vulkan: Using a lot of different materials spams error message #59912

Closed
Tracked by #60036
nonunknown opened this issue Apr 5, 2022 · 16 comments
Closed
Tracked by #60036

Vulkan: Using a lot of different materials spams error message #59912

nonunknown opened this issue Apr 5, 2022 · 16 comments

Comments

@nonunknown
Copy link
Contributor

nonunknown commented Apr 5, 2022

Godot version

v4.0.alpha.mono.custom_build [a647fb3]

System information

manjaro KDE

Issue description

I'm testing the game a lot, this needs to constantly and frequently open and close the game, but suddenly the engine freezes with the following message:

ERROR: Condition "!material" is true.                                                                       ✔ 
   at: material_update_dependency (servers/rendering/renderer_rd/renderer_storage_rd.cpp:462)
ERROR: Condition "!material" is true. Returning: true
   at: material_casts_shadows (servers/rendering/renderer_rd/renderer_storage_rd.cpp:437)
ERROR: Condition "!material" is true. Returning: false
   at: material_is_animated (servers/rendering/renderer_rd/renderer_storage_rd.cpp:424)
ERROR: Condition "!material" is true.
   at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/renderer_storage_rd.cpp:450)

Steps to reproduce

New way:

  • Close the engine by clicking on [X]

Old way:
No Idea how to reproduce, but since its related to materials, I'm using particles, so maybe a possibility could be:

  • Use a lot of materials
  • Close/Open the game a lot of times fast

Minimal reproduction project

N/a

@Calinou Calinou changed the title Godot 4 - Freezing due to materials Vulkan: Using a lot of different materials freezes the engine Apr 5, 2022
@Calinou Calinou added this to the 4.0 milestone Apr 5, 2022
@marstaik
Copy link
Contributor

marstaik commented Apr 5, 2022

How old is this build? This seems related to #58491 - My guess would be that the textures allocated are never freed and the engine runs to exhaustion. But that's just my 2 second analysis.

@nonunknown
Copy link
Contributor Author

5 days ago, you can simply check by going into Godot Version above.

@marstaik
Copy link
Contributor

marstaik commented Apr 5, 2022

Ah my bad, I missed it and I didn't even realize that was a clickable version link 😮

@nonunknown
Copy link
Contributor Author

Just updated the post, I found another bug which was The engine doesnt close via [X] but I found that what doesnt let the engine close is actually this material bug reported above

@Zireael07
Copy link
Contributor

Not too sure if it's the same issue (didn't see the output panel) but I had the engine completely freeze and then crash on me. I only had two scenes opened (main, which does use more materials but not in editor, they're preload()'ed for in-game use, and the prefab I was working on, which only used one material.

Before it froze completely, it exhibited symptoms similar to a memleak...

@nonunknown
Copy link
Contributor Author

@Zireael07 you can open godot with terminal and use a -v argument after the executable name, then when it crashes you can see the output! also I recommend using the debug version, the errors will be more detailed!

@Zylann
Copy link
Contributor

Zylann commented May 16, 2022

I get the material error too in 35596e6

servers\rendering\renderer_rd\storage_rd\material_storage.cpp:2633 - Condition "!material" is true.

It is easy to reproduce by adding a MeshInstance3D to the scene, add a new material override, and close the scene.

It's not really freezing for me, but when there are lots of materials it can take a very long time to endure the spamming. In my case it completely overwhelms VSCode when debugging (thousands of log entries, which is above console capacity), which prevents me from seeing any other errors that could have happened before the spam.

@nonunknown
Copy link
Contributor Author

thanks for showing a way to reproduce, for me the engine is almost unusable, I have to close and open again every 5 min :/

@rcorre
Copy link
Contributor

rcorre commented Aug 14, 2022

FWIW, I'm hitting this using voxel_tools. I only have 1 material, and it doesn't freeze the engine, but I get about 4000 of these errors each time I regenerate the terrain.

@zurrealStudios
Copy link

zurrealStudios commented Sep 19, 2022

So I started getting this Errors while manipulating a Material of an Object through the "Surface Material Override" and was freeing them with "queue_free()"

My Workaround is to set the Override-Material to null before queueing it free:

Char.get_node("Model").set("surface_material_override/0", null)
Char.queue_free()

Edit:
Using Godot 4.0 beta-1

Maybe it has something to do, when something needs to be rendered but is queued free?
Hope this helps a little bit :)

@nonunknown
Copy link
Contributor Author

nonunknown commented Sep 19, 2022

this error is already fixed, I didnt had this issue anymore, also not related to queue_free!

edit: It doesnt freeze the engine anymore, but still spam the error message!

@nonunknown nonunknown reopened this Sep 19, 2022
@nonunknown nonunknown changed the title Vulkan: Using a lot of different materials freezes the engine Vulkan: Using a lot of different materials spams error message Sep 19, 2022
@Goutte
Copy link
Contributor

Goutte commented Nov 1, 2022

I'm seeing the same errors in beta3 when I queue_free() a Node with a surface material override. Unsetting the material right before queue_free(), like @zurrealStudios suggested, makes the error disappear.

Notes (may not be relevant):

  • The culprit material is a StandardMaterial3D
  • The culprit material has resource_local_to_scene = true
  • The culprit material has a next_pass.

@Lippanon
Copy link

Still present in v4.0.beta.custom_build [2ec0da1]:
image
I see these errors when changing scenes or, as mentioned, freeing nodes with active surface_material_override.
A workaround, when applicable, is to use 'material_override' of GeometryInstance3D instead.

@bianpeng001
Copy link

get the same error messages in 4.0rc2

@lucassene
Copy link

lucassene commented Mar 12, 2023

I'm getting a bunch of these errors every time I call queue_free() (deferred or not) on characters in my game:
image
I'm using 4.0-stable.

PS: Doing what @Lippanon suggested, and moving the materials from surfate_material_override to material_override, solves the issue.

@clayjohn
Copy link
Member

I'm closing this in favour of #67144 which is more specific about what is causing the issue and includes an MRP.

Please continue the discussion in #67144

Duplicate of #67144

@clayjohn clayjohn closed this as not planned Won't fix, can't repro, duplicate, stale Mar 13, 2023
@clayjohn clayjohn removed this from the 4.x milestone Mar 13, 2023
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