mirror of
https://github.com/mitch030504/Wiicompiled_VR_Frame.git
synced 2026-10-06 05:00:27 +02:00
The panel was drawn into the eye images, so below a 1.00x OpenXR resolution its 1440x1080 canvas was minified into a small eye region and the text became hard to read. It is now submitted as a quad layer of its own over the scene's projection or menu quad, which the compositor samples directly at any render scale. Each backend (D3D12, Windows Vulkan, Quest) makes the panel's swapchain pair (plus two shared buffers on the Quest) the first time the panel opens. While it is open, the frame hands Aurora one more stereo target after the eyes, which the bridge fills with the panel texture or a transparent image. The panel image follows the eyes' displayed/retained pairing, so a cancelled frame never shows an unwritten panel. The quad hangs where the pointer's hits are tested. Aurora leaves the panel out of the eyes in layer mode, and a backend that cannot make the layer falls back to drawing it into the eyes. On the Quest, debug.wiicompiled.panel_layer 0 selects the old path at run time. Measured there at a race start (render_scale 0.8), the layer costs nothing while the panel is closed; while it is open, app GPU time is 10.5 ms against 9.7 ms drawn into the eyes, with unchanged frame rates. The replay tests cover lazy creation, cancelled frames, closed and unplaced panels, and render-first pacing on D3D12 and Windows Vulkan. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
50 lines
2.3 KiB
C++
50 lines
2.3 KiB
C++
#pragma once
|
|
|
|
#include <aurora/math.hpp>
|
|
#include <webgpu/webgpu_cpp.h>
|
|
|
|
#include "stereo.hpp"
|
|
|
|
#include <cstdint>
|
|
|
|
struct ImDrawData;
|
|
|
|
// The headset-only panel of aurora_imgui_set_stereo_overlay. Everything here
|
|
// belongs to the frame worker, like the eye targets it draws into.
|
|
namespace aurora::stereo_overlay {
|
|
|
|
// Renders the panel's draw data into the panel texture and returns the command
|
|
// buffer holding that pass, which the caller submits before recording any other
|
|
// ImGui pass: the ImGui backend's projection uniform is shared by every pass, and
|
|
// the panel's canvas is not the desktop's size. Null draw data hides the panel,
|
|
// and so does any failure; both return a null command buffer.
|
|
wgpu::CommandBuffer prepare(ImDrawData* drawData, float widthFraction) noexcept;
|
|
|
|
// Draws the most recently prepared panel over a finished immersive eye, on the
|
|
// 2D layer's virtual screen seen through that eye's frustum and view.
|
|
void composite_immersive(const wgpu::CommandEncoder& encoder, const wgpu::TextureView& eye,
|
|
const Mat4x4<float>& eyeFrustum, const Mat3x4<float>& viewFromCenter,
|
|
uint32_t eyeIndex) noexcept;
|
|
|
|
// Draws it over a virtual-screen eye image, which is shown flat as a quad.
|
|
void composite_flat(const wgpu::CommandEncoder& encoder, const wgpu::TextureView& eye, const wgpu::Extent3D& size,
|
|
uint32_t eyeIndex) noexcept;
|
|
|
|
// Layer mode: the OpenXR backend shows the panel as its own compositor quad
|
|
// layer, sharp at any eye resolution, so it is no longer drawn into the eyes
|
|
// (both composite functions do nothing). Any thread; read by the frame worker.
|
|
void set_layer_mode(bool enabled) noexcept;
|
|
bool layer_mode() noexcept;
|
|
|
|
// Frame worker, inside a stereo sink: the image to copy into a panel layer of
|
|
// width x height in the eyes' format. That is the panel while it is showing at
|
|
// exactly that size, and otherwise a transparent image of that size, so a layer
|
|
// asked for before the panel's first frame (or after it closed) shows nothing.
|
|
// A transparent image is cleared once, by a pass recorded into `encoder`.
|
|
// False only when no image can be made.
|
|
bool layer_source(const wgpu::CommandEncoder& encoder, uint32_t width, uint32_t height, stereo::EyeImage& out) noexcept;
|
|
|
|
void shutdown() noexcept;
|
|
|
|
} // namespace aurora::stereo_overlay
|