godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.37k stars 21.25k forks source link

OpenXR composition layers fail on SteamVR #91935

Closed BastiaanOlij closed 6 months ago

BastiaanOlij commented 6 months ago

Tested versions

System information

Windows 10 - SteamVR with Valve Index - Godot 4.x compatibility renderer

Issue description

When using the new composition layer nodes with SteamVR and a Valve Index (potentially reproducible with any headset on SteamVR), we get the following error spammed every frame:

OpenXR: Failed to get swapchain [ XR_ERROR_RUNTIME_FAILURE ]

This is caused by the number of samples on the swapchain that is created being hardcoded to 3. SteamVR reports that only 1 sample is supported:

OpenXR: Found supported view configuration view
 - width: 8192
 - height: 8192
 - sample count: 1
 - recommended render width: 2468
 - recommended render height: 2740
 - recommended render sample count: 1

Indeed, changing this hardcoded value to 1 fixes the issue however I do not want to submit a PR before this is discussed further as there may have been a reason for choosing 3.

Steps to reproduce

Add a viewport node and composition layer node to your XR project.

Minimal reproduction project (MRP)

composition_layer_demo.zip

dsnopek commented 6 months ago

Thanks!

I have gone through the spec, the OVR samples, the history on the PR and can't find any reason why I used the nonsensical value 3 for sample count. My best guess is that I thought I was setting something else? Because sample count should be 1, 2, 4 or 8 -- 3 isn't even really valid option. :-)

This is caused by the number of samples on the swapchain that is created being hardcoded to 3. SteamVR reports that only 1 sample is supported:

OpenXR: Found supported view configuration view
 - width: 8192
 - height: 8192
 - sample count: 1
 - recommended render width: 2468
 - recommended render height: 2740
 - recommended render sample count: 1

This info is specifically for the view, so I'm not sure it applies to the composition layers.

In any case, I think changing sample count to 1 does make sense. I've just posted PR https://github.com/godotengine/godot/pull/91952 making this change.