Remove newly added dependencies on PPSSPP

This commit is contained in:
Henrik Rydgård 2022-10-18 10:35:42 +02:00
parent 0251f33ec3
commit feb4f9477a
7 changed files with 43 additions and 22 deletions

View File

@ -21,8 +21,6 @@
// TODO: https://github.com/floooh/sokol/blob/9a6237fcdf213e6da48e4f9201f144bcb2dcb46f/sokol_time.h#L229-L248
static double curtime = 0;
#ifdef _WIN32
static LARGE_INTEGER frequency;
@ -33,7 +31,6 @@ double time_now_d() {
if (frequency.QuadPart == 0) {
QueryPerformanceFrequency(&frequency);
QueryPerformanceCounter(&startTime);
curtime = 0.0;
frequencyMult = 1.0 / static_cast<double>(frequency.QuadPart);
}
LARGE_INTEGER time;

View File

@ -1,6 +1,5 @@
#pragma once
// TODO: Switch to PPSSPP logging
#ifdef ANDROID
#include <android/log.h>
#define ALOGE(...) __android_log_print(ANDROID_LOG_ERROR, "OpenXR", __VA_ARGS__);

View File

@ -8,7 +8,7 @@
#include <ctime>
#include <cassert>
#ifdef ANDROID
#if !defined(_WIN32)
#include <pthread.h>
#include <sys/prctl.h>
#endif
@ -253,7 +253,7 @@ void ovrFramebuffer_Destroy(ovrFramebuffer* frameBuffer) {
delete[] frameBuffer->VKDepthImages;
delete[] frameBuffer->VKFrameBuffers;
} else {
#ifdef ANDROID
#ifdef XR_USE_GRAPHICS_API_OPENGL_ES
GL(glDeleteFramebuffers(frameBuffer->TextureSwapChainLength, frameBuffer->GLFrameBuffers));
free(frameBuffer->GLFrameBuffers);
#endif
@ -270,7 +270,7 @@ void* ovrFramebuffer_SetCurrent(ovrFramebuffer* frameBuffer) {
if (frameBuffer->UseVulkan) {
return (void *)frameBuffer->VKFrameBuffers[frameBuffer->TextureSwapChainIndex];
} else {
#ifdef ANDROID
#ifdef XR_USE_GRAPHICS_API_OPENGL_ES
GL(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, frameBuffer->GLFrameBuffers[frameBuffer->TextureSwapChainIndex]));
#endif
return nullptr;
@ -302,7 +302,7 @@ void ovrFramebuffer_Acquire(ovrFramebuffer* frameBuffer) {
if (frameBuffer->UseVulkan) {
//TODO:implement
} else {
#ifdef ANDROID
#ifdef XR_USE_GRAPHICS_API_OPENGL_ES
GL(glEnable( GL_SCISSOR_TEST ));
GL(glViewport( 0, 0, frameBuffer->Width, frameBuffer->Height ));
GL(glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ));
@ -324,7 +324,7 @@ void ovrFramebuffer_Release(ovrFramebuffer* frameBuffer) {
if (frameBuffer->UseVulkan) {
//TODO:implement
} else {
#ifdef ANDROID
#ifdef XR_USE_GRAPHICS_API_OPENGL_ES
GL(glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE));
GL(glClearColor(0.0f, 0.0f, 0.0f, 1.0f));
GL(glClear(GL_COLOR_BUFFER_BIT));
@ -355,7 +355,7 @@ void ovrRenderer_Create(XrSession session, ovrRenderer* renderer, int width, int
if (vulkanContext) {
ovrFramebuffer_CreateVK(session, &renderer->FrameBuffer[i], width, height, multiview, vulkanContext);
} else {
#ifdef ANDROID
#ifdef XR_USE_GRAPHICS_API_OPENGL_ES
ovrFramebuffer_CreateGL(session, &renderer->FrameBuffer[i], width, height, multiview);
#endif
}
@ -373,7 +373,7 @@ void ovrRenderer_MouseCursor(ovrRenderer* renderer, int x, int y, int size) {
if (renderer->FrameBuffer[0].UseVulkan) {
//TODO:implement
} else {
#ifdef ANDROID
#ifdef XR_USE_GRAPHICS_API_OPENGL_ES
GL(glEnable(GL_SCISSOR_TEST));
GL(glScissor(x, y, size, size));
GL(glViewport(x, y, size, size));
@ -433,6 +433,8 @@ void ovrApp_HandleSessionStateChanges(ovrApp* app, XrSessionState state) {
app->SessionActive = (result == XR_SUCCESS);
// Set session state once we have entered VR mode and have a valid session object.
// TODO: This should be a runtime check of the extension's presence, no?
#ifdef OPENXR_HAS_PERFORMANCE_EXTENSION
if (app->SessionActive) {
XrPerfSettingsLevelEXT cpuPerfLevel = XR_PERF_SETTINGS_LEVEL_BOOST_EXT;

View File

@ -1,6 +1,6 @@
#pragma once
#include "Common/VR/VRBase.h"
#include "VRBase.h"
void ovrApp_Clear(ovrApp* app);
void ovrApp_Destroy(ovrApp* app);

View File

@ -1,7 +1,5 @@
#include "VRInput.h"
#include <string.h>
#include <Common/TimeUtil.h>
#include <cstring>
#ifdef OPENXR
@ -41,11 +39,39 @@ XrActionStateVector2f moveJoystickState[2];
float vibration_channel_duration[2] = {0.0f, 0.0f};
float vibration_channel_intensity[2] = {0.0f, 0.0f};
#if !defined(_WIN32)
unsigned long sys_timeBase = 0;
int milliseconds(void) {
return (int)(1000.0 * time_now_d());
struct timeval tp;
gettimeofday(&tp, NULL);
if (!sys_timeBase) {
sys_timeBase = tp.tv_sec;
return tp.tv_usec / 1000;
}
return (tp.tv_sec - sys_timeBase) * 1000 + tp.tv_usec / 1000;
}
#else
static LARGE_INTEGER frequency;
static double frequencyMult;
static LARGE_INTEGER startTime;
int milliseconds() {
if (frequency.QuadPart == 0) {
QueryPerformanceFrequency(&frequency);
QueryPerformanceCounter(&startTime);
frequencyMult = 1.0 / static_cast<double>(frequency.QuadPart);
}
LARGE_INTEGER time;
QueryPerformanceCounter(&time);
double elapsed = static_cast<double>(time.QuadPart - startTime.QuadPart);
return (int)(elapsed * frequencyMult * 1000.0);
}
#endif
XrTime ToXrTime(const double timeInSeconds) {
return (XrTime)(timeInSeconds * 1e9);

View File

@ -1,10 +1,9 @@
#define _USE_MATH_DEFINES
#include <cmath>
#include "VRMath.h"
#include "Common/Math/math_util.h"
float ToDegrees(float rad) {
return (float)(rad / M_PI * 180.0f);
}

View File

@ -2,8 +2,6 @@
#include "VRInput.h"
#include "VRRenderer.h"
#include "Common/Math/math_util.h"
#include <cassert>
#include <cstdlib>
#include <cstring>