Description
Tested versions
- Reproducible in v4.4.stable.mono
- Not producible in v4.3.stable.mono
System information
Godot v4.4.stable.mono - Windows 11 (build 22631) - Multi-window, 2 monitors - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4070 (NVIDIA; 32.0.15.6094) - AMD Ryzen 9 7900X 12-Core Processor (24 threads)
Issue description
I'm making a rendering effect just like Octopath Traveller's in-house scene, which rendering in-house scene and out-house scene simultaneously, such as
I use two SubViewport to render the inside and outside scene, and use a Compositor Effect to capture the depth texture of the inside scene for final mixing.
However, after I do a main scene transition (unloads all nodes including house and outside scene), and when the next time I do transition back to this scene, Godot Editor reports Bugs as follows (which repeats around 30+ times for one scene transition)
E 0:00:22:180 GodotObject.base.cs:137 @ void Godot.GodotObject.Dispose(bool): This function (free) can only be called from the render thread.
<C++ Error> Condition "render_thread_id != Thread::get_caller_id()" is true.
<C++ Source> servers/rendering/rendering_device.cpp:5995 @ free()
<Stack Trace> GodotObject.base.cs:137 @ void Godot.GodotObject.Dispose(bool)
GodotObject.base.cs:100 @ void Godot.GodotObject.Finalize()
I'm not sure how to reproduce it in a MRP, because it seems this bug report triggers from C# GodotObject.Dispose()
. I've tried use GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced); GC.WaitForPendingFinalizers();
manually in MRP, but it cannot reproduce the bug report.
I suspect this bug report is corresponding to the Compositor Effect. Because the bug report only appears after I have entered the house and created the Compositor Effect.
Steps to reproduce
- make a scene (which calls SCENE_A), add Compositor Effect to a camera.
- do scene transition to another scene.
- do scene transition again, and editor will report bugs.
Minimal reproduction project (MRP)
In this MRP, press 'F' to turn on/off Depth Capture, press 'Esc' to switch scene and trigger GC. Debugger will report Errors if Depth Capture has been turned on once.