Skip to content

Commit f064aa4

Browse files
committed
OpenXR 1.0.3 release (7-October-2019)
Patch release for the 1.0 series. Note that this release includes changes to adjust the symbol exports from dynamic library versions of the loader to align with the specification. Only **core** symbols are currently exported. All extension symbols must be retrieved using `xrGetInstanceProcAddr`. ### GitHub Pull Requests These had been integrated into the public repo incrementally. - General, Build, Other - #139 - Write output atomically at the end of generator scripts - #119 - Loader test updates. - #116 - Static analysis cleanups. - Loader - #140 - Permit broader valid usage re: layers - #133 - Remove shwapi dependency - #132 - Fix directory searching for layers - #130 - Fix exporting of symbols on Windows. - #129 - Remove debug ext only when added by loader - fixes usage of debug ext on runtimes that do not provide it themselves. - #125 - Include a `OutputDebugString` logger for Win32 - Layers - #138 - Don't validate output enum buffer values - #137 - Fix incorrect filenames in the generated API layer JSON ### Internal issues - General, Build, Other - Fix warnings in MSVC static code analysis mode (internal MR 1574) - Validation layer improvements and fixes (internal MR 1568) - Update vendored jsoncpp to 1.9.1 (internal MR 1523) - Loader - Add ability to quiet the loader's default output (internal MR 1576) - Fix conformance of loader in `xrEnumerateApiLayerProperties`/`xrEnumerateInstanceExtensionProperties` - hello_xr - Simplify action usage in hello_xr (internal MR 1553) - Registry - Add `XR_EXT_view_configuration_depth_range` extension (internal MR 1502, internal issue 1201) - Reserve a Monado extension (internal MR 1541)
1 parent e74f25f commit f064aa4

87 files changed

Lines changed: 3391 additions & 4283 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.SDK.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,50 @@ along with any public pull requests that have been accepted.
1212
In this repository in particular, since it is primarily software,
1313
pull requests may be integrated as they are accepted even between periodic updates.
1414

15+
## OpenXR 1.0.3 release (7-October-2019)
16+
17+
Patch release for the 1.0 series.
18+
19+
Note that this release includes changes to adjust the symbol exports from
20+
dynamic library versions of the loader to align with the specification. Only
21+
**core** symbols are currently exported. All extension symbols must be retrieved
22+
using `xrGetInstanceProcAddr`.
23+
24+
### GitHub Pull Requests
25+
26+
These had been integrated into the public repo incrementally.
27+
28+
- General, Build, Other
29+
- #139 - Write output atomically at the end of generator scripts
30+
- #119 - Loader test updates.
31+
- #116 - Static analysis cleanups.
32+
- Loader
33+
- #140 - Permit broader valid usage re: layers
34+
- #133 - Remove shwapi dependency
35+
- #132 - Fix directory searching for layers
36+
- #130 - Fix exporting of symbols on Windows.
37+
- #129 - Remove debug ext only when added by loader - fixes usage of debug ext
38+
on runtimes that do not provide it themselves.
39+
- #125 - Include a `OutputDebugString` logger for Win32
40+
- Layers
41+
- #138 - Don't validate output enum buffer values
42+
- #137 - Fix incorrect filenames in the generated API layer JSON
43+
44+
### Internal issues
45+
46+
- General, Build, Other
47+
- Fix warnings in MSVC static code analysis mode (internal MR 1574)
48+
- Validation layer improvements and fixes (internal MR 1568)
49+
- Update vendored jsoncpp to 1.9.1 (internal MR 1523)
50+
- Loader
51+
- Add ability to quiet the loader's default output (internal MR 1576)
52+
- Fix conformance of loader in `xrEnumerateApiLayerProperties`/`xrEnumerateInstanceExtensionProperties`
53+
- hello_xr
54+
- Simplify action usage in hello_xr (internal MR 1553)
55+
- Registry
56+
- Add `XR_EXT_view_configuration_depth_range` extension (internal MR 1502, internal issue 1201)
57+
- Reserve a Monado extension (internal MR 1541)
58+
1559
## OpenXR 1.0.2 release (27-August-2019)
1660

1761
Patch release for the 1.0 series.

maintainer-scripts/common.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ getSDKSourceFilenames() {
146146
src/ \
147147
| grep -v "conformance" \
148148
| grep -v "catch2" \
149-
| grep -v "function_info"
149+
| grep -v "function_info" \
150+
| grep -v "stb"
150151
}
151152

152153

specification/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ ifneq (,$(strip $(VERY_STRICT)))
4343
ASCIIDOC := $(ASCIIDOC) --failure-level WARN
4444
endif
4545

46-
SPECREVISION = 1.0.2
46+
SPECREVISION = 1.0.3
4747
REVISION_COMPONENTS = $(subst ., ,$(SPECREVISION))
4848
MAJORMINORVER = $(word 1,$(REVISION_COMPONENTS)).$(word 2,$(REVISION_COMPONENTS))
4949

specification/registry/xr.xml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ maintained in the master branch of the Khronos OpenXR GitHub project.
4949
<tag name="INTEL" author="Intel" contact="Javier Martinez @javier"/>
5050
<tag name="KHR" author="Khronos" contact="Nick Whiting @whitingn"/>
5151
<tag name="LUNARG" author="LunarG" contact="Mark Young @marky_lunarg, Karl Schultz @karlschultz"/>
52+
<tag name="MAGICLEAP" author="Magic Leap" contact="Blake Taylor @theblindprogramm3r"/>
5253
<tag name="MND" author="Monado Project" contact="Ryan Pavlik @rpavlik"/>
5354
<tag name="MSFT" author="Microsoft" contact="Alex Turner @alexturn, Yin Li @yl_msft, Bryce Hutchings @brycehutchings, Lachlan Ford @laford_msft, Minmin Gong @gongminmin "/>
5455
<tag name="NV" author="NVIDIA Corporation" contact="Satish Salian @ssalian, Robert Menzel"/>
@@ -112,7 +113,7 @@ maintained in the master branch of the Khronos OpenXR GitHub project.
112113
updates them automatically by processing a line at a time.
113114
-->
114115
<type category="define">// OpenXR current version number.
115-
#define <name>XR_CURRENT_API_VERSION</name> <type>XR_MAKE_VERSION</type>(1, 0, 2)</type>
116+
#define <name>XR_CURRENT_API_VERSION</name> <type>XR_MAKE_VERSION</type>(1, 0, 3)</type>
116117

117118
<!--
118119
NOTE: For avoidance of ambiguity, there should only be 1 <name> tag immediately in
@@ -958,6 +959,16 @@ maintained in the master branch of the Khronos OpenXR GitHub project.
958959
<member><type>D3D_FEATURE_LEVEL</type> <name>minFeatureLevel</name></member>
959960
</type>
960961

962+
<!-- struct types for XR_EXT_view_configuration_depth_range -->
963+
<type category="struct" name="XrViewConfigurationDepthRangeEXT" structextends="XrViewConfigurationView">
964+
<member values="XR_TYPE_VIEW_CONFIGURATION_DEPTH_RANGE_EXT"><type>XrStructureType</type> <name>type</name></member>
965+
<member><type>void</type>* <name>next</name></member>
966+
<member><type>float</type> <name>recommendedNearZ</name></member>
967+
<member><type>float</type> <name>minNearZ</name></member>
968+
<member><type>float</type> <name>recommendedFarZ</name></member>
969+
<member><type>float</type> <name>maxFarZ</name></member>
970+
</type>
971+
961972
<!-- The PFN_xrVoidFunction type are used by XrGetInstanceProcAddr below -->
962973
<type category="funcpointer">typedef void (XRAPI_PTR *<name>PFN_xrVoidFunction</name>)(void);</type>
963974

@@ -1025,7 +1036,7 @@ maintained in the master branch of the Khronos OpenXR GitHub project.
10251036
<enum value="4" name="XR_TYPE_SYSTEM_GET_INFO"/>
10261037
<enum value="5" name="XR_TYPE_SYSTEM_PROPERTIES"/>
10271038
<enum value="6" name="XR_TYPE_VIEW_LOCATE_INFO"/>
1028-
<enum value="7" name="XR_TYPE_VIEW"/>
1039+
<enum value="7" name="XR_TYPE_VIEW"/>
10291040
<enum value="8" name="XR_TYPE_SESSION_CREATE_INFO"/>
10301041
<enum value="9" name="XR_TYPE_SWAPCHAIN_CREATE_INFO"/>
10311042
<enum value="10" name="XR_TYPE_SESSION_BEGIN_INFO"/>
@@ -1063,7 +1074,7 @@ maintained in the master branch of the Khronos OpenXR GitHub project.
10631074
<enum value="56" name="XR_TYPE_SWAPCHAIN_IMAGE_WAIT_INFO"/>
10641075
<enum value="57" name="XR_TYPE_SWAPCHAIN_IMAGE_RELEASE_INFO"/>
10651076
<enum value="58" name="XR_TYPE_ACTION_STATE_GET_INFO"/>
1066-
<enum value="59" name="XR_TYPE_HAPTIC_ACTION_INFO"/>
1077+
<enum value="59" name="XR_TYPE_HAPTIC_ACTION_INFO"/>
10671078
<enum value="60" name="XR_TYPE_SESSION_ACTION_SETS_ATTACH_INFO"/>
10681079
<enum value="61" name="XR_TYPE_ACTIONS_SYNC_INFO"/>
10691080
<enum value="62" name="XR_TYPE_BOUND_SOURCES_FOR_ACTION_ENUMERATE_INFO"/>
@@ -2031,6 +2042,7 @@ maintained in the master branch of the Khronos OpenXR GitHub project.
20312042
</require>
20322043
</extension>
20332044

2045+
20342046
<!-- Vulkan image format list extension -->
20352047
<extension name="XR_KHR_vulkan_swapchain_format_list" number="15" type="instance" requires="XR_KHR_vulkan_enable" supported="openxr" protect="XR_USE_GRAPHICS_API_VULKAN">
20362048
<require>
@@ -2359,5 +2371,21 @@ maintained in the master branch of the Khronos OpenXR GitHub project.
23592371
</require>
23602372
</extension>
23612373

2374+
<extension name="XR_MND_extension_46" number="46" type="instance" supported="disabled">
2375+
<require>
2376+
<enum value="1" name="XR_MND_extension_46_SPEC_VERSION"/>
2377+
<enum value="&quot;XR_MND_extension_46&quot;" name="XR_MND_EXTENSION_46_EXTENSION_NAME"/>
2378+
</require>
2379+
</extension>
2380+
2381+
<extension name="XR_EXT_view_configuration_depth_range" number="47" type="instance" supported="openxr">
2382+
<require>
2383+
<enum value="1" name="XR_EXT_view_configuration_depth_range_SPEC_VERSION"/>
2384+
<enum value="&quot;XR_EXT_view_configuration_depth_range&quot;" name="XR_EXT_VIEW_CONFIGURATION_DEPTH_RANGE_EXTENSION_NAME"/>
2385+
<enum offset="0" extends="XrStructureType" name="XR_TYPE_VIEW_CONFIGURATION_DEPTH_RANGE_EXT"/>
2386+
<type name="XrViewConfigurationDepthRangeEXT"/>
2387+
</require>
2388+
</extension>
2389+
23622390
</extensions>
23632391
</registry>

src/common/filesystem_utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ bool FileSysUtilsFindFilesInPath(const std::string& path, std::vector<std::strin
154154

155155
// For pre C++17 compiler that doesn't support experimental filesystem
156156

157-
bool FileSysUtilsIsRegularFile(const std::string& path) {
157+
bool FileSysUtilsIsRegularFile(const std::string& path) {
158158
const DWORD attr = GetFileAttributesW(utf8_to_wide(path).c_str());
159159
return attr != INVALID_FILE_ATTRIBUTES && !(attr & FILE_ATTRIBUTE_DIRECTORY);
160160
}

src/common/object_info.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ NamesAndLabels DebugUtilsData::PopulateNamesAndLabels(std::vector<XrSdkLogObject
243243

244244
void DebugUtilsData::WrapCallbackData(AugmentedCallbackData* aug_data,
245245
const XrDebugUtilsMessengerCallbackDataEXT* callback_data) const {
246-
// If there's nothing to add, just retun the original data as the augmented copy
246+
// If there's nothing to add, just return the original data as the augmented copy
247247
aug_data->exported_data = callback_data;
248248
if (object_info_.Empty() || callback_data->objectCount == 0) {
249249
return;

src/common/platform_utils.hpp

Lines changed: 60 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#include "xr_dependencies.h"
2424
#include <string>
25+
#include <stdlib.h>
2526

2627
// OpenXR paths and registry key locations
2728
#define OPENXR_RELATIVE_PATH "openxr/"
@@ -57,6 +58,8 @@ namespace detail {
5758

5859
static inline char* ImplGetEnv(const char* name) { return getenv(name); }
5960

61+
static inline int ImplSetEnv(const char* name, const char* value, int overwrite) { return setenv(name, value, overwrite); }
62+
6063
static inline char* ImplGetSecureEnv(const char* name) {
6164
#ifdef HAVE_SECURE_GETENV
6265
return secure_getenv(name);
@@ -93,6 +96,12 @@ static inline std::string PlatformUtilsGetSecureEnv(const char* name) {
9396

9497
static inline bool PlatformUtilsGetEnvSet(const char* name) { return detail::ImplGetEnv(name) != nullptr; }
9598

99+
static inline bool PlatformUtilsSetEnv(const char* name, const char* value) {
100+
const int shouldOverwrite = 1;
101+
int result = detail::ImplSetEnv(name, value, shouldOverwrite);
102+
return (result == 0);
103+
}
104+
96105
#elif defined(XR_OS_APPLE)
97106

98107
static inline std::string PlatformUtilsGetEnv(const char* name) {
@@ -113,6 +122,12 @@ static inline std::string PlatformUtilsGetSecureEnv(const char* name) {
113122

114123
static inline bool PlatformUtilsGetEnvSet(const char* name) { return detail::ImplGetEnv(name) != nullptr; }
115124

125+
static inline bool PlatformUtilsSetEnv(const char* name, const char* value) {
126+
const int shouldOverwrite = 1;
127+
int result = detail::ImplSetEnv(name, value, shouldOverwrite);
128+
return (result == 0);
129+
}
130+
116131
// Prefix for the Apple global runtime JSON file name
117132
static const std::string rt_dir_prefix = "/usr/local/share/openxr/";
118133
static const std::string rt_filename = "/active_runtime.json";
@@ -181,7 +196,9 @@ inline std::string wide_to_utf8(const std::wstring& wideText) {
181196
return narrowText;
182197
}
183198

199+
// Returns true if the current process has an integrity level > SECURITY_MANDATORY_MEDIUM_RID.
184200
static inline bool IsHighIntegrityLevel() {
201+
// Execute this check once and save the value as a static bool.
185202
static bool isHighIntegrityLevel = ([] {
186203
HANDLE processToken;
187204
if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY | TOKEN_QUERY_SOURCE, &processToken)) {
@@ -191,9 +208,12 @@ static inline bool IsHighIntegrityLevel() {
191208
if (GetTokenInformation(processToken, TokenIntegrityLevel, mandatoryLabelBuffer, sizeof(mandatoryLabelBuffer),
192209
&bufferSize) != 0) {
193210
const auto mandatoryLabel = reinterpret_cast<const TOKEN_MANDATORY_LABEL*>(mandatoryLabelBuffer);
194-
const DWORD subAuthorityCount = *GetSidSubAuthorityCount(mandatoryLabel->Label.Sid);
195-
const DWORD integrityLevel = *GetSidSubAuthority(mandatoryLabel->Label.Sid, subAuthorityCount - 1);
196-
return integrityLevel > SECURITY_MANDATORY_MEDIUM_RID;
211+
if (mandatoryLabel->Label.Sid != 0) {
212+
const DWORD subAuthorityCount = *GetSidSubAuthorityCount(mandatoryLabel->Label.Sid);
213+
const DWORD integrityLevel = *GetSidSubAuthority(mandatoryLabel->Label.Sid, subAuthorityCount - 1);
214+
CloseHandle(processToken);
215+
return integrityLevel > SECURITY_MANDATORY_MEDIUM_RID;
216+
}
197217
}
198218

199219
CloseHandle(processToken);
@@ -205,37 +225,45 @@ static inline bool IsHighIntegrityLevel() {
205225
return isHighIntegrityLevel;
206226
}
207227

228+
// Returns true if the given environment variable exists.
229+
// The name is a case-sensitive UTF8 string.
208230
static inline bool PlatformUtilsGetEnvSet(const char* name) {
209231
const std::wstring wname = utf8_to_wide(name);
210232
const DWORD valSize = ::GetEnvironmentVariableW(wname.c_str(), nullptr, 0);
211-
// GetEnvironmentVariable returns 0 when environment variable does not exist
233+
// GetEnvironmentVariable returns 0 when environment variable does not exist or there is an error.
212234
return 0 != valSize;
213235
}
214236

237+
// Returns the environment variable value for the given name.
238+
// Returns an empty string if the environment variable doesn't exist or if it exists but is empty.
239+
// Use PlatformUtilsGetEnvSet to tell if it exists.
240+
// The name is a case-sensitive UTF8 string.
215241
static inline std::string PlatformUtilsGetEnv(const char* name) {
216242
const std::wstring wname = utf8_to_wide(name);
217243
const DWORD valSize = ::GetEnvironmentVariableW(wname.c_str(), nullptr, 0);
218-
// GetEnvironmentVariable returns 0 when environment variable does not exist
244+
// GetEnvironmentVariable returns 0 when environment variable does not exist or there is an error.
219245
if (valSize == 0) {
220246
return {};
221247
}
222248

223249
// GetEnvironmentVariable returns size including null terminator for "query size" call.
224250
std::wstring wValue(valSize, 0);
225-
wchar_t* wValueData = const_cast<wchar_t*>(wValue.data()); // mutable data() only exists in c++17
251+
wchar_t* wValueData = &wValue[0];
226252

227-
// GetEnvironmentVariable returns string length, excluding null terminator for "get value" call.
228-
const int length = ::GetEnvironmentVariableW(wname.c_str(), wValueData, (DWORD)wValue.size());
229-
if (length == 0) {
253+
// GetEnvironmentVariable returns string length, excluding null terminator for "get value"
254+
// call if there was enough capacity. Else it returns the required capacity (including null terminator).
255+
const DWORD length = ::GetEnvironmentVariableW(wname.c_str(), wValueData, (DWORD)wValue.size());
256+
if ((length == 0) || (length >= wValue.size())) { // If error or the variable increased length between calls...
230257
LogError("GetEnvironmentVariable get value error: " + std::to_string(::GetLastError()));
231258
return {};
232259
}
233260

234-
wValue.resize(length); // Strip the null terminator.
261+
wValue.resize(length); // Strip the null terminator.
235262

236263
return wide_to_utf8(wValue);
237264
}
238265

266+
// Acts the same as PlatformUtilsGetEnv except returns an empty string if IsHighIntegrityLevel.
239267
static inline std::string PlatformUtilsGetSecureEnv(const char* name) {
240268
// Do not allow high integrity processes to act on data that can be controlled by medium integrity processes.
241269
if (IsHighIntegrityLevel()) {
@@ -246,23 +274,40 @@ static inline std::string PlatformUtilsGetSecureEnv(const char* name) {
246274
return PlatformUtilsGetEnv(name);
247275
}
248276

249-
#else // Not Linux or Windows
277+
// Sets an environment variable via UTF8 strings.
278+
// The name is case-sensitive.
279+
// Overwrites the variable if it already exists.
280+
// Returns true if it could be set.
281+
static inline bool PlatformUtilsSetEnv(const char* name, const char* value) {
282+
const std::wstring wname = utf8_to_wide(name);
283+
const std::wstring wvalue = utf8_to_wide(value);
284+
BOOL result = ::SetEnvironmentVariableW(wname.c_str(), wvalue.c_str());
285+
return (result != 0);
286+
}
250287

251-
static inline std::string PlatformUtilsGetEnv(const char * /* name */) {
288+
#else // Not Linux, Apple, nor Windows
289+
290+
static inline bool PlatformUtilsGetEnvSet(const char* /* name */) {
291+
// Stub func
292+
return false;
293+
}
294+
295+
static inline std::string PlatformUtilsGetEnv(const char* /* name */) {
252296
// Stub func
253297
return {};
254298
}
255299

256-
static inline char *PlatformUtilsGetSecureEnv(const char * /* name */) {
300+
static inline std::string PlatformUtilsGetSecureEnv(const char* /* name */) {
257301
// Stub func
258302
return {};
259303
}
260304

261-
static inline void PlatformUtilsFreeEnv(char * /* val */) {
305+
static inline bool PlatformUtilsSetEnv(const char* /* name */, const char* /* value */) {
262306
// Stub func
307+
return false;
263308
}
264309

265-
static inline bool PlatformGetGlobalRuntimeFileName(uint16_t /* major_version */, std::string const & /* file_name */) {
310+
static inline bool PlatformGetGlobalRuntimeFileName(uint16_t /* major_version */, std::string const& /* file_name */) {
266311
// Stub func
267312
return false;
268313
}

src/external/jsoncpp/.clang-format

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ PenaltyExcessCharacter: 1000000
2929
PenaltyReturnTypeOnItsOwnLine: 60
3030
PointerBindsToType: true
3131
SpacesBeforeTrailingComments: 1
32-
Cpp11BracedListStyle: false
33-
Standard: Cpp03
32+
Cpp11BracedListStyle: true
33+
Standard: Cpp11
3434
IndentWidth: 2
3535
TabWidth: 8
3636
UseTab: Never

src/external/jsoncpp/.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/build/
2+
/build-*/
23
*.pyc
34
*.swp
45
*.actual
56
*.actual-rewrite
67
*.process-output
78
*.rewrite
89
/bin/
9-
/buildscons/
1010
/libs/
1111
/doc/doxyfile
1212
/dist/
@@ -31,7 +31,7 @@
3131
# CMake-generated files:
3232
CMakeFiles/
3333
*.cmake
34-
pkg-config/jsoncpp.pc
34+
/pkg-config/jsoncpp.pc
3535
jsoncpp_lib_static.dir/
3636

3737
# In case someone runs cmake in the root-dir:
@@ -50,3 +50,6 @@ jsoncpp_lib_static.dir/
5050
.project
5151
.cproject
5252
/.settings/
53+
54+
# DS_Store
55+
.DS_Store

src/external/jsoncpp/AUTHORS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ datadiode <jochen.neubeck@vodafone.de>
3737
David Seifert <soap@gentoo.org>
3838
David West <david-west@idexx.com>
3939
dawesc <chris.dawes@eftlab.co.uk>
40+
Devin Jeanpierre <jeanpierreda@google.com>
4041
Dmitry Marakasov <amdmi3@amdmi3.ru>
4142
dominicpezzuto <dom@dompezzuto.com>
4243
Don Milham <dmilham@gmail.com>
@@ -57,6 +58,7 @@ Iñaki Baz Castillo <ibc@aliax.net>
5758
Jacco <jacco@geul.net>
5859
Jean-Christophe Fillion-Robin <jchris.fillionr@kitware.com>
5960
Jonas Platte <mail@jonasplatte.de>
61+
Jordan Bayles <bayles.jordan@gmail.com>
6062
Jörg Krause <joerg.krause@embedded.rocks>
6163
Keith Lea <keith@whamcitylights.com>
6264
Kevin Grant <kbradleygrant@gmail.com>

0 commit comments

Comments
 (0)