Merge pull request #19326 from lvonasek/feature-openxr-supersampling

OpenXR - Add FBO supersampling
This commit is contained in:
Henrik Rydgård 2024-07-14 14:12:39 +02:00 committed by GitHub
commit ae3ff686f0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 4 deletions

View File

@ -160,10 +160,12 @@ void InitVROnAndroid(void* vm, void* activity, const char* system, int version,
if (strcmp(vendor, "PICO") == 0) {
VR_SetPlatformFLag(VR_PLATFORM_CONTROLLER_PICO, true);
VR_SetPlatformFLag(VR_PLATFORM_EXTENSION_INSTANCE, true);
VR_SetConfigFloat(VR_CONFIG_VIEWPORT_SUPERSAMPLING, 1.0f);
} else {
VR_SetPlatformFLag(VR_PLATFORM_CONTROLLER_QUEST, true);
VR_SetPlatformFLag(VR_PLATFORM_EXTENSION_PASSTHROUGH, true);
VR_SetPlatformFLag(VR_PLATFORM_EXTENSION_PERFORMANCE, true);
VR_SetConfigFloat(VR_CONFIG_VIEWPORT_SUPERSAMPLING, 1.3f);
}
VR_SetPlatformFLag(VR_PLATFORM_RENDERER_VULKAN, (GPUBackend)g_Config.iGPUBackend == GPUBackend::VULKAN);
@ -432,6 +434,8 @@ void UpdateVRInput(bool haptics, float dp_xscale, float dp_yscale) {
float speed = (cx + cy) / 2;
float x = cx - tan(ToRadians(angles.y - VR_GetConfigFloat(VR_CONFIG_MENU_YAW))) * speed;
float y = cy - tan(ToRadians(angles.x)) * speed * VR_GetConfigFloat(VR_CONFIG_CANVAS_ASPECT);
x *= VR_GetConfigFloat(VR_CONFIG_VIEWPORT_SUPERSAMPLING);
y *= VR_GetConfigFloat(VR_CONFIG_VIEWPORT_SUPERSAMPLING);
//set renderer
VR_SetConfig(VR_CONFIG_MOUSE_X, (int)x);

View File

@ -131,6 +131,9 @@ void VR_GetResolution(engine_t* engine, int *pWidth, int *pHeight) {
*pWidth = width;
*pHeight = height;
}
*pWidth *= VR_GetConfigFloat(VR_CONFIG_VIEWPORT_SUPERSAMPLING);
*pHeight *= VR_GetConfigFloat(VR_CONFIG_VIEWPORT_SUPERSAMPLING);
}
void VR_Recenter(engine_t* engine) {
@ -239,10 +242,7 @@ void VR_InitRenderer( engine_t* engine ) {
if (VR_GetPlatformFlag(VR_PLATFORM_RENDERER_VULKAN)) {
vulkanContext = &engine->graphicsBindingVulkan;
}
ovrRenderer_Create(engine->appState.Session, &engine->appState.Renderer,
engine->appState.ViewConfigurationView[0].recommendedImageRectWidth,
engine->appState.ViewConfigurationView[0].recommendedImageRectHeight,
vulkanContext);
ovrRenderer_Create(engine->appState.Session, &engine->appState.Renderer, eyeW, eyeH, vulkanContext);
if (VR_GetPlatformFlag(VRPlatformFlag::VR_PLATFORM_EXTENSION_PASSTHROUGH)) {
XrPassthroughCreateInfoFB ptci = {XR_TYPE_PASSTHROUGH_CREATE_INFO_FB};

View File

@ -22,6 +22,9 @@ enum VRConfigFloat {
VR_CONFIG_CANVAS_DISTANCE, VR_CONFIG_MENU_PITCH, VR_CONFIG_MENU_YAW, VR_CONFIG_RECENTER_YAW,
VR_CONFIG_CANVAS_ASPECT,
//viewport setup
VR_CONFIG_VIEWPORT_SUPERSAMPLING,
VR_CONFIG_FLOAT_MAX
};