OpenXR: Use the XR_FB_foveation_vulkan extension to get the density map for VRS

This commit is contained in:
David Snopek 2024-11-27 10:34:48 -06:00
parent b13c96b097
commit 79f5a4d9fe
24 changed files with 178 additions and 18 deletions

View file

@ -267,6 +267,16 @@ RID OpenXRAPI::OpenXRSwapChainInfo::get_image() {
}
}
RID OpenXRAPI::OpenXRSwapChainInfo::get_density_map() {
OpenXRAPI *openxr_api = OpenXRAPI::get_singleton();
if (image_acquired && openxr_api && openxr_api->get_graphics_extension()) {
return openxr_api->get_graphics_extension()->get_density_map(swapchain_graphics_data, image_index);
} else {
return RID();
}
}
////////////////////////////////////
// OpenXRAPI
@ -2370,6 +2380,17 @@ RID OpenXRAPI::get_depth_texture() {
}
}
RID OpenXRAPI::get_density_map_texture() {
ERR_NOT_ON_RENDER_THREAD_V(RID());
OpenXRFBFoveationExtension *fov_ext = OpenXRFBFoveationExtension::get_singleton();
if (fov_ext && fov_ext->is_enabled()) {
return render_state.main_swapchains[OPENXR_SWAPCHAIN_COLOR].get_density_map();
}
return RID();
}
void OpenXRAPI::set_velocity_texture(RID p_render_target) {
velocity_texture = p_render_target;
}