Godot produces a black screen and spams errors when a VRS mode is set
Tested versions
- Tested in 4.5.dev5 with mono [64b0990]
System information
Windows 11 - Godot 4.5.dev5 with mono - Vulkan (Foward+) - AMD Radeon RX 7800XT
Issue description
When launching the game with a VRS mode set in project settings, the renderer produces a black screen, and spams the console with errors.
Also the black screen persists if the mode is set to XR, and even when launching with --xr-mode off
Steps to reproduce
- Create a new project.
- Go to project settings.
- Find Rendering/VRS and set mode to anything other than None.
- Run the project.
Minimal reproduction project (MRP)
I can't reproduce this on 4.5.dev4 (Linux + NVIDIA).
@funkysandwich Can you reproduce this on earlier versions of Godot? Like 4.4.1-stable and previous 4.5 dev snapshots?
@funkysandwich Can you reproduce this on earlier versions of Godot? Like 4.4.1-stable and previous 4.5 dev snapshots?
I did some more testing, and I was able to reproduce the black screen in:
- 4.5.dev4
- 4.5.dev3
- 4.5.dev2
But not within 4.5.dev1
I ran into this bug after opening a copy of an existing project I started in Godot 4.4.1 with 4.5.dev5. It is a VR project with VRS mode set to XR.
Just given the timeline, this could be related to PR https://github.com/godotengine/godot/pull/99551 which was merged between 4.5-dev1 and dev2, and affects the VRS code
I also encountered the same issue on my system and can confirm that it is caused by #99551.
I took a look at the code diff and debugged it on my system.
The aforementioned PR refactored the code and removed a property of the framebuffer storing the VRS attachment index (link), in the same process an if-else statement was removed (link) which previously set this now removed property. This property was replaced with method parameters in other places. However the removal of the if condition causes the VRS attachment to be added to the color_attachments list.
This list gets iterated, and for every attachment in the list, the attachment_last_pass is set - this now includes the VRS attachment.
Which in return causes the ERR_FAIL_COND_V_MSG(attachment_last_pass[attachment] == i, RDD::RenderPassID(), "Invalid framebuffer VRS attachment(" + itos(attachment) + "), in pass (" + itos(i) + "), it already was used for something else before in this pass."); to trigger in turn causing all of these errors.
Restoring the original if branch (even leaving it empty) with for example:
else if (texture && (texture->usage_flags & TEXTURE_USAGE_VRS_ATTACHMENT_BIT)) {
// Prevent the VRS attachment from being added to the color attachments.
}
fixed the specific issue for me.
If you want I can also create a PR.
If you want I can also create a PR.
I think you found the issue correctly already although I'll need to refresh my memory on it first. Go ahead and feel free to ping me on it!