mirror of
https://github.com/mitch030504/Wiicompiled_VR_Frame.git
synced 2026-10-06 08:00:25 +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>
100 lines
3.6 KiB
C++
100 lines
3.6 KiB
C++
#ifndef AURORA_D3D12_INTEROP_H
|
|
#define AURORA_D3D12_INTEROP_H
|
|
|
|
#ifdef __cplusplus
|
|
#include <cstdint>
|
|
extern "C" {
|
|
#else
|
|
#include "stdbool.h"
|
|
#include "stdint.h"
|
|
#endif
|
|
|
|
enum { AURORA_D3D12_STEREO_MAX_TARGETS = 2 };
|
|
|
|
/**
|
|
* Borrowed native objects owned by Aurora/Dawn. They remain valid until
|
|
* aurora_shutdown() and must not be released by the caller.
|
|
*
|
|
* colorDxgiFormat is the DXGI format matching Aurora's single-sample eye
|
|
* output. adapterLuid is returned in the same split representation used by
|
|
* OpenXR's XrGraphicsRequirementsD3D12KHR.
|
|
*/
|
|
typedef struct {
|
|
void* device;
|
|
void* queue;
|
|
int64_t colorDxgiFormat;
|
|
uint32_t adapterLuidLow;
|
|
int32_t adapterLuidHigh;
|
|
} AuroraD3D12NativeHandles;
|
|
|
|
/** One acquired OpenXR swapchain image for the next Aurora stereo sink. */
|
|
typedef struct {
|
|
void* resource;
|
|
uint32_t width;
|
|
uint32_t height;
|
|
int64_t dxgiFormat;
|
|
} AuroraD3D12StereoTarget;
|
|
|
|
/**
|
|
* Fired when Aurora either finishes or abandons the stereo sink. `success`
|
|
* guarantees that the final same-queue D3D12 copy and its completion fence were
|
|
* enqueued. A false result may occur after ExecuteCommandLists, so callers must
|
|
* conservatively retain externally owned targets until graphics/session
|
|
* teardown. The callback must not wait for the GPU or re-enter Aurora.
|
|
*/
|
|
typedef void (*AuroraD3D12StereoSubmittedCallback)(uint64_t frameToken, bool success,
|
|
void* userdata);
|
|
|
|
/** Returns false unless the active Aurora backend is Dawn D3D12. */
|
|
bool aurora_d3d12_get_native_handles(AuroraD3D12NativeHandles* handles);
|
|
|
|
/**
|
|
* Installs the internal zero-readback stereo sink. Call while Aurora's frame
|
|
* worker is idle, after aurora_initialize().
|
|
*/
|
|
bool aurora_d3d12_enable_stereo_bridge(AuroraD3D12StereoSubmittedCallback submitted,
|
|
void* userdata);
|
|
|
|
/**
|
|
* Publishes the acquired OpenXR image(s) for frameToken. Immersive projection
|
|
* frames supply two targets; virtual-screen quad frames supply one. Exactly
|
|
* one frame may be pending at a time.
|
|
*/
|
|
bool aurora_d3d12_set_stereo_targets(uint64_t frameToken,
|
|
const AuroraD3D12StereoTarget* targets,
|
|
uint32_t targetCount);
|
|
|
|
/**
|
|
* The same, plus the headset settings panel's quad-layer image when `panel` is
|
|
* not null (aurora_set_stereo_panel_layer): Aurora copies the panel into it, or
|
|
* a transparent image while the panel is not showing, with the eyes and under
|
|
* the same completion callback.
|
|
*/
|
|
bool aurora_d3d12_set_stereo_targets_with_panel(uint64_t frameToken,
|
|
const AuroraD3D12StereoTarget* targets,
|
|
uint32_t targetCount,
|
|
const AuroraD3D12StereoTarget* panel);
|
|
|
|
/**
|
|
* Withdraws frameToken only while its target has not been encoded. This is
|
|
* safe to race with Aurora's frame worker: false means the worker already owns
|
|
* encoded work (or the token is no longer pending), so the submitted callback
|
|
* remains the only completion authority. A successful cancellation performs
|
|
* no GPU work and deliberately does not fire the callback.
|
|
*/
|
|
bool aurora_d3d12_cancel_stereo_targets(uint64_t frameToken);
|
|
|
|
/**
|
|
* Removes the sink and drains bridge resources. The worker must be idle. Returns
|
|
* false when queued work cannot be fenced; in that case the bridge is retained
|
|
* for the process lifetime and the caller must likewise retain its graphics/XR
|
|
* owners rather than destroying resources with unknown GPU use.
|
|
*/
|
|
bool aurora_d3d12_disable_stereo_bridge();
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|