forked from KhronosGroup/OpenXR-SDK-Source
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenxr_program.h
53 lines (38 loc) · 1.93 KB
/
openxr_program.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright (c) 2017-2023, The Khronos Group Inc.
//
// SPDX-License-Identifier: Apache-2.0
#pragma once
struct IOpenXrProgram {
virtual ~IOpenXrProgram() = default;
// Create an Instance and other basic instance-level initialization.
virtual void CreateInstance() = 0;
// Select a System for the view configuration specified in the Options
virtual void InitializeSystem() = 0;
// Initialize the graphics device for the selected system.
virtual void InitializeDevice() = 0;
// Create a Session and other basic session-level initialization.
virtual void InitializeSession() = 0;
// Create a Swapchain which requires coordinating with the graphics plugin to select the format, getting the system graphics
// properties, getting the view configuration and grabbing the resulting swapchain images.
virtual void CreateSwapchains() = 0;
// Process any events in the event queue.
virtual void PollEvents(bool* exitRenderLoop, bool* requestRestart) = 0;
// Manage session lifecycle to track if RenderFrame should be called.
virtual bool IsSessionRunning() const = 0;
// Manage session state to track if input should be processed.
virtual bool IsSessionFocused() const = 0;
// Sample input actions and generate haptic feedback.
virtual void PollActions() = 0;
// Create and submit a frame.
virtual void RenderFrame() = 0;
// Get preferred blend mode based on the view configuration specified in the Options
virtual XrEnvironmentBlendMode GetPreferredBlendMode() const = 0;
};
struct Swapchain {
XrSwapchain handle;
int32_t width;
int32_t height;
};
std::shared_ptr<IOpenXrProgram> CreateOpenXrProgram(const std::shared_ptr<Options>& options,
const std::shared_ptr<IPlatformPlugin>& platformPlugin,
const std::shared_ptr<IGraphicsPlugin>& graphicsPlugin);