diff --git a/etc/boot.lua b/etc/boot.lua index 49759edf..4f7e88ef 100644 --- a/etc/boot.lua +++ b/etc/boot.lua @@ -36,7 +36,7 @@ function lovr.boot() stencil = false, antialias = true, submitdepth = true, - overlay = false + overlay = 0 }, math = { globals = true diff --git a/src/api/l_headset.c b/src/api/l_headset.c index e8de1aaf..762a2cff 100644 --- a/src/api/l_headset.c +++ b/src/api/l_headset.c @@ -646,7 +646,7 @@ int luaopen_lovr_headset(lua_State* L) { .stencil = false, .antialias = true, .submitDepth = true, - .overlay = false + .overlay = 0 }; luax_pushconf(L); @@ -688,7 +688,7 @@ int luaopen_lovr_headset(lua_State* L) { lua_pop(L, 1); lua_getfield(L, -1, "overlay"); - config.overlay = lua_toboolean(L, -1); + config.overlay = lua_tointeger(L, -1); lua_pop(L, 1); } lua_pop(L, 1); diff --git a/src/modules/headset/headset.h b/src/modules/headset/headset.h index 1bcdbdf8..60aa2d7c 100644 --- a/src/modules/headset/headset.h +++ b/src/modules/headset/headset.h @@ -25,7 +25,7 @@ typedef struct { bool stencil; bool antialias; bool submitDepth; - bool overlay; + int overlay; } HeadsetConfig; typedef enum { diff --git a/src/modules/headset/headset_openxr.c b/src/modules/headset/headset_openxr.c index 097354e8..1171394b 100644 --- a/src/modules/headset/headset_openxr.c +++ b/src/modules/headset/headset_openxr.c @@ -178,7 +178,7 @@ static struct { bool handTrackingMesh; bool headless; bool keyboardTracking; - bool overlay; + int overlay; bool refreshRate; bool viveTrackers; } features; @@ -912,10 +912,11 @@ static void openxr_start(void) { #ifdef XR_EXTX_overlay XrSessionCreateInfoOverlayEXTX overlayInfo = { .type = XR_TYPE_SESSION_CREATE_INFO_OVERLAY_EXTX, - .next = info.next + .next = info.next, + .sessionLayersPlacement = state.features.overlay }; - if (state.features.overlay) { + if (state.features.overlay > 0) { info.next = &overlayInfo; } #endif @@ -1079,7 +1080,7 @@ static void openxr_start(void) { XrCompositionLayerFlags layerFlags = 0; - if (state.features.overlay) { + if (state.features.overlay > 0) { layerFlags = XR_COMPOSITION_LAYER_BLEND_TEXTURE_SOURCE_ALPHA_BIT | XR_COMPOSITION_LAYER_UNPREMULTIPLIED_ALPHA_BIT; } diff --git a/src/modules/headset/headset_webxr.c b/src/modules/headset/headset_webxr.c index 6c62950b..60c345bb 100644 --- a/src/modules/headset/headset_webxr.c +++ b/src/modules/headset/headset_webxr.c @@ -1,6 +1,6 @@ #include "headset/headset.h" -extern bool webxr_init(float supersample, float offset, uint32_t msaa, bool overlay); +extern bool webxr_init(float supersample, float offset, uint32_t msaa, int overlay); extern void webxr_start(void); extern void webxr_destroy(void); extern bool webxr_getName(char* name, size_t length);