mirror of
https://github.com/amwatson/CitraVR.git
synced 2024-09-20 03:11:40 +02:00
Convert foo_ variable naming to mFoo for OpenXR, vr_main
This commit is contained in:
parent
8d2baed9a9
commit
4e7eba7010
3 changed files with 81 additions and 81 deletions
|
@ -185,7 +185,7 @@ XrInstance XrInstanceCreate() {
|
|||
XrInstance instanceLocal;
|
||||
OXR(initResult = xrCreateInstance(&ici, &instanceLocal));
|
||||
if (initResult != XR_SUCCESS) {
|
||||
ALOGE("ERROR({}()): Failed to create XR instance_: {}.", __FUNCTION__, initResult);
|
||||
ALOGE("ERROR({}()): Failed to create XR mInstance: {}.", __FUNCTION__, initResult);
|
||||
return XR_NULL_HANDLE;
|
||||
}
|
||||
// Log runtime instance info
|
||||
|
@ -290,7 +290,7 @@ XrInstance& OpenXr::GetInstance() {
|
|||
|
||||
int32_t OpenXr::Init(JavaVM* const jvm, const jobject activityObject) {
|
||||
for (int eye = 0; eye < 2; eye++) {
|
||||
viewConfigurationViews_[eye] = {};
|
||||
mViewConfigurationViews[eye] = {};
|
||||
}
|
||||
BAIL_ON_ERR(OpenXRInit(jvm, activityObject), -1);
|
||||
BAIL_ON_ERR(XrViewConfigInit(), -2);
|
||||
|
@ -303,11 +303,11 @@ int32_t OpenXr::Init(JavaVM* const jvm, const jobject activityObject) {
|
|||
int32_t OpenXr::XrViewConfigInit() {
|
||||
// Enumerate the viewport configurations.
|
||||
uint32_t viewportConfigTypeCount = 0;
|
||||
OXR(xrEnumerateViewConfigurations(instance_, systemId_, 0, &viewportConfigTypeCount, NULL));
|
||||
OXR(xrEnumerateViewConfigurations(mInstance, mSystemId, 0, &viewportConfigTypeCount, NULL));
|
||||
|
||||
auto viewportConfigurationTypes = std::vector<XrViewConfigurationType>(viewportConfigTypeCount);
|
||||
|
||||
OXR(xrEnumerateViewConfigurations(instance_, systemId_, viewportConfigTypeCount,
|
||||
OXR(xrEnumerateViewConfigurations(mInstance, mSystemId, viewportConfigTypeCount,
|
||||
&viewportConfigTypeCount, viewportConfigurationTypes.data()));
|
||||
|
||||
ALOGV("Available Viewport Configuration Types: {}", viewportConfigTypeCount);
|
||||
|
@ -321,13 +321,13 @@ int32_t OpenXr::XrViewConfigInit() {
|
|||
|
||||
XrViewConfigurationProperties viewportConfig;
|
||||
viewportConfig.type = XR_TYPE_VIEW_CONFIGURATION_PROPERTIES;
|
||||
OXR(xrGetViewConfigurationProperties(instance_, systemId_, viewportConfigType,
|
||||
OXR(xrGetViewConfigurationProperties(mInstance, mSystemId, viewportConfigType,
|
||||
&viewportConfig));
|
||||
ALOGV("FovMutable={} ConfigurationType {}", viewportConfig.fovMutable ? "true" : "false",
|
||||
viewportConfig.viewConfigurationType);
|
||||
|
||||
uint32_t viewCount;
|
||||
OXR(xrEnumerateViewConfigurationViews(instance_, systemId_, viewportConfigType, 0,
|
||||
OXR(xrEnumerateViewConfigurationViews(mInstance, mSystemId, viewportConfigType, 0,
|
||||
&viewCount, NULL));
|
||||
|
||||
if (viewCount > 0) {
|
||||
|
@ -338,7 +338,7 @@ int32_t OpenXr::XrViewConfigInit() {
|
|||
elements[e].next = NULL;
|
||||
}
|
||||
|
||||
OXR(xrEnumerateViewConfigurationViews(instance_, systemId_, viewportConfigType,
|
||||
OXR(xrEnumerateViewConfigurationViews(mInstance, mSystemId, viewportConfigType,
|
||||
viewCount, &viewCount, elements.data()));
|
||||
|
||||
// Log the view config info for each view type for debugging
|
||||
|
@ -362,7 +362,7 @@ int32_t OpenXr::XrViewConfigInit() {
|
|||
foundSupportedViewport = true;
|
||||
assert(viewCount == NUM_EYES);
|
||||
for (uint32_t e = 0; e < viewCount; e++) {
|
||||
viewConfigurationViews_[e] = elements[e];
|
||||
mViewConfigurationViews[e] = elements[e];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -376,9 +376,9 @@ int32_t OpenXr::XrViewConfigInit() {
|
|||
|
||||
// Get the viewport configuration info for the chosen viewport configuration
|
||||
// type.
|
||||
viewportConfig_.type = XR_TYPE_VIEW_CONFIGURATION_PROPERTIES;
|
||||
mViewportConfig.type = XR_TYPE_VIEW_CONFIGURATION_PROPERTIES;
|
||||
|
||||
OXR(xrGetViewConfigurationProperties(instance_, systemId_, VIEW_CONFIG_TYPE, &viewportConfig_));
|
||||
OXR(xrGetViewConfigurationProperties(mInstance, mSystemId, VIEW_CONFIG_TYPE, &mViewportConfig));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -386,11 +386,11 @@ int32_t OpenXr::XrSpaceInit() {
|
|||
bool stageSupported = false;
|
||||
|
||||
uint32_t numOutputSpaces = 0;
|
||||
OXR(xrEnumerateReferenceSpaces(session_, 0, &numOutputSpaces, NULL));
|
||||
OXR(xrEnumerateReferenceSpaces(mSession, 0, &numOutputSpaces, NULL));
|
||||
|
||||
auto referenceSpaces = std::vector<XrReferenceSpaceType>(numOutputSpaces);
|
||||
|
||||
OXR(xrEnumerateReferenceSpaces(session_, numOutputSpaces, &numOutputSpaces,
|
||||
OXR(xrEnumerateReferenceSpaces(mSession, numOutputSpaces, &numOutputSpaces,
|
||||
referenceSpaces.data()));
|
||||
|
||||
for (uint32_t i = 0; i < numOutputSpaces; i++) {
|
||||
|
@ -406,10 +406,10 @@ int32_t OpenXr::XrSpaceInit() {
|
|||
spaceCreateInfo.type = XR_TYPE_REFERENCE_SPACE_CREATE_INFO;
|
||||
spaceCreateInfo.referenceSpaceType = XR_REFERENCE_SPACE_TYPE_VIEW;
|
||||
spaceCreateInfo.poseInReferenceSpace.orientation.w = 1.0f;
|
||||
OXR(xrCreateReferenceSpace(session_, &spaceCreateInfo, &headSpace_));
|
||||
OXR(xrCreateReferenceSpace(mSession, &spaceCreateInfo, &mHeadSpace));
|
||||
|
||||
spaceCreateInfo.referenceSpaceType = XR_REFERENCE_SPACE_TYPE_LOCAL;
|
||||
OXR(xrCreateReferenceSpace(session_, &spaceCreateInfo, &localSpace_));
|
||||
OXR(xrCreateReferenceSpace(mSession, &spaceCreateInfo, &mLocalSpace));
|
||||
}
|
||||
|
||||
if (stageSupported) {
|
||||
|
@ -417,24 +417,24 @@ int32_t OpenXr::XrSpaceInit() {
|
|||
|
||||
spaceCreateInfo.referenceSpaceType = XR_REFERENCE_SPACE_TYPE_STAGE;
|
||||
spaceCreateInfo.poseInReferenceSpace.orientation.w = 1.0f;
|
||||
OXR(xrCreateReferenceSpace(session_, &spaceCreateInfo, &stageSpace_));
|
||||
OXR(xrCreateReferenceSpace(mSession, &spaceCreateInfo, &mStageSpace));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void OpenXr::XrSpaceDestroy() {
|
||||
if (headSpace_ != XR_NULL_HANDLE) {
|
||||
OXR(xrDestroySpace(headSpace_));
|
||||
headSpace_ = XR_NULL_HANDLE;
|
||||
if (mHeadSpace != XR_NULL_HANDLE) {
|
||||
OXR(xrDestroySpace(mHeadSpace));
|
||||
mHeadSpace = XR_NULL_HANDLE;
|
||||
}
|
||||
if (localSpace_ != XR_NULL_HANDLE) {
|
||||
OXR(xrDestroySpace(localSpace_));
|
||||
localSpace_ = XR_NULL_HANDLE;
|
||||
if (mLocalSpace != XR_NULL_HANDLE) {
|
||||
OXR(xrDestroySpace(mLocalSpace));
|
||||
mLocalSpace = XR_NULL_HANDLE;
|
||||
}
|
||||
if (stageSpace_ != XR_NULL_HANDLE) {
|
||||
OXR(xrDestroySpace(stageSpace_));
|
||||
stageSpace_ = XR_NULL_HANDLE;
|
||||
if (mStageSpace != XR_NULL_HANDLE) {
|
||||
OXR(xrDestroySpace(mStageSpace));
|
||||
mStageSpace = XR_NULL_HANDLE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -449,21 +449,21 @@ int OpenXr::OpenXRInit(JavaVM* const jvm, const jobject activityObject) {
|
|||
/////////////////////////////////////
|
||||
// Create the OpenXR instance.
|
||||
/////////////////////////////////////
|
||||
instance_ = XrInstanceCreate();
|
||||
if (instance_ == XR_NULL_HANDLE) {
|
||||
mInstance = XrInstanceCreate();
|
||||
if (mInstance == XR_NULL_HANDLE) {
|
||||
ALOGE("Failed to create XR instance");
|
||||
return -2;
|
||||
}
|
||||
// Set the global used in macros
|
||||
instance = instance_;
|
||||
instance = mInstance;
|
||||
|
||||
systemId_ = XrGetSystemId(instance_);
|
||||
if (systemId_ == XR_NULL_SYSTEM_ID) {
|
||||
mSystemId = XrGetSystemId(mInstance);
|
||||
if (mSystemId == XR_NULL_SYSTEM_ID) {
|
||||
ALOGE("Failed to retrieve XR system ID");
|
||||
return -3;
|
||||
}
|
||||
|
||||
maxLayerCount_ = GetMaxLayerCount(instance_, systemId_);
|
||||
mMaxLayerCount = GetMaxLayerCount(mInstance, mSystemId);
|
||||
|
||||
////////////////////////////////
|
||||
// Init EGL
|
||||
|
@ -471,16 +471,16 @@ int OpenXr::OpenXRInit(JavaVM* const jvm, const jobject activityObject) {
|
|||
{
|
||||
// Get the graphics requirements.
|
||||
PFN_xrGetOpenGLESGraphicsRequirementsKHR pfnGetOpenGLESGraphicsRequirementsKHR = NULL;
|
||||
OXR(xrGetInstanceProcAddr(instance_, "xrGetOpenGLESGraphicsRequirementsKHR",
|
||||
OXR(xrGetInstanceProcAddr(mInstance, "xrGetOpenGLESGraphicsRequirementsKHR",
|
||||
(PFN_xrVoidFunction*)(&pfnGetOpenGLESGraphicsRequirementsKHR)));
|
||||
|
||||
XrGraphicsRequirementsOpenGLESKHR graphicsRequirements = {};
|
||||
graphicsRequirements.type = XR_TYPE_GRAPHICS_REQUIREMENTS_OPENGL_ES_KHR;
|
||||
OXR(pfnGetOpenGLESGraphicsRequirementsKHR(instance_, systemId_, &graphicsRequirements));
|
||||
OXR(pfnGetOpenGLESGraphicsRequirementsKHR(mInstance, mSystemId, &graphicsRequirements));
|
||||
|
||||
{
|
||||
// Create the EGL Context
|
||||
eglContext_ = std::make_unique<EglContext>();
|
||||
mEglContext = std::make_unique<EglContext>();
|
||||
|
||||
// Check the graphics requirements.
|
||||
int32_t eglMajor = 0;
|
||||
|
@ -499,8 +499,8 @@ int OpenXr::OpenXRInit(JavaVM* const jvm, const jobject activityObject) {
|
|||
///////////////////////////////
|
||||
// Create the OpenXR Session.
|
||||
//////////////////////////////
|
||||
session_ = XrSessionCreate(instance, systemId_, eglContext_);
|
||||
if (session_ == XR_NULL_HANDLE) {
|
||||
mSession = XrSessionCreate(instance, mSystemId, mEglContext);
|
||||
if (mSession == XR_NULL_HANDLE) {
|
||||
ALOGE("Failed to create XR session");
|
||||
return -6;
|
||||
}
|
||||
|
@ -510,13 +510,13 @@ int OpenXr::OpenXRInit(JavaVM* const jvm, const jobject activityObject) {
|
|||
void OpenXr::Shutdown() {
|
||||
XrSpaceDestroy();
|
||||
|
||||
if (session_ != XR_NULL_HANDLE) {
|
||||
OXR(xrDestroySession(session_));
|
||||
session_ = XR_NULL_HANDLE;
|
||||
if (mSession != XR_NULL_HANDLE) {
|
||||
OXR(xrDestroySession(mSession));
|
||||
mSession = XR_NULL_HANDLE;
|
||||
}
|
||||
|
||||
if (instance_ != XR_NULL_HANDLE) {
|
||||
OXR(xrDestroyInstance(instance_));
|
||||
instance_ = XR_NULL_HANDLE;
|
||||
if (mInstance != XR_NULL_HANDLE) {
|
||||
OXR(xrDestroyInstance(mInstance));
|
||||
mInstance = XR_NULL_HANDLE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,25 +33,25 @@ public:
|
|||
int32_t Init(JavaVM* const jvm, const jobject activityObject);
|
||||
void Shutdown();
|
||||
|
||||
XrInstance instance_ = XR_NULL_HANDLE;
|
||||
XrSystemId systemId_ = XR_NULL_SYSTEM_ID;
|
||||
XrSession session_ = XR_NULL_HANDLE;
|
||||
XrInstance mInstance = XR_NULL_HANDLE;
|
||||
XrSystemId mSystemId = XR_NULL_SYSTEM_ID;
|
||||
XrSession mSession = XR_NULL_HANDLE;
|
||||
// this structure contains the HMD's recommended eye textures sizes. In
|
||||
// OpenXR, this is meant to be extensible to allow spectator views as well.
|
||||
// One for each eye.
|
||||
XrViewConfigurationView viewConfigurationViews_[2] = {};
|
||||
XrViewConfigurationProperties viewportConfig_ = {};
|
||||
XrViewConfigurationView mViewConfigurationViews[2] = {};
|
||||
XrViewConfigurationProperties mViewportConfig = {};
|
||||
static constexpr XrViewConfigurationType VIEW_CONFIG_TYPE =
|
||||
XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO;
|
||||
XrSpace headSpace_ = XR_NULL_HANDLE;
|
||||
XrSpace forwardDirectionSpace_ = XR_NULL_HANDLE;
|
||||
XrSpace mHeadSpace = XR_NULL_HANDLE;
|
||||
XrSpace mForwardDirectionSpace = XR_NULL_HANDLE;
|
||||
|
||||
XrSpace localSpace_ = XR_NULL_HANDLE;
|
||||
XrSpace stageSpace_ = XR_NULL_HANDLE;
|
||||
size_t maxLayerCount_ = 0;
|
||||
XrSpace mLocalSpace = XR_NULL_HANDLE;
|
||||
XrSpace mStageSpace = XR_NULL_HANDLE;
|
||||
size_t mMaxLayerCount = 0;
|
||||
|
||||
// EGL context
|
||||
std::unique_ptr<EglContext> eglContext_;
|
||||
std::unique_ptr<EglContext> mEglContext;
|
||||
|
||||
private:
|
||||
int32_t OpenXRInit(JavaVM* const jvm, const jobject activityObject);
|
||||
|
|
|
@ -188,9 +188,9 @@ public:
|
|||
FAIL("OpenXR::Init() failed: error code %d", ret);
|
||||
}
|
||||
}
|
||||
vr::gSession = gOpenXr->session_;
|
||||
vr::gSession = gOpenXr->mSession;
|
||||
mInputStateStatic =
|
||||
std::make_unique<InputStateStatic>(OpenXr::GetInstance(), gOpenXr->session_);
|
||||
std::make_unique<InputStateStatic>(OpenXr::GetInstance(), gOpenXr->mSession);
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// Create the layers
|
||||
|
@ -204,7 +204,7 @@ public:
|
|||
// If user set "Void" in settings, don't render passthrough
|
||||
if (VRSettings::values.vr_environment !=
|
||||
static_cast<int32_t>(VRSettings::VREnvironmentType::VOID)) {
|
||||
mPassthroughLayer = std::make_unique<PassthroughLayer>(gOpenXr->session_);
|
||||
mPassthroughLayer = std::make_unique<PassthroughLayer>(gOpenXr->mSession);
|
||||
}
|
||||
|
||||
// Create the game surface layer.
|
||||
|
@ -226,16 +226,16 @@ public:
|
|||
defaultResolutionFactor);
|
||||
}
|
||||
mGameSurfaceLayer = std::make_unique<GameSurfaceLayer>(
|
||||
XrVector3f{0, 0, -2.0f}, jni, mActivityObject, gOpenXr->session_, resolutionFactor);
|
||||
XrVector3f{0, 0, -2.0f}, jni, mActivityObject, gOpenXr->mSession, resolutionFactor);
|
||||
}
|
||||
|
||||
// Create the cursor layer.
|
||||
mCursorLayer = std::make_unique<CursorLayer>(gOpenXr->session_);
|
||||
mCursorLayer = std::make_unique<CursorLayer>(gOpenXr->mSession);
|
||||
|
||||
#if defined(UI_LAYER)
|
||||
mErrorMessageLayer = std::make_unique<UILayer>("org/citra/citra_emu/vr/ErrorMessageLayer",
|
||||
XrVector3f{0, 0, -0.7}, jni, mActivityObject,
|
||||
gOpenXr->session_);
|
||||
gOpenXr->mSession);
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
|
@ -311,7 +311,7 @@ private:
|
|||
.count());
|
||||
}
|
||||
|
||||
mInputStateFrame.SyncButtonsAndThumbSticks(gOpenXr->session_, mInputStateStatic);
|
||||
mInputStateFrame.SyncButtonsAndThumbSticks(gOpenXr->mSession, mInputStateStatic);
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// Forward VR input to Android gamepad emulation
|
||||
|
@ -435,7 +435,7 @@ private:
|
|||
|
||||
{
|
||||
XrFrameWaitInfo wfi = {XR_TYPE_FRAME_WAIT_INFO, nullptr};
|
||||
OXR(xrWaitFrame(gOpenXr->session_, &wfi, &frameState));
|
||||
OXR(xrWaitFrame(gOpenXr->mSession, &wfi, &frameState));
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
|
@ -444,7 +444,7 @@ private:
|
|||
|
||||
{
|
||||
XrFrameBeginInfo bfd = {XR_TYPE_FRAME_BEGIN_INFO, nullptr};
|
||||
OXR(xrBeginFrame(gOpenXr->session_, &bfd));
|
||||
OXR(xrBeginFrame(gOpenXr->mSession, &bfd));
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////
|
||||
|
@ -461,13 +461,13 @@ private:
|
|||
const XrReferenceSpaceCreateInfo sci = {XR_TYPE_REFERENCE_SPACE_CREATE_INFO,
|
||||
nullptr, XR_REFERENCE_SPACE_TYPE_LOCAL,
|
||||
XrMath::Posef::Identity()};
|
||||
OXR(xrCreateReferenceSpace(gOpenXr->session_, &sci,
|
||||
&gOpenXr->forwardDirectionSpace_));
|
||||
OXR(xrCreateReferenceSpace(gOpenXr->mSession, &sci,
|
||||
&gOpenXr->mForwardDirectionSpace));
|
||||
}
|
||||
|
||||
// Get the pose of the local space.
|
||||
XrSpaceLocation lsl = {XR_TYPE_SPACE_LOCATION};
|
||||
OXR(xrLocateSpace(gOpenXr->forwardDirectionSpace_, gOpenXr->localSpace_,
|
||||
OXR(xrLocateSpace(gOpenXr->mForwardDirectionSpace, gOpenXr->mLocalSpace,
|
||||
frameState.predictedDisplayTime, &lsl));
|
||||
|
||||
// Set the forward direction of the new space.
|
||||
|
@ -478,10 +478,10 @@ private:
|
|||
const XrReferenceSpaceCreateInfo sci = {XR_TYPE_REFERENCE_SPACE_CREATE_INFO, nullptr,
|
||||
XR_REFERENCE_SPACE_TYPE_LOCAL,
|
||||
forwardDirectionPose};
|
||||
OXR(xrCreateReferenceSpace(gOpenXr->session_, &sci, &gOpenXr->headSpace_));
|
||||
OXR(xrCreateReferenceSpace(gOpenXr->mSession, &sci, &gOpenXr->mHeadSpace));
|
||||
}
|
||||
|
||||
mInputStateFrame.SyncHandPoses(gOpenXr->session_, mInputStateStatic, gOpenXr->localSpace_,
|
||||
mInputStateFrame.SyncHandPoses(gOpenXr->mSession, mInputStateStatic, gOpenXr->mLocalSpace,
|
||||
frameState.predictedDisplayTime);
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
|
@ -489,7 +489,7 @@ private:
|
|||
//////////////////////////////////////////////////
|
||||
|
||||
uint32_t layerCount = 0;
|
||||
std::vector<XrCompositionLayer> layers(gOpenXr->maxLayerCount_, XrCompositionLayer{});
|
||||
std::vector<XrCompositionLayer> layers(gOpenXr->mMaxLayerCount, XrCompositionLayer{});
|
||||
|
||||
// First, add the passthrough layer
|
||||
if (mPassthroughLayer != nullptr) {
|
||||
|
@ -499,11 +499,11 @@ private:
|
|||
layers[layerCount++].Passthrough = passthroughLayer;
|
||||
}
|
||||
|
||||
mGameSurfaceLayer->Frame(gOpenXr->localSpace_, layers, layerCount);
|
||||
mGameSurfaceLayer->Frame(gOpenXr->mLocalSpace, layers, layerCount);
|
||||
#if defined(UI_LAYER)
|
||||
if (gShouldShowErrorMessage) {
|
||||
XrCompositionLayerQuad quadLayer = {};
|
||||
mErrorMessageLayer->Frame(gOpenXr->localSpace_, quadLayer);
|
||||
mErrorMessageLayer->Frame(gOpenXr->mLocalSpace, quadLayer);
|
||||
layers[layerCount++].Quad = quadLayer;
|
||||
}
|
||||
#endif
|
||||
|
@ -641,7 +641,7 @@ private:
|
|||
|
||||
if (shouldRenderCursor) {
|
||||
XrCompositionLayerQuad quadLayer = {};
|
||||
mCursorLayer->Frame(gOpenXr->localSpace_, quadLayer, cursorPose3d, scaleFactor,
|
||||
mCursorLayer->Frame(gOpenXr->mLocalSpace, quadLayer, cursorPose3d, scaleFactor,
|
||||
cursorType);
|
||||
layers[layerCount++].mQuad = quadLayer;
|
||||
}
|
||||
|
@ -680,7 +680,7 @@ private:
|
|||
const XrFrameEndInfo endFrameInfo = {
|
||||
XR_TYPE_FRAME_END_INFO, nullptr, frameState.predictedDisplayTime,
|
||||
XR_ENVIRONMENT_BLEND_MODE_OPAQUE, layerCount, layerHeaders.data()};
|
||||
OXR(xrEndFrame(gOpenXr->session_, &endFrameInfo));
|
||||
OXR(xrEndFrame(gOpenXr->mSession, &endFrameInfo));
|
||||
}
|
||||
|
||||
void HandleSessionStateChanges(const XrSessionState state) {
|
||||
|
@ -690,10 +690,10 @@ private:
|
|||
XrSessionBeginInfo sbi = {};
|
||||
sbi.type = XR_TYPE_SESSION_BEGIN_INFO;
|
||||
sbi.next = nullptr;
|
||||
sbi.primaryViewConfigurationType = gOpenXr->viewportConfig_.viewConfigurationType;
|
||||
sbi.primaryViewConfigurationType = gOpenXr->mViewportConfig.viewConfigurationType;
|
||||
|
||||
XrResult result;
|
||||
OXR(result = xrBeginSession(gOpenXr->session_, &sbi));
|
||||
OXR(result = xrBeginSession(gOpenXr->mSession, &sbi));
|
||||
|
||||
mIsXrSessionActive = (result == XR_SUCCESS);
|
||||
|
||||
|
@ -703,32 +703,32 @@ private:
|
|||
PFN_xrPerfSettingsSetPerformanceLevelEXT pfnPerfSettingsSetPerformanceLevelEXT =
|
||||
NULL;
|
||||
OXR(xrGetInstanceProcAddr(
|
||||
gOpenXr->instance_, "xrPerfSettingsSetPerformanceLevelEXT",
|
||||
gOpenXr->mInstance, "xrPerfSettingsSetPerformanceLevelEXT",
|
||||
(PFN_xrVoidFunction*)(&pfnPerfSettingsSetPerformanceLevelEXT)));
|
||||
|
||||
OXR(pfnPerfSettingsSetPerformanceLevelEXT(gOpenXr->session_,
|
||||
OXR(pfnPerfSettingsSetPerformanceLevelEXT(gOpenXr->mSession,
|
||||
XR_PERF_SETTINGS_DOMAIN_CPU_EXT,
|
||||
VRSettings::values.cpu_level));
|
||||
OXR(pfnPerfSettingsSetPerformanceLevelEXT(
|
||||
gOpenXr->session_, XR_PERF_SETTINGS_DOMAIN_GPU_EXT, kGpuPerfLevel));
|
||||
gOpenXr->mSession, XR_PERF_SETTINGS_DOMAIN_GPU_EXT, kGpuPerfLevel));
|
||||
ALOGI("{}(): Set clock levels to CPU:{}, GPU:{}", __FUNCTION__,
|
||||
VRSettings::values.cpu_level, kGpuPerfLevel);
|
||||
|
||||
PFN_xrSetAndroidApplicationThreadKHR pfnSetAndroidApplicationThreadKHR = NULL;
|
||||
OXR(xrGetInstanceProcAddr(
|
||||
gOpenXr->instance_, "xrSetAndroidApplicationThreadKHR",
|
||||
gOpenXr->mInstance, "xrSetAndroidApplicationThreadKHR",
|
||||
(PFN_xrVoidFunction*)(&pfnSetAndroidApplicationThreadKHR)));
|
||||
|
||||
if (vr::gPriorityTid > 0) {
|
||||
ALOGD("Setting prio tid from main {}", vr::gPriorityTid);
|
||||
OXR(pfnSetAndroidApplicationThreadKHR(gOpenXr->session_,
|
||||
OXR(pfnSetAndroidApplicationThreadKHR(gOpenXr->mSession,
|
||||
XR_ANDROID_THREAD_TYPE_RENDERER_MAIN_KHR,
|
||||
vr::gPriorityTid));
|
||||
} else {
|
||||
ALOGD("Not setting prio tid from main");
|
||||
}
|
||||
OXR(pfnSetAndroidApplicationThreadKHR(
|
||||
gOpenXr->session_, XR_ANDROID_THREAD_TYPE_APPLICATION_MAIN_KHR, gettid()));
|
||||
gOpenXr->mSession, XR_ANDROID_THREAD_TYPE_APPLICATION_MAIN_KHR, gettid()));
|
||||
if (mGameSurfaceLayer) {
|
||||
ALOGD("SetSurface");
|
||||
mGameSurfaceLayer->SetSurface();
|
||||
|
@ -736,7 +736,7 @@ private:
|
|||
}
|
||||
} else if (state == XR_SESSION_STATE_STOPPING) {
|
||||
assert(mIsXrSessionActive);
|
||||
OXR(xrEndSession(gOpenXr->session_));
|
||||
OXR(xrEndSession(gOpenXr->mSession));
|
||||
mIsXrSessionActive = false;
|
||||
}
|
||||
}
|
||||
|
@ -786,7 +786,7 @@ private:
|
|||
baseEventHeader->type = XR_TYPE_EVENT_DATA_BUFFER;
|
||||
baseEventHeader->next = NULL;
|
||||
XrResult r;
|
||||
OXR(r = xrPollEvent(gOpenXr->instance_, &eventDataBuffer));
|
||||
OXR(r = xrPollEvent(gOpenXr->mInstance, &eventDataBuffer));
|
||||
if (r != XR_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue