st/oxr: Improve extension support header.

This commit is contained in:
Ryan Pavlik 2019-12-03 11:53:31 -06:00 committed by Jakob Bornecrantz
parent f25b5d7f8d
commit 51c3240c23
2 changed files with 14 additions and 6 deletions

View file

@ -23,8 +23,8 @@ ROOT = Path(__file__).resolve().parent.parent
FN = ROOT / 'src' / 'xrt'/'state_trackers' / 'oxr' / 'oxr_extension_support.h'
INVOCATION_PREFIX = 'OXR_EXTENSION_SUPPORT'
END_OF_PER_EXTENSION = '// end of per-extension defines - do not modify this comment - used by scripts'
BEGIN_OF_PER_EXTENSION = '// beginning of GENERATED defines - do not modify - used by scripts'
END_OF_PER_EXTENSION = '// end of GENERATED per-extension defines - do not modify - used by scripts'
CLANG_FORMAT_OFF = '// clang-format off'
CLANG_FORMAT_ON = '// clang-format on'
@ -73,7 +73,7 @@ def generate_second_chunk():
if __name__ == "__main__":
with open(str(FN), 'r', encoding='utf-8') as fp:
orig = [line.rstrip() for line in fp.readlines()]
beginning = orig[:orig.index('#pragma once')+1]
beginning = orig[:orig.index(BEGIN_OF_PER_EXTENSION)+1]
middle_start = orig.index(END_OF_PER_EXTENSION)
middle_end = orig.index(CLANG_FORMAT_OFF)
middle = orig[middle_start:middle_end]

View file

@ -5,14 +5,19 @@
* @brief Macros for generating extension-related tables and code and
* inspecting Monado's extension support.
*
* Add an extension here first to support it. To correctly update this easily,
* edit and run generate_oxr_ext_support.py, then run clang-format on this file.
* MOSTLY GENERATED CODE - see below!
*
* To add support for a new extension, edit and run generate_oxr_ext_support.py,
* then run clang-format on this file. Two entire chunks of this file get
* replaced by that script: comments indicate where they are.
*
* @author Ryan Pavlik <ryan.pavlik@collabora.com>
*/
#pragma once
// beginning of GENERATED defines - do not modify - used by scripts
/*
* XR_EXT_debug_utils
*/
@ -95,7 +100,7 @@
#define OXR_EXTENSION_SUPPORT_MND_headless(_)
#endif
// end of per-extension defines - do not modify this comment - used by scripts
// end of GENERATED per-extension defines - do not modify - used by scripts
/*!
* Call this, passing a macro taking two parameters, to
@ -113,6 +118,9 @@
* Implementation note: This macro calls another macro for each extension: that
* macro is either defined to call your provided macro, or defined to nothing,
* depending on if the extension is supported in this build.
*
* @note Do not edit anything between `clang-format off` and `clang-format on` -
* it will be replaced next time this file is generated!
*/
// clang-format off
#define OXR_EXTENSION_SUPPORT_GENERATE(_) \