feat: overlay layers

This commit is contained in:
BabbleBones 2023-08-18 11:30:58 -04:00
parent 072452a4da
commit 6fbfc16f7d
5 changed files with 10 additions and 9 deletions

View File

@ -36,7 +36,7 @@ function lovr.boot()
stencil = false,
antialias = true,
submitdepth = true,
overlay = false
overlay = 0
},
math = {
globals = true

View File

@ -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);

View File

@ -25,7 +25,7 @@ typedef struct {
bool stencil;
bool antialias;
bool submitDepth;
bool overlay;
int overlay;
} HeadsetConfig;
typedef enum {

View File

@ -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;
}

View File

@ -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);