forked from StereoKit/StereoKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevice.cpp
More file actions
132 lines (94 loc) · 2.73 KB
/
Copy pathdevice.cpp
File metadata and controls
132 lines (94 loc) · 2.73 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
// SPDX-License-Identifier: MIT
// The authors below grant copyright rights under the MIT license:
// Copyright (c) 2019-2023 Nick Klingensmith
// Copyright (c) 2023 Qualcomm Technologies, Inc.
#include "device.h"
#include "stereokit.h"
#include "sk_memory.h"
#include "xr_backends/openxr_view.h"
namespace sk {
device_data_t device_data = {};
///////////////////////////////////////////
void device_data_init(device_data_t* data) {
*data = {};
// TODO: get actual refresh rate from sk_app when available
data->display_refresh_rate = 90.0f;
}
///////////////////////////////////////////
void device_data_free(device_data_t* data) {
sk_free(data->name);
sk_free(data->runtime);
sk_free(data->gpu);
*data = {};
}
///////////////////////////////////////////
display_type_ device_display_get_type() {
return device_data.display_type;
}
///////////////////////////////////////////
display_blend_ device_display_get_blend() {
return device_data.display_blend;
}
///////////////////////////////////////////
bool32_t device_display_set_blend(display_blend_ blend) {
#if defined(SK_XR_OPENXR)
if (backend_xr_get_type() == backend_xr_type_openxr) {
return xr_set_blend(blend);
}
#endif
return false;
}
///////////////////////////////////////////
bool32_t device_display_valid_blend(display_blend_ blend) {
#if defined(SK_XR_OPENXR)
if (backend_xr_get_type() == backend_xr_type_openxr) {
return xr_blend_valid(blend);
}
#endif
return blend == display_blend_opaque;
}
///////////////////////////////////////////
float device_display_get_refresh_rate() {
return device_data.display_refresh_rate;
}
///////////////////////////////////////////
int32_t device_display_get_width() {
return device_data.display_width;
}
///////////////////////////////////////////
int32_t device_display_get_height() {
return device_data.display_height;
}
///////////////////////////////////////////
fov_info_t device_display_get_fov() {
return device_data.display_fov;
}
///////////////////////////////////////////
device_tracking_ device_get_tracking() {
return device_data.tracking;
}
///////////////////////////////////////////
const char* device_get_name() {
return device_data.name;
}
///////////////////////////////////////////
const char* device_get_runtime() {
return device_data.runtime;
}
///////////////////////////////////////////
uint64_t device_get_runtime_version() {
return device_data.runtime_version;
}
///////////////////////////////////////////
const char* device_get_gpu() {
return device_data.gpu;
}
///////////////////////////////////////////
bool32_t device_has_eye_gaze() {
return device_data.has_eye_gaze;
}
///////////////////////////////////////////
bool32_t device_has_hand_tracking() {
return device_data.has_hand_tracking;
}
}