mirror of
https://github.com/mitch030504/AstroQuest-Frame.git
synced 2026-10-23 14:01:33 +02:00
On top of the shadps4-arm64 core imported in the previous commit: - PlayStation VR emulation: headset, tracker, reprojection, camera and social screen; the player's seat and view reset; head velocity for head-butts; field of view settings - Sound: a native Ngs2 engine (samplers, submixers, effects), the Audio3d spatializer, virtual surround for headset speakers, microphone pass-through; libSceJson2; libSceFiber on FEX - Fixes for CUSA12392 under emulation: real-time step, pace and resolution governor, larger render sizes on the PC, save loading at start - Renderer: geometry shaders fed with fans/polygons/loops, cube-array layers of light probes, sample-count mismatches on Adreno, timeline semaphore hang, FXAA in place of the MSAA resolve, sharpening, VR frame export - quest-host: the Quest app (OpenXR host that runs the glibc core as a child process, frames through AHardwareBuffers, DualSense mapping, hand-tracked controller placement, KGSL shim) - PC: in-process OpenXR host (Virtual Desktop or any OpenXR runtime), Touch controllers as the gamepad, launcher with a settings window; vendored OpenXR SDK 1.1.63 - Builds keep the build machine's folders out of the binaries (-ffile-prefix-map); machine settings (Python, headset serial, signing key) live in git-ignored tools/*.local files - tools: build, packaging and test scripts for Windows and the headset - README with installation, license (GPL-2.0-or-later), third-party notices and thanks No game files are part of the repository; .gitignore only lets listed paths in. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
81 lines
2.5 KiB
C++
81 lines
2.5 KiB
C++
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
#pragma once
|
|
|
|
// The GL side of showing the emulator's frames, shared by the OpenXR host and by the self test
|
|
// that exercises the same path without a headset session.
|
|
|
|
#include <cstdint>
|
|
#include <vector>
|
|
|
|
// Extension entry points (EGL images over hardware buffers) are only declared on request.
|
|
#define EGL_EGLEXT_PROTOTYPES
|
|
#define GL_GLEXT_PROTOTYPES
|
|
#include <EGL/egl.h>
|
|
#include <EGL/eglext.h>
|
|
#include <GLES3/gl3.h>
|
|
// The extension header relies on the types the one above defines.
|
|
#include <GLES2/gl2ext.h>
|
|
|
|
struct AHardwareBuffer;
|
|
class CoreProcess;
|
|
|
|
/// An OpenGL ES 3 context that draws to nothing: everything is rendered to textures.
|
|
struct GlContext {
|
|
EGLDisplay display{EGL_NO_DISPLAY};
|
|
EGLConfig config{};
|
|
EGLContext context{EGL_NO_CONTEXT};
|
|
EGLSurface surface{EGL_NO_SURFACE};
|
|
|
|
bool Create();
|
|
void Destroy();
|
|
};
|
|
|
|
/// The images the emulator renders into: hardware buffers handed to it as dma-bufs, each of them
|
|
/// also a GL texture here, so that a frame gets from one process to the other without a copy.
|
|
class FrameBuffers {
|
|
public:
|
|
static constexpr uint32_t Count = 3;
|
|
|
|
/// Allocates the buffers and offers them to the core. Needs a current GL context.
|
|
bool Create(EGLDisplay display, uint32_t width, uint32_t height, CoreProcess& core);
|
|
void Destroy(EGLDisplay display);
|
|
|
|
bool IsValid(uint32_t index) const {
|
|
return index < textures.size();
|
|
}
|
|
GLuint Texture(uint32_t index) const {
|
|
return textures[index];
|
|
}
|
|
|
|
private:
|
|
std::vector<AHardwareBuffer*> buffers;
|
|
std::vector<EGLImageKHR> images;
|
|
std::vector<GLuint> textures;
|
|
};
|
|
|
|
/// Copies a frame to the framebuffer that is bound, upside up and in the right color encoding.
|
|
class FrameBlitter {
|
|
public:
|
|
bool Create();
|
|
void Destroy();
|
|
|
|
/// `srgb_target` is for sRGB targets: they encode whatever is written to them, while the
|
|
/// emulator delivers values that are display-ready already. Where the GPU can be told to
|
|
/// leave that encoding out, the frame is written as it is; elsewhere it is decoded first,
|
|
/// which costs a power function per pixel.
|
|
void Draw(GLuint texture, uint32_t width, uint32_t height, bool swap_red_blue,
|
|
bool srgb_target) const;
|
|
|
|
/// Whether frames go into sRGB targets unchanged (see Draw).
|
|
bool WritesUnencoded() const {
|
|
return write_control;
|
|
}
|
|
|
|
private:
|
|
GLuint program{};
|
|
GLuint vertex_array{};
|
|
GLint uniform_swap{-1};
|
|
GLint uniform_decode{-1};
|
|
bool write_control{};
|
|
};
|