mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
102 lines
2.2 KiB
C
102 lines
2.2 KiB
C
#pragma once
|
|
|
|
//OpenXR
|
|
#define XR_USE_GRAPHICS_API_OPENGL_ES 1
|
|
#define XR_USE_PLATFORM_ANDROID 1
|
|
#include <EGL/egl.h>
|
|
#include <EGL/eglext.h>
|
|
#include <jni.h>
|
|
#include <math.h>
|
|
#include <openxr.h>
|
|
#include <openxr_platform.h>
|
|
|
|
#define ALOGE(...) printf(__VA_ARGS__)
|
|
#define ALOGV(...) printf(__VA_ARGS__)
|
|
|
|
typedef union {
|
|
XrCompositionLayerProjection Projection;
|
|
XrCompositionLayerCylinderKHR Cylinder;
|
|
} ovrCompositorLayer_Union;
|
|
|
|
enum { ovrMaxLayerCount = 1 };
|
|
enum { ovrMaxNumEyes = 2 };
|
|
|
|
#define GL(func) func;
|
|
#define OXR(func) func;
|
|
|
|
typedef struct {
|
|
JavaVM* Vm;
|
|
jobject ActivityObject;
|
|
JNIEnv* Env;
|
|
char AppName[64];
|
|
int AppVersion;
|
|
} ovrJava;
|
|
|
|
typedef struct {
|
|
XrSwapchain Handle;
|
|
uint32_t Width;
|
|
uint32_t Height;
|
|
} ovrSwapChain;
|
|
|
|
typedef struct {
|
|
int Width;
|
|
int Height;
|
|
uint32_t TextureSwapChainLength;
|
|
uint32_t TextureSwapChainIndex;
|
|
ovrSwapChain ColorSwapChain;
|
|
XrSwapchainImageOpenGLESKHR* ColorSwapChainImage;
|
|
unsigned int* DepthBuffers;
|
|
unsigned int* FrameBuffers;
|
|
} ovrFramebuffer;
|
|
|
|
typedef struct {
|
|
ovrFramebuffer FrameBuffer;
|
|
} ovrRenderer;
|
|
|
|
typedef struct {
|
|
int Focused;
|
|
|
|
XrInstance Instance;
|
|
XrSession Session;
|
|
XrViewConfigurationProperties ViewportConfig;
|
|
XrViewConfigurationView ViewConfigurationView[ovrMaxNumEyes];
|
|
XrSystemId SystemId;
|
|
XrSpace HeadSpace;
|
|
XrSpace StageSpace;
|
|
XrSpace FakeStageSpace;
|
|
XrSpace CurrentSpace;
|
|
int SessionActive;
|
|
|
|
int SwapInterval;
|
|
// These threads will be marked as performance threads.
|
|
int MainThreadTid;
|
|
int RenderThreadTid;
|
|
ovrCompositorLayer_Union Layers[ovrMaxLayerCount];
|
|
int LayerCount;
|
|
|
|
ovrRenderer Renderer;
|
|
} ovrApp;
|
|
|
|
typedef struct {
|
|
uint64_t frameIndex;
|
|
ovrApp appState;
|
|
ovrJava java;
|
|
float predictedDisplayTime;
|
|
} engine_t;
|
|
|
|
void ovrApp_Clear(ovrApp* app);
|
|
void ovrApp_Destroy(ovrApp* app);
|
|
int ovrApp_HandleXrEvents(ovrApp* app);
|
|
|
|
void ovrFramebuffer_Acquire(ovrFramebuffer* frameBuffer);
|
|
void ovrFramebuffer_Resolve(ovrFramebuffer* frameBuffer);
|
|
void ovrFramebuffer_Release(ovrFramebuffer* frameBuffer);
|
|
void ovrFramebuffer_SetCurrent(ovrFramebuffer* frameBuffer);
|
|
void ovrFramebuffer_SetNone();
|
|
|
|
void ovrRenderer_Create(
|
|
XrSession session,
|
|
ovrRenderer* renderer,
|
|
int suggestedEyeTextureWidth,
|
|
int suggestedEyeTextureHeight);
|
|
void ovrRenderer_Destroy(ovrRenderer* renderer);
|