mirror of
https://github.com/DrBeef/JKXR.git
synced 2025-01-19 06:51:06 +00:00
Prevent issues on start-up with Pico
This commit is contained in:
parent
23121a528b
commit
f0a6d673ee
5 changed files with 15 additions and 44 deletions
|
@ -13,37 +13,13 @@
|
|||
#include "VrInput.h"
|
||||
#include "VrCvars.h"
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
#include <GLES3/gl3.h>
|
||||
#include <GLES3/gl3ext.h>
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GLES/gl2ext.h>
|
||||
|
||||
extern "C" {
|
||||
#include "src/gl/loader.h"
|
||||
}
|
||||
|
||||
#include <client/client.h>
|
||||
|
||||
#include "VrInput.h"
|
||||
|
||||
#if !defined( EGL_OPENGL_ES3_BIT_KHR )
|
||||
#define EGL_OPENGL_ES3_BIT_KHR 0x0040
|
||||
#endif
|
||||
|
||||
// EXT_texture_border_clamp
|
||||
#ifndef GL_CLAMP_TO_BORDER
|
||||
#define GL_CLAMP_TO_BORDER 0x812D
|
||||
#endif
|
||||
|
||||
#ifndef GL_TEXTURE_BORDER_COLOR
|
||||
#define GL_TEXTURE_BORDER_COLOR 0x1004
|
||||
#endif
|
||||
|
||||
#ifndef GLAPI
|
||||
#define GLAPI extern
|
||||
#endif
|
||||
//#define ENABLE_GL_DEBUG
|
||||
#define ENABLE_GL_DEBUG_VERBOSE 1
|
||||
|
||||
|
@ -255,6 +231,7 @@ void VR_GetMove(float *forward, float *side, float *pos_forward, float *pos_side
|
|||
*pos_forward = positional_movementForward;
|
||||
*up = remote_movementUp;
|
||||
*side = remote_movementSideways;
|
||||
|
||||
*pos_side = positional_movementSideways;
|
||||
*yaw = vr.hmdorientation[YAW] + vr.snapTurn;
|
||||
*pitch = vr.hmdorientation[PITCH];
|
||||
|
|
|
@ -394,7 +394,7 @@ void TBXR_UpdateControllers( )
|
|||
XrSpaceLocation loc = {};
|
||||
loc.type = XR_TYPE_SPACE_LOCATION;
|
||||
loc.next = &vel;
|
||||
OXR(xrLocateSpace(controllerSpace[i], gAppState.CurrentSpace, gAppState.PredictedDisplayTime, &loc));
|
||||
OXR(xrLocateSpace(controllerSpace[i], gAppState.CurrentSpace, gAppState.FrameState.predictedDisplayTime, &loc));
|
||||
|
||||
gAppState.TrackedController[i].Active = (loc.locationFlags & XR_SPACE_LOCATION_POSITION_VALID_BIT) != 0;
|
||||
gAppState.TrackedController[i].Pose = loc.pose;
|
||||
|
|
|
@ -528,7 +528,7 @@ void TBXR_UpdateControllers( )
|
|||
XrSpaceLocation loc = {};
|
||||
loc.type = XR_TYPE_SPACE_LOCATION;
|
||||
loc.next = &vel;
|
||||
XrResult res = xrLocateSpace(aimSpace[i], gAppState.CurrentSpace, gAppState.PredictedDisplayTime, &loc);
|
||||
XrResult res = xrLocateSpace(aimSpace[i], gAppState.CurrentSpace, gAppState.FrameState.predictedDisplayTime, &loc);
|
||||
if (res != XR_SUCCESS) {
|
||||
Com_Printf("xrLocateSpace error: %d", (int)res);
|
||||
}
|
||||
|
|
|
@ -1701,7 +1701,7 @@ void TBXR_Recenter() {
|
|||
vec3_t rotation = {0, 0, 0};
|
||||
XrSpaceLocation loc = {};
|
||||
loc.type = XR_TYPE_SPACE_LOCATION;
|
||||
OXR(xrLocateSpace(gAppState.HeadSpace, gAppState.CurrentSpace, gAppState.PredictedDisplayTime, &loc));
|
||||
OXR(xrLocateSpace(gAppState.HeadSpace, gAppState.CurrentSpace, gAppState.FrameState.predictedDisplayTime, &loc));
|
||||
QuatToYawPitchRoll(loc.pose.orientation, rotation, vr.hmdorientation);
|
||||
|
||||
spaceCreateInfo.poseInReferenceSpace.orientation.x = 0;
|
||||
|
@ -1762,7 +1762,7 @@ void TBXR_WaitForSessionActive()
|
|||
|
||||
static void TBXR_GetHMDOrientation() {
|
||||
|
||||
if (gAppState.PredictedDisplayTime == 0)
|
||||
if (gAppState.FrameState.predictedDisplayTime == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -1773,7 +1773,7 @@ static void TBXR_GetHMDOrientation() {
|
|||
// The better the prediction, the less black will be pulled in at the edges.
|
||||
XrSpaceLocation loc = {};
|
||||
loc.type = XR_TYPE_SPACE_LOCATION;
|
||||
OXR(xrLocateSpace(gAppState.HeadSpace, gAppState.CurrentSpace, gAppState.PredictedDisplayTime, &loc));
|
||||
OXR(xrLocateSpace(gAppState.HeadSpace, gAppState.CurrentSpace, gAppState.FrameState.predictedDisplayTime, &loc));
|
||||
gAppState.xfStageFromHead = loc.pose;
|
||||
|
||||
const XrQuaternionf quatHmd = gAppState.xfStageFromHead.orientation;
|
||||
|
@ -1831,19 +1831,13 @@ void TBXR_FrameSetup()
|
|||
|
||||
// NOTE: OpenXR does not use the concept of frame indices. Instead,
|
||||
// XrWaitFrame returns the predicted display time.
|
||||
XrFrameWaitInfo waitFrameInfo = {};
|
||||
waitFrameInfo.type = XR_TYPE_FRAME_WAIT_INFO;
|
||||
waitFrameInfo.next = NULL;
|
||||
//XrFrameWaitInfo waitFrameInfo = {};
|
||||
//waitFrameInfo.type = XR_TYPE_FRAME_WAIT_INFO;
|
||||
//waitFrameInfo.next = NULL;
|
||||
|
||||
XrFrameState frameState = {};
|
||||
frameState.type = XR_TYPE_FRAME_STATE;
|
||||
frameState.next = NULL;
|
||||
|
||||
OXR(xrWaitFrame(gAppState.Session, &waitFrameInfo, &frameState));
|
||||
gAppState.PredictedDisplayTime = frameState.predictedDisplayTime;
|
||||
if (!frameState.shouldRender) {
|
||||
return;
|
||||
}
|
||||
memset(&gAppState.FrameState, 0, sizeof(XrFrameState));
|
||||
gAppState.FrameState.type = XR_TYPE_FRAME_STATE;
|
||||
OXR(xrWaitFrame(gAppState.Session, NULL, &gAppState.FrameState));
|
||||
|
||||
// Get the HMD pose, predicted for the middle of the time period during which
|
||||
// the new eye images will be displayed. The number of frames predicted ahead
|
||||
|
@ -1923,7 +1917,7 @@ void TBXR_updateProjections()
|
|||
XrViewLocateInfo projectionInfo = {};
|
||||
projectionInfo.type = XR_TYPE_VIEW_LOCATE_INFO;
|
||||
projectionInfo.viewConfigurationType = gAppState.ViewportConfig.viewConfigurationType;
|
||||
projectionInfo.displayTime = gAppState.PredictedDisplayTime;
|
||||
projectionInfo.displayTime = gAppState.FrameState.predictedDisplayTime;
|
||||
projectionInfo.space = gAppState.HeadSpace;
|
||||
|
||||
XrViewState viewState = {XR_TYPE_VIEW_STATE, NULL};
|
||||
|
@ -2044,7 +2038,7 @@ void TBXR_submitFrame()
|
|||
|
||||
XrFrameEndInfo endFrameInfo = {};
|
||||
endFrameInfo.type = XR_TYPE_FRAME_END_INFO;
|
||||
endFrameInfo.displayTime = gAppState.PredictedDisplayTime;
|
||||
endFrameInfo.displayTime = gAppState.FrameState.predictedDisplayTime;
|
||||
endFrameInfo.environmentBlendMode = XR_ENVIRONMENT_BLEND_MODE_OPAQUE;
|
||||
endFrameInfo.layerCount = gAppState.LayerCount;
|
||||
endFrameInfo.layers = layers;
|
||||
|
|
|
@ -245,7 +245,7 @@ typedef struct
|
|||
PFN_xrGetDisplayRefreshRateFB pfnGetDisplayRefreshRate;
|
||||
PFN_xrRequestDisplayRefreshRateFB pfnRequestDisplayRefreshRate;
|
||||
|
||||
XrTime PredictedDisplayTime;
|
||||
XrFrameState FrameState;
|
||||
int SwapInterval;
|
||||
int MainThreadTid;
|
||||
int RenderThreadTid;
|
||||
|
|
Loading…
Reference in a new issue