mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-26 23:10:38 +00:00
OpenXR - SBS support prepared
This commit is contained in:
parent
ffca688f99
commit
15af767e25
@ -670,11 +670,13 @@ bool StartVRRender() {
|
||||
if (g_Config.bEnableVR && !vrIncompatibleGame && (appMode == VR_GAME_MODE) && vrScene) {
|
||||
VR_SetConfig(VR_CONFIG_MODE, vrStereo ? VR_MODE_STEREO_6DOF : VR_MODE_MONO_6DOF);
|
||||
vrFlatGame = false;
|
||||
} else {
|
||||
} else if (appMode == VR_GAME_MODE) {
|
||||
VR_SetConfig(VR_CONFIG_MODE, vrStereo ? VR_MODE_STEREO_SCREEN : VR_MODE_MONO_SCREEN);
|
||||
if (IsGameVRScene()) {
|
||||
vrFlatGame = true;
|
||||
}
|
||||
} else {
|
||||
VR_SetConfig(VR_CONFIG_MODE, VR_MODE_MONO_SCREEN);
|
||||
}
|
||||
vr3DGeometryCount /= 2;
|
||||
|
||||
@ -709,7 +711,7 @@ int GetVRFBOIndex() {
|
||||
|
||||
int GetVRPassesCount() {
|
||||
bool vrStereo = !PSP_CoreParameter().compat.vrCompat().ForceMono && g_Config.bEnableStereo;
|
||||
return vrStereo ? 2 : 1;
|
||||
return vrStereo ? 2 : 1;
|
||||
}
|
||||
|
||||
bool IsPassthroughSupported() {
|
||||
|
@ -384,14 +384,14 @@ void VR_EndFrame( engine_t* engine ) {
|
||||
void VR_FinishFrame( engine_t* engine ) {
|
||||
int vrMode = vrConfig[VR_CONFIG_MODE];
|
||||
XrCompositionLayerProjectionView projection_layer_elements[2] = {};
|
||||
if ((vrMode == VR_MODE_MONO_6DOF) || (vrMode == VR_MODE_STEREO_6DOF)) {
|
||||
if ((vrMode == VR_MODE_MONO_6DOF) || (vrMode == VR_MODE_SBS_6DOF) || (vrMode == VR_MODE_STEREO_6DOF)) {
|
||||
VR_SetConfigFloat(VR_CONFIG_MENU_YAW, hmdorientation.y);
|
||||
|
||||
for (int eye = 0; eye < ovrMaxNumEyes; eye++) {;
|
||||
ovrFramebuffer* frameBuffer = &engine->appState.Renderer.FrameBuffer[0];
|
||||
XrPosef pose = invViewTransform[0];
|
||||
if (vrMode != VR_MODE_MONO_6DOF) {
|
||||
frameBuffer = &engine->appState.Renderer.FrameBuffer[eye];
|
||||
if (vrMode == VR_MODE_STEREO_6DOF) {
|
||||
frameBuffer = &engine->appState.Renderer.FrameBuffer[eye];
|
||||
pose = invViewTransform[eye];
|
||||
}
|
||||
|
||||
@ -407,6 +407,13 @@ void VR_FinishFrame( engine_t* engine ) {
|
||||
projection_layer_elements[eye].subImage.imageRect.extent.width = frameBuffer->ColorSwapChain.Width;
|
||||
projection_layer_elements[eye].subImage.imageRect.extent.height = frameBuffer->ColorSwapChain.Height;
|
||||
projection_layer_elements[eye].subImage.imageArrayIndex = 0;
|
||||
|
||||
if (vrMode == VR_MODE_SBS_6DOF) {
|
||||
projection_layer_elements[eye].subImage.imageRect.extent.width /= 2;
|
||||
if (eye == 1) {
|
||||
projection_layer_elements[eye].subImage.imageRect.offset.x += frameBuffer->ColorSwapChain.Width / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
XrCompositionLayerProjection projection_layer = {};
|
||||
@ -418,7 +425,7 @@ void VR_FinishFrame( engine_t* engine ) {
|
||||
projection_layer.views = projection_layer_elements;
|
||||
|
||||
engine->appState.Layers[engine->appState.LayerCount++].Projection = projection_layer;
|
||||
} else if ((vrMode == VR_MODE_MONO_SCREEN) || (vrMode == VR_MODE_STEREO_SCREEN)) {
|
||||
} else if ((vrMode == VR_MODE_MONO_SCREEN) || (vrMode == VR_MODE_SBS_SCREEN) || (vrMode == VR_MODE_STEREO_SCREEN)) {
|
||||
|
||||
// Flat screen pose
|
||||
float distance = VR_GetConfigFloat(VR_CONFIG_CANVAS_DISTANCE) / 4.0f - 1.0f;
|
||||
@ -455,6 +462,13 @@ void VR_FinishFrame( engine_t* engine ) {
|
||||
if (vrMode == VR_MODE_MONO_SCREEN) {
|
||||
cylinder_layer.eyeVisibility = XR_EYE_VISIBILITY_BOTH;
|
||||
engine->appState.Layers[engine->appState.LayerCount++].Cylinder = cylinder_layer;
|
||||
} else if (vrMode == VR_MODE_SBS_SCREEN) {
|
||||
cylinder_layer.eyeVisibility = XR_EYE_VISIBILITY_LEFT;
|
||||
cylinder_layer.subImage.imageRect.extent.width /= 2;
|
||||
engine->appState.Layers[engine->appState.LayerCount++].Cylinder = cylinder_layer;
|
||||
cylinder_layer.eyeVisibility = XR_EYE_VISIBILITY_RIGHT;
|
||||
cylinder_layer.subImage.imageRect.offset.x += cylinder_layer.subImage.imageRect.extent.width;
|
||||
engine->appState.Layers[engine->appState.LayerCount++].Cylinder = cylinder_layer;
|
||||
} else {
|
||||
cylinder_layer.eyeVisibility = XR_EYE_VISIBILITY_LEFT;
|
||||
engine->appState.Layers[engine->appState.LayerCount++].Cylinder = cylinder_layer;
|
||||
|
@ -27,8 +27,10 @@ enum VRConfigFloat {
|
||||
|
||||
enum VRMode {
|
||||
VR_MODE_MONO_SCREEN,
|
||||
VR_MODE_SBS_SCREEN,
|
||||
VR_MODE_STEREO_SCREEN,
|
||||
VR_MODE_MONO_6DOF,
|
||||
VR_MODE_SBS_6DOF,
|
||||
VR_MODE_STEREO_6DOF
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user