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

Exiting a running game with a texture bound to a global shader parameter causes a hang and an error. #99129

Closed
bbbscarter opened this issue Nov 12, 2024 · 2 comments

Comments

@bbbscarter
Copy link

Tested versions

  • Reproducible in Godot Engine v4.3.stable.mono.official
  • Using C#.

System information

MacOS 15.1, any renderer

Issue description

Exiting the game causes a hang and the following error:

ERROR: FATAL: Condition "!rc_owner" is true.
   at: _instance_binding_reference_callback (modules/mono/csharp_script.cpp:1237)

This starts happening after using C# to create a texture and bind it to a global shader parameter.

Steps to reproduce

  1. Create a global shader parameter of type sampler2D called "texture_test" in the editor.
  2. Create and bind a texture to it in code:
public override void _Ready() {
  var _testImage = new Image();
  _testImage = Image.CreateEmpty(256, 256, false, Image.Format.Rgba8);
  var _testTexture = ImageTexture.CreateFromImage(_testImage);

  RenderingServer.GlobalShaderParameterSet("texture_test", _testTexture);
}
  1. Run the game and try to exit by pressing the red quit button. Notice the game hangs.

  2. Put in the following code and notice the hang goes away:

public override void _ExitTree() {
  RenderingServer.GlobalShaderParameterSet("texture_test", new Variant());
  base._ExitTree();
}

Minimal reproduction project (MRP)

hang-on-exit.zip

@matheusmdx
Copy link
Contributor

This look like the same problem as #89188, try test Godot 4.4 dev 1 or higher to see if the crash stops. You can download them officially here: https://godotengine.org/download/archive/

@bbbscarter
Copy link
Author

Ah, good catch - I didn't initially see the link between the two issues, but indeed 4.4 dev 4 fixes it. Thanks!

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

No branches or pull requests

2 participants