OpenXR: Allow moving vendor passthrough extensions to GDExtension

This commit is contained in:
David Snopek 2024-01-25 14:07:50 -06:00
parent 9adb7c7d13
commit e74a0f4b09
14 changed files with 155 additions and 497 deletions

View file

@ -56,7 +56,6 @@
#include "extensions/openxr_composition_layer_depth_extension.h"
#include "extensions/openxr_fb_display_refresh_rate_extension.h"
#include "extensions/openxr_fb_foveation_extension.h"
#include "extensions/openxr_fb_passthrough_extension_wrapper.h"
#include "extensions/openxr_fb_update_swapchain_extension.h"
#ifdef ANDROID_ENABLED
@ -3099,11 +3098,30 @@ bool OpenXRAPI::is_environment_blend_mode_supported(XrEnvironmentBlendMode p_ble
}
bool OpenXRAPI::set_environment_blend_mode(XrEnvironmentBlendMode p_blend_mode) {
if (emulate_environment_blend_mode_alpha_blend && p_blend_mode == XR_ENVIRONMENT_BLEND_MODE_ALPHA_BLEND) {
requested_environment_blend_mode = XR_ENVIRONMENT_BLEND_MODE_ALPHA_BLEND;
environment_blend_mode = XR_ENVIRONMENT_BLEND_MODE_OPAQUE;
return true;
}
// We allow setting this when not initialized and will check if it is supported when initializing.
// After OpenXR is initialized we verify we're setting a supported blend mode.
if (!is_initialized() || is_environment_blend_mode_supported(p_blend_mode)) {
else if (!is_initialized() || is_environment_blend_mode_supported(p_blend_mode)) {
requested_environment_blend_mode = p_blend_mode;
environment_blend_mode = p_blend_mode;
return true;
}
return false;
}
void OpenXRAPI::set_emulate_environment_blend_mode_alpha_blend(bool p_enabled) {
emulate_environment_blend_mode_alpha_blend = p_enabled;
}
OpenXRAPI::OpenXRAlphaBlendModeSupport OpenXRAPI::is_environment_blend_mode_alpha_blend_supported() {
if (is_environment_blend_mode_supported(XR_ENVIRONMENT_BLEND_MODE_ALPHA_BLEND)) {
return OPENXR_ALPHA_BLEND_MODE_SUPPORT_REAL;
} else if (emulate_environment_blend_mode_alpha_blend) {
return OPENXR_ALPHA_BLEND_MODE_SUPPORT_EMULATING;
}
return OPENXR_ALPHA_BLEND_MODE_SUPPORT_NONE;
}