X Tutup
Skip to content

OpenXR: Fix Vulkan validation errors and get XR_META_foveation_eye_tracked working on Meta Quest devices#112994

Merged
akien-mga merged 1 commit intogodotengine:masterfrom
dsnopek:openxr-meta-foveation-eye-tracked-on-meta
Nov 27, 2025
Merged

OpenXR: Fix Vulkan validation errors and get XR_META_foveation_eye_tracked working on Meta Quest devices#112994
akien-mga merged 1 commit intogodotengine:masterfrom
dsnopek:openxr-meta-foveation-eye-tracked-on-meta

Conversation

@dsnopek
Copy link
Contributor

@dsnopek dsnopek commented Nov 20, 2025

This very nearly fixes #112988

The most important changes are:

  • If we don't have offsets, it doesn't pass the VkSubpassFragmentDensityMapOffsetEndInfoQCOM struct at all. This fixes what's breaking rendering completely on Meta Quest 3, where XR_META_foveation_eye_tracked isn't supported
  • It calls xrUpdateSwapchainFB() before xrGetFoveationEyeTrackedStateMETA() every time. This is actually mentioned in the spec - it says "Note that xrUpdateSwapchainFB should be called right before the xrGetFoveationEyeTrackedStateMETA function". While it says "should", the Meta runtime will only give us updated eye positions if we do, so it's more like a "must"
  • It fixes numerous Vulkan validation errors related to the VK_QCOM_fragment_density_map_offset extension. This turned out to be the key to make eye-tracked foveated rendering actually render sanely on the Quest Pro! Previously, even with the correct offsets, it was behaving very strangely. But, also, fixing validation errors is good :-)

@dsnopek dsnopek added this to the 4.6 milestone Nov 20, 2025
@dsnopek dsnopek requested a review from a team as a code owner November 20, 2025 20:07
@dsnopek dsnopek added the bug label Nov 20, 2025
@dsnopek dsnopek requested a review from a team as a code owner November 20, 2025 20:07
@dsnopek dsnopek marked this pull request as draft November 20, 2025 20:40
@dsnopek dsnopek force-pushed the openxr-meta-foveation-eye-tracked-on-meta branch 2 times, most recently from 3e6b2b4 to 81af428 Compare November 25, 2025 23:09
@dsnopek dsnopek changed the title [DRAFT] OpenXR: Fix XR_META_foveation_eye_tracked on Meta Quest devices [DRAFT] OpenXR: Fix Vulkan validation errors and get XR_META_foveation_eye_tracked working on Meta Quest devices Nov 25, 2025
@dsnopek dsnopek force-pushed the openxr-meta-foveation-eye-tracked-on-meta branch from 81af428 to 76bcc73 Compare November 25, 2025 23:31
@dsnopek
Copy link
Contributor Author

dsnopek commented Nov 25, 2025

In trying to figure out why the FDM offsets weren't doing what they should on the Quest Pro, I tried enabling the Vulkan validation layers and found that we were generating a mess of validation errors! Fixing those turned out to be the key to getting eye-tracked foveation actually rendering sanely on the Quest Pro

However, there is still one remaining issue on the Quest Pro: there's a flickering that happens every couple of seconds, but only when eye-tracked foveation is enabled; not when using fixed foveation :-(

Still debugging!

@dsnopek
Copy link
Contributor Author

dsnopek commented Nov 25, 2025

Hm, the flickering stopped happening! I'm going to write that up to a fluke, and take this PR out of draft :-)

@dsnopek dsnopek changed the title [DRAFT] OpenXR: Fix Vulkan validation errors and get XR_META_foveation_eye_tracked working on Meta Quest devices OpenXR: Fix Vulkan validation errors and get XR_META_foveation_eye_tracked working on Meta Quest devices Nov 25, 2025
@dsnopek dsnopek marked this pull request as ready for review November 25, 2025 23:44
Copy link
Contributor

@BastiaanOlij BastiaanOlij left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code wise this looks good, my comment is purely one of understanding what textures need the offset flag set.

Not sure if I can test this today but I trust Davids testing enough to approve this and getting this merged.

create_info.flags |= VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT;
}*/

if (fdm_capabilities.offset_supported && (p_format.usage_bits & (TEXTURE_USAGE_COLOR_ATTACHMENT_BIT | TEXTURE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | TEXTURE_USAGE_INPUT_ATTACHMENT_BIT))) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we enable this for all these types, or just for TEXTURE_USAGE_VRS_ATTACHMENT_BIT ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It definitely needs to be on at least these ones, because not having it on them led to Vulkan validation errors in my testing. However, looking at the spec, it seems we probably need it on even more:

Selection_408

I probably didn't need it on TEXTURE_USAGE_VRS_ATTACHMENT_BIT in my testing, because I'm getting the FDM from the OpenXR runtime which presumably already created it with the right bit.

So, I guess I'll update this to add a few more to try and cover everything mentioned in the spec...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I added it for a couple more usage types, which should theoretically cover everything mentioned in the spec

@dsnopek dsnopek force-pushed the openxr-meta-foveation-eye-tracked-on-meta branch from 76bcc73 to e4caa54 Compare November 26, 2025 02:01
@dsnopek dsnopek force-pushed the openxr-meta-foveation-eye-tracked-on-meta branch from e4caa54 to fce47ac Compare November 26, 2025 12:35
Copy link
Member

@clayjohn clayjohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rendering code looks good to me

@akien-mga akien-mga merged commit 1cb4ada into godotengine:master Nov 27, 2025
20 checks passed
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Foveated rendering broken in Vulkan Mobile renderer on Meta Quest devices (won't render or wrong FDM offsets)

5 participants

X Tutup