diff --git a/.github/workflows/ci-android.yml b/.github/workflows/ci-android.yml new file mode 100644 index 0000000..691c7d8 --- /dev/null +++ b/.github/workflows/ci-android.yml @@ -0,0 +1,31 @@ +name: CI Android +on: + push: + pull_request: +env: + CMakeVersion: 3.14.x +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + android-platform: [24, latest] + android-abi: [armeabi-v7a, arm64-v8a, x86, x86_64] + build-shared: [ON, OFF] + + steps: + - uses: actions/checkout@v2 + - name: Setup cmake + uses: jwlawson/actions-setup-cmake@v1.12 + with: + cmake-version: ${{ env.CMakeVersion }} + - name: Setup NDK + uses: nttld/setup-ndk@v1 + with: + ndk-version: r25 + - name: Build and Install VSGVR + shell: bash + run: | + cmake . -DCMAKE_TOOLCHAIN_FILE=$(dirname $(which ndk-build))/build/cmake/android.toolchain.cmake -DANDROID_ABI=${{matrix.android-abi}} -DANDROID_PLATFORM=${{matrix.android-platform}} -DBUILD_SHARED_LIBS=${{matrix.build-shared}} -DCMAKE_INSTALL_PREFIX=./install + cmake --build . --target install --config Release diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..2092306 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,35 @@ +name: CI +on: + push: + pull_request: +env: + BuildDocEnabled: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} + CMakeVersion: 3.14.x +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + vulkan-version: [1.3.224.1] + build-shared: [ON, OFF] + + steps: + - uses: actions/checkout@v2 + - name: Setup cmake + uses: jwlawson/actions-setup-cmake@v1.12 + with: + cmake-version: ${{ env.CMakeVersion }} + - name: Install Vulkan SDK + uses: humbletim/install-vulkan-sdk@v1.1.1 + with: + version: ${{ matrix.vulkan-version }} + cache: true + - name: Add MSBuild to PATH + uses: microsoft/setup-msbuild@v1.1 + if: startsWith(matrix.os, 'windows') + - name: Build and Install VSGVR + shell: bash + run: | + cmake . -DBUILD_SHARED_LIBS=${{matrix.build-shared}} -DCMAKE_INSTALL_PREFIX=./install + cmake --build . --target install --config Release diff --git a/CMakeLists.txt b/CMakeLists.txt index 425718c..4f5d309 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,9 +2,8 @@ cmake_minimum_required(VERSION 3.14) project(VSGVR) -include(FetchContent) - -option( VSGVR_BUILD_EXAMPLES "Whether to build VSGVR examples or not" ON ) +option( BUILD_SHARED_LIBS "Build shared libraries" OFF ) +option( VSGVR_BUILD_EXAMPLES "Whether to build VSGVR examples" ON ) if( NOT CMAKE_BUILD_TYPE AND NOT MSVC ) set( CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE ) @@ -12,13 +11,16 @@ if( NOT CMAKE_BUILD_TYPE AND NOT MSVC ) endif() if( NOT VSGVR_XR_PLATFORM ) + # OPENXR_GENERIC - The standard openxr_loader.so, built from deps/openxr + # OPENXR_SYSTEM - Whatever OpenXR is available via find_package + # OPENXR_OCULUS_MODULE - Oculus specific runtime from their Mobile OpenXR SDK set( VSGVR_XR_PLATFORM "OPENXR_GENERIC" CACHE STRING "The OpenXR loader / platform combination to build" ) - set_property( CACHE VSGVR_XR_PLATFORM PROPERTY STRINGS "OPENXR_GENERIC" "OPENXR_OCULUS_MOBILE" ) + set_property( CACHE VSGVR_XR_PLATFORM PROPERTY STRINGS "OPENXR_GENERIC" "OPENXR_SYSTEM" "OPENXR_OCULUS_MOBILE" ) endif() # Compiler/Tool requirements set( CMAKE_CXX_STANDARD 17 ) -set(OpenGL_GL_PREFERENCE GLVND) +set( OpenGL_GL_PREFERENCE GLVND ) # Package/System requirements if(ANDROID) @@ -29,8 +31,12 @@ endif() find_package(Vulkan REQUIRED) +set(OpenXR_LIBRARY openxr_loader) if( VSGVR_XR_PLATFORM STREQUAL "OPENXR_GENERIC" ) add_subdirectory( deps/openxr ) +elseif( VSGVR_XR_PLATFORM STREQUAL "OPENXR_SYSTEM" ) + find_package(OpenXR REQUIRED) + set(OpenXR_LIBRARY OpenXR::openxr_loader) elseif( VSGVR_XR_PLATFORM STREQUAL "OPENXR_OCULUS_MOBILE" ) if(NOT ANDROID) message(FATAL_ERROR "Oculus Mobile SDK is only supported when building for Android") @@ -50,12 +56,7 @@ endif() add_subdirectory( vsgvr ) - if( VSGVR_BUILD_EXAMPLES ) add_subdirectory( examples ) endif() -# Copy models into the build dir -configure_file(models/world/world.vsgt ${CMAKE_CURRENT_BINARY_DIR}/world.vsgt COPYONLY) -configure_file(models/controller/controller.vsgt ${CMAKE_CURRENT_BINARY_DIR}/controller.vsgt COPYONLY) -configure_file(models/controller/controller2.vsgt ${CMAKE_CURRENT_BINARY_DIR}/controller2.vsgt COPYONLY) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index ea02e5c..9d17adb 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -4,3 +4,4 @@ if(ANDROID) else() add_subdirectory( generic ) endif() + diff --git a/examples/generic/CMakeLists.txt b/examples/generic/CMakeLists.txt index 02d1904..c995891 100644 --- a/examples/generic/CMakeLists.txt +++ b/examples/generic/CMakeLists.txt @@ -1,3 +1,4 @@ add_executable( vsgvr_example_generic main.cpp ) target_link_libraries( vsgvr_example_generic vsg::vsg vsgvr ) + diff --git a/examples/generic/main.cpp b/examples/generic/main.cpp index 0de6aef..0acf13c 100644 --- a/examples/generic/main.cpp +++ b/examples/generic/main.cpp @@ -23,10 +23,41 @@ int main(int argc, char **argv) { // set up vsg::Options to pass in filepaths and ReaderWriter's and other IO // related options to use when reading and writing files. auto options = vsg::Options::create(); + options->paths = vsg::getEnvPaths("VSG_FILE_PATH"); arguments.read(options); auto vsg_scene = vsg::Group::create(); - vsg_scene->addChild(world()); + + // load the scene graph + // * Load the bulk of the scene from command line, or the built-in world model + // * Always load controllers separately from built-in models + // read any vsg files + for (int i = 1; i < argc; ++i) + { + vsg::Path filename = arguments[i]; + auto path = vsg::filePath(filename); + auto object = vsg::read(filename, options); + if (auto node = object.cast(); node) + { + vsg_scene->addChild(node); + } + else if (object) + { + std::cerr << "Unable to view object of type " << object->className() << std::endl; + return EXIT_FAILURE; + } + else + { + std::cerr << "Unable to load file " << filename << std::endl; + return EXIT_FAILURE; + } + } + + if (vsg_scene->children.size() == 0) + { + std::cerr << "Loading built-in example scene" << std::endl; + vsg_scene->addChild(world()); + } auto controllerNodeLeft = controller(); vsg_scene->addChild(controllerNodeLeft); @@ -270,7 +301,7 @@ int main(int argc, char **argv) { } catch( const vsg::Exception& e ) { - std::cout << "VSG Exception: " << e.message << std::endl; + std::cerr << "VSG Exception: " << e.message << std::endl; return EXIT_FAILURE; } } diff --git a/readme.md b/readme.md index d3e36be..c7b0930 100644 --- a/readme.md +++ b/readme.md @@ -34,16 +34,16 @@ Feature | Status -----------------------------|-------- Linux Build | Done Windows Build | Done -Android Build | Bugs in controller position/tracking, otherwise done +Android Build (Oculus) | Done +Android Build (Gneeric) | Done, untested Code quality / API | Messy, but in roughly the right structure for now OpenXR Rendering | Working, could do with a cleanup and better vsg integration at some point -OpenXR Input | Not Implemented Yet +OpenXR Input | Not Implemented (But OpenXR API directly accessible) Controller tracking | Working Controller models in scene | Working HMD tracking | Working Desktop view | Working - ## Setup If you don't have a VR headset there's a couple of options. @@ -71,9 +71,8 @@ monado-service ### Android Phone / Tablet -TODO: Once the Android build is functional, it should be possible to use most phones/tablets as an XR display. -These don't directly match how a VR setup works, but should provide basic hardware for rotation/positional tracking (ARCore). - +TODO: Currently vsgvr can be built for Android against the generic OpenXR loader - In theory this means it will work against Monado running on a phone/tablet. +This is however unverified, if you know how to install Monado on a phone, or otherwise have a functional OpenXR runtime on your phone please get in touch. ## Compilation @@ -81,8 +80,9 @@ Required: * cmake > 3.14 * vulkan sdk * VulkanSceneGraph -* The OpenXR loader - Included as a git submodule in deps/openxr -* (For model creation) vsgXchange +* The OpenXR loader - From a variety of sources + * OPENXR\_GENERIC - The generic OpenXR loader, included as a git submodule at deps/openxr + * OPENXR\_OCULUS\_MOBILE - The Oculus mobile SDK, available from https://developer.oculus.com/downloads/package/oculus-openxr-mobile-sdk/ ```sh # Ensure submodules are available @@ -99,8 +99,7 @@ make ## Models Models created in Blender -* Controller 'top' is at 0,0 (or just below) -* Controller 'up' is [0,0,-1] in blender space +* Should face 'forward' as normal Export from blender to gltf: * Include custom properties @@ -108,14 +107,13 @@ Export from blender to gltf: * +Y up Convert to vsg via `vsgconv model.glb model.vsgt` -* Ensure vsgXchange is built with assimp support (For assimp itself I used vcpkg) -* Ensure a recent build is used for correct lighting (fd35cc2 or newer)# +* Ensure vsgXchange is built with assimp support ## Development Tips - Validation layers from the OpenXR SDK ``` set XR_API_LAYER_PATH="C:/dev/OpenXR-SDK-Source/build/src/api_layers/" set XR_ENABLE_API_LAYERS=XR_APILAYER_LUNARG_core_validation ``` + diff --git a/vsgvr/CMakeLists.txt b/vsgvr/CMakeLists.txt index ce3d915..e3d5734 100644 --- a/vsgvr/CMakeLists.txt +++ b/vsgvr/CMakeLists.txt @@ -1,31 +1,29 @@ -file(GLOB HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/vsgvr/*.h ) - set( SOURCES + include/vsgvr/actions/OpenXRAction.h + include/vsgvr/actions/OpenXRActionPoseBinding.h + include/vsgvr/actions/OpenXRActionSet.h + include/vsgvr/app/OpenXRViewer.h include/vsgvr/xr/OpenXRCommon.h - include/vsgvr/xr/OpenXRInstance.h - src/vsgvr/xr/OpenXRInstance.cpp include/vsgvr/xr/OpenXREventHandler.h - src/vsgvr/xr/OpenXREventHandler.cpp - include/vsgvr/xr/OpenXRTraits.h - src/vsgvr/xr/OpenXRTraits.cpp - include/vsgvr/app/OpenXRViewer.h - src/vsgvr/app/OpenXRViewer.cpp include/vsgvr/xr/OpenXRGraphicsBindingVulkan.h - src/vsgvr/xr/OpenXRGraphicsBindingVulkan.cpp + include/vsgvr/xr/OpenXRInstance.h + include/vsgvr/xr/OpenXRProjectionMatrix.h include/vsgvr/xr/OpenXRSession.h - src/vsgvr/xr/OpenXRSession.cpp include/vsgvr/xr/OpenXRSwapchain.h - src/vsgvr/xr/OpenXRSwapchain.cpp + include/vsgvr/xr/OpenXRTraits.h include/vsgvr/xr/OpenXRViewMatrix.h - include/vsgvr/xr/OpenXRProjectionMatrix.h - include/vsgvr/actions/OpenXRAction.h src/vsgvr/actions/OpenXRAction.cpp - include/vsgvr/actions/OpenXRActionSet.h - src/vsgvr/actions/OpenXRActionSet.cpp - include/vsgvr/actions/OpenXRActionPoseBinding.h src/vsgvr/actions/OpenXRActionPoseBinding.cpp + src/vsgvr/actions/OpenXRActionSet.cpp + src/vsgvr/app/OpenXRViewer.cpp + src/vsgvr/xr/OpenXREventHandler.cpp + src/vsgvr/xr/OpenXRGraphicsBindingVulkan.cpp + src/vsgvr/xr/OpenXRInstance.cpp + src/vsgvr/xr/OpenXRSession.cpp + src/vsgvr/xr/OpenXRSwapchain.cpp + src/vsgvr/xr/OpenXRTraits.cpp ) if( ANDROID ) @@ -35,11 +33,18 @@ if( ANDROID ) ) endif() -add_library( vsgvr STATIC ${SOURCES} ${HEADERS} ) +add_library( vsgvr ${SOURCES} ${HEADERS} ) target_include_directories( vsgvr PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include ) -target_link_libraries( vsgvr PUBLIC vsg::vsg ) -target_link_libraries( vsgvr PUBLIC openxr_loader ) +target_link_libraries( vsgvr PUBLIC vsg::vsg ${OpenXR_LIBRARY} ) + +if(WIN32 AND BUILD_SHARED_LIBS) + target_compile_definitions(vsgvr PRIVATE "VSGVR_DECLSPEC=__declspec(dllexport)") + target_compile_definitions(vsgvr INTERFACE "VSGVR_DECLSPEC=__declspec(dllimport)") +else() + target_compile_definitions( vsgvr PUBLIC "VSGVR_DECLSPEC=" ) +endif() + diff --git a/vsgvr/include/vsgvr/actions/OpenXRAction.h b/vsgvr/include/vsgvr/actions/OpenXRAction.h index 4cc18f5..b27fef7 100644 --- a/vsgvr/include/vsgvr/actions/OpenXRAction.h +++ b/vsgvr/include/vsgvr/actions/OpenXRAction.h @@ -28,7 +28,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. namespace vsgvr { class OpenXRInstance; class OpenXRActionSet; - class VSG_DECLSPEC OpenXRAction : public vsg::Inherit + class VSGVR_DECLSPEC OpenXRAction : public vsg::Inherit { public: OpenXRAction(OpenXRActionSet* actionSet, XrActionType actionType, std::string name, std::string localisedName ); @@ -49,3 +49,4 @@ namespace vsgvr { XrAction _action; }; } + diff --git a/vsgvr/include/vsgvr/actions/OpenXRActionPoseBinding.h b/vsgvr/include/vsgvr/actions/OpenXRActionPoseBinding.h index 50aaac1..a5caf2b 100644 --- a/vsgvr/include/vsgvr/actions/OpenXRActionPoseBinding.h +++ b/vsgvr/include/vsgvr/actions/OpenXRActionPoseBinding.h @@ -33,7 +33,7 @@ namespace vsgvr { * An action of type XR_INPUT_ACTION_TYPE_POSE, and an associated action space * The space will only be valid while a session is running */ - class VSG_DECLSPEC OpenXRActionPoseBinding : public vsg::Inherit + class VSGVR_DECLSPEC OpenXRActionPoseBinding : public vsg::Inherit { public: OpenXRActionPoseBinding(OpenXRActionSet* actionSet, std::string name, std::string localisedName); @@ -55,3 +55,4 @@ namespace vsgvr { vsg::mat4 _transform; }; } + diff --git a/vsgvr/include/vsgvr/actions/OpenXRActionSet.h b/vsgvr/include/vsgvr/actions/OpenXRActionSet.h index b2f4556..506ed98 100644 --- a/vsgvr/include/vsgvr/actions/OpenXRActionSet.h +++ b/vsgvr/include/vsgvr/actions/OpenXRActionSet.h @@ -27,7 +27,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. namespace vsgvr { class OpenXRInstance; - class VSG_DECLSPEC OpenXRActionSet : public vsg::Inherit + class VSGVR_DECLSPEC OpenXRActionSet : public vsg::Inherit { public: OpenXRActionSet(OpenXRInstance* instance, std::string name, std::string localisedName, uint32_t priority = 0); @@ -61,3 +61,4 @@ namespace vsgvr { XrActionSet _actionSet; }; } + diff --git a/vsgvr/include/vsgvr/app/OpenXRViewer.h b/vsgvr/include/vsgvr/app/OpenXRViewer.h index 3e383a1..5242d20 100644 --- a/vsgvr/include/vsgvr/app/OpenXRViewer.h +++ b/vsgvr/include/vsgvr/app/OpenXRViewer.h @@ -51,7 +51,7 @@ namespace vsgvr { * * Any elements in vsg which require a vsg::Window cannot work with this viewer (TODO) * * While some functions are similar, this class does not directly inherit from vsg::Viewer (TODO) */ - class VSG_DECLSPEC OpenXRViewer : public vsg::Inherit + class VSGVR_DECLSPEC OpenXRViewer : public vsg::Inherit { public: /** @@ -175,3 +175,4 @@ namespace vsgvr { std::vector _layerProjectionViews; }; } + diff --git a/vsgvr/include/vsgvr/xr/OpenXRAndroidTraits.h b/vsgvr/include/vsgvr/xr/OpenXRAndroidTraits.h index 44cc907..c967660 100644 --- a/vsgvr/include/vsgvr/xr/OpenXRAndroidTraits.h +++ b/vsgvr/include/vsgvr/xr/OpenXRAndroidTraits.h @@ -26,7 +26,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include namespace vsgvr { - class VSG_DECLSPEC OpenXrAndroidTraits : public vsg::Inherit { + class VSGVR_DECLSPEC OpenXrAndroidTraits : public vsg::Inherit { public: OpenXrAndroidTraits(); @@ -36,3 +36,4 @@ namespace vsgvr { virtual ~OpenXrAndroidTraits(); }; } + diff --git a/vsgvr/include/vsgvr/xr/OpenXRCommon.h b/vsgvr/include/vsgvr/xr/OpenXRCommon.h index b1c84a2..1c680dc 100644 --- a/vsgvr/include/vsgvr/xr/OpenXRCommon.h +++ b/vsgvr/include/vsgvr/xr/OpenXRCommon.h @@ -33,3 +33,4 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # include #endif #include + diff --git a/vsgvr/include/vsgvr/xr/OpenXREventHandler.h b/vsgvr/include/vsgvr/xr/OpenXREventHandler.h index 9affbb9..933ded6 100644 --- a/vsgvr/include/vsgvr/xr/OpenXREventHandler.h +++ b/vsgvr/include/vsgvr/xr/OpenXREventHandler.h @@ -28,7 +28,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. namespace vsgvr { class OpenXRInstance; class OpenXRSession; - class VSG_DECLSPEC OpenXREventHandler : public vsg::Inherit + class VSGVR_DECLSPEC OpenXREventHandler : public vsg::Inherit { public: OpenXREventHandler(); @@ -37,3 +37,4 @@ namespace vsgvr { void pollEvents(OpenXRInstance* instance, OpenXRSession* session); }; } + diff --git a/vsgvr/include/vsgvr/xr/OpenXRGraphicsBindingVulkan.h b/vsgvr/include/vsgvr/xr/OpenXRGraphicsBindingVulkan.h index 05ea449..474678f 100644 --- a/vsgvr/include/vsgvr/xr/OpenXRGraphicsBindingVulkan.h +++ b/vsgvr/include/vsgvr/xr/OpenXRGraphicsBindingVulkan.h @@ -34,7 +34,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include namespace vsgvr { - struct VulkanRequirements + struct VSGVR_DECLSPEC VulkanRequirements { uint32_t minVersion; uint32_t maxVersion; @@ -44,12 +44,12 @@ namespace vsgvr { std::set deviceExtensions; }; - struct VulkanGraphicsRequirements + struct VSGVR_DECLSPEC VulkanGraphicsRequirements { VkPhysicalDevice* physicalDevice; }; - class VSG_DECLSPEC OpenXRGraphicsBindingVulkan : public vsg::Inherit + class VSGVR_DECLSPEC OpenXRGraphicsBindingVulkan : public vsg::Inherit { public: static VulkanRequirements getVulkanRequirements(vsg::ref_ptr xrInstance); @@ -73,3 +73,4 @@ namespace vsgvr { XrGraphicsBindingVulkanKHR _binding; }; } + diff --git a/vsgvr/include/vsgvr/xr/OpenXRInstance.h b/vsgvr/include/vsgvr/xr/OpenXRInstance.h index 1714c24..4f26fb8 100644 --- a/vsgvr/include/vsgvr/xr/OpenXRInstance.h +++ b/vsgvr/include/vsgvr/xr/OpenXRInstance.h @@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include namespace vsgvr { - class VSG_DECLSPEC OpenXRInstance : public vsg::Inherit + class VSGVR_DECLSPEC OpenXRInstance : public vsg::Inherit { public: OpenXRInstance() = delete; @@ -64,3 +64,4 @@ namespace vsgvr { XrSystemProperties _systemProperties; }; } + diff --git a/vsgvr/include/vsgvr/xr/OpenXRProjectionMatrix.h b/vsgvr/include/vsgvr/xr/OpenXRProjectionMatrix.h index 37f2397..7e670ff 100644 --- a/vsgvr/include/vsgvr/xr/OpenXRProjectionMatrix.h +++ b/vsgvr/include/vsgvr/xr/OpenXRProjectionMatrix.h @@ -32,7 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. namespace vsgvr { - class VSG_DECLSPEC OpenXRProjectionMatrix : public vsg::Inherit + class VSGVR_DECLSPEC OpenXRProjectionMatrix : public vsg::Inherit { public: OpenXRProjectionMatrix(vsg::dmat4 matrix) @@ -68,3 +68,4 @@ namespace vsgvr vsg::dmat4 mat; }; } + diff --git a/vsgvr/include/vsgvr/xr/OpenXRSession.h b/vsgvr/include/vsgvr/xr/OpenXRSession.h index fcf26d7..d03a8ca 100644 --- a/vsgvr/include/vsgvr/xr/OpenXRSession.h +++ b/vsgvr/include/vsgvr/xr/OpenXRSession.h @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include namespace vsgvr { - class VSG_DECLSPEC OpenXRSession : public vsg::Inherit + class VSGVR_DECLSPEC OpenXRSession : public vsg::Inherit { public: OpenXRSession() = delete; @@ -92,3 +92,4 @@ namespace vsgvr { std::vector _viewData; }; } + diff --git a/vsgvr/include/vsgvr/xr/OpenXRSwapchain.h b/vsgvr/include/vsgvr/xr/OpenXRSwapchain.h index b34794d..8416da6 100644 --- a/vsgvr/include/vsgvr/xr/OpenXRSwapchain.h +++ b/vsgvr/include/vsgvr/xr/OpenXRSwapchain.h @@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. namespace vsgvr { - class SwapchainImage : public vsg::Inherit + class VSGVR_DECLSPEC SwapchainImage : public vsg::Inherit { public: SwapchainImage(VkImage image, vsg::Device *device); @@ -38,7 +38,7 @@ namespace vsgvr virtual ~SwapchainImage(); }; - class VSG_DECLSPEC OpenXRSwapchain : public vsg::Inherit + class VSGVR_DECLSPEC OpenXRSwapchain : public vsg::Inherit { public: OpenXRSwapchain() = delete; @@ -70,3 +70,4 @@ namespace vsgvr vsg::ImageViews _imageViews; }; } + diff --git a/vsgvr/include/vsgvr/xr/OpenXRTraits.h b/vsgvr/include/vsgvr/xr/OpenXRTraits.h index b3c850b..2e87f3b 100644 --- a/vsgvr/include/vsgvr/xr/OpenXRTraits.h +++ b/vsgvr/include/vsgvr/xr/OpenXRTraits.h @@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include namespace vsgvr { - class VSG_DECLSPEC OpenXrTraits : public vsg::Inherit { + class VSGVR_DECLSPEC OpenXrTraits : public vsg::Inherit { public: OpenXrTraits(); std::vector xrExtensions = { @@ -59,4 +59,5 @@ namespace vsgvr { protected: virtual ~OpenXrTraits(); }; -} \ No newline at end of file +} + diff --git a/vsgvr/include/vsgvr/xr/OpenXRViewMatrix.h b/vsgvr/include/vsgvr/xr/OpenXRViewMatrix.h index 3750cb4..539e844 100644 --- a/vsgvr/include/vsgvr/xr/OpenXRViewMatrix.h +++ b/vsgvr/include/vsgvr/xr/OpenXRViewMatrix.h @@ -30,7 +30,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include namespace vsgvr { - class VSG_DECLSPEC OpenXRViewMatrix : public vsg::Inherit + class VSGVR_DECLSPEC OpenXRViewMatrix : public vsg::Inherit { public: OpenXRViewMatrix(const vsg::dmat4& m) : @@ -81,3 +81,4 @@ namespace vsgvr { vsg::dmat4 matrix; }; } + diff --git a/vsgvr/src/vsgvr/actions/OpenXRAction.cpp b/vsgvr/src/vsgvr/actions/OpenXRAction.cpp index 87fc450..26664d5 100644 --- a/vsgvr/src/vsgvr/actions/OpenXRAction.cpp +++ b/vsgvr/src/vsgvr/actions/OpenXRAction.cpp @@ -62,3 +62,4 @@ namespace vsgvr xr_check(xrDestroyAction(_action)); } } + diff --git a/vsgvr/src/vsgvr/actions/OpenXRActionPoseBinding.cpp b/vsgvr/src/vsgvr/actions/OpenXRActionPoseBinding.cpp index 895efa3..c8da445 100644 --- a/vsgvr/src/vsgvr/actions/OpenXRActionPoseBinding.cpp +++ b/vsgvr/src/vsgvr/actions/OpenXRActionPoseBinding.cpp @@ -61,8 +61,10 @@ namespace vsgvr void OpenXRActionPoseBinding::destroyActionSpace() { - xr_check(xrDestroySpace(_space)); - _space = 0; + if (_space) { + xr_check(xrDestroySpace(_space)); + _space = 0; + } } void OpenXRActionPoseBinding::setSpaceLocation(XrSpaceLocation location) @@ -102,3 +104,4 @@ namespace vsgvr } } } + diff --git a/vsgvr/src/vsgvr/actions/OpenXRActionSet.cpp b/vsgvr/src/vsgvr/actions/OpenXRActionSet.cpp index 7720c8f..6677b37 100644 --- a/vsgvr/src/vsgvr/actions/OpenXRActionSet.cpp +++ b/vsgvr/src/vsgvr/actions/OpenXRActionSet.cpp @@ -95,3 +95,4 @@ namespace vsgvr } } } + diff --git a/vsgvr/src/vsgvr/app/OpenXRViewer.cpp b/vsgvr/src/vsgvr/app/OpenXRViewer.cpp index b239e49..6b7fa04 100644 --- a/vsgvr/src/vsgvr/app/OpenXRViewer.cpp +++ b/vsgvr/src/vsgvr/app/OpenXRViewer.cpp @@ -45,7 +45,6 @@ namespace vsgvr : _instance(xrInstance) , _xrTraits(xrTraits) , _graphicsBinding(graphicsBinding) - // , updateOperations(UpdateOperations::create()) { getViewConfiguration(); createSession(); @@ -58,8 +57,6 @@ namespace vsgvr void OpenXRViewer::shutdownAll() { - // TODO: May need to wait - Can't destroy swapchain in session until idle - // vkDeviceWaitIdle(_graphicsBinding->getVkDevice()->getDevice()); if (_session) destroySession(); } @@ -95,7 +92,6 @@ namespace vsgvr syncActions(); return PollEventsResult::RunningDoRender; case XR_SESSION_STATE_STOPPING: - std::cerr << "Ending Session" << std::endl; _session->endSession(); return PollEventsResult::NotRunning; case XR_SESSION_STATE_LOSS_PENDING: @@ -665,10 +661,5 @@ namespace vsgvr destroyActionSpaces(); _session = 0; } -/* - void updateXRViewer(OpenXRViewer& viewer, const vsg::CompileResult& compileResult) - { - updateTasks(viewer.recordAndSubmitTasks, viewer.compileManager, compileResult); - } - */ } + diff --git a/vsgvr/src/vsgvr/xr/OpenXRAndroidTraits.cpp b/vsgvr/src/vsgvr/xr/OpenXRAndroidTraits.cpp index d5f1792..6423937 100644 --- a/vsgvr/src/vsgvr/xr/OpenXRAndroidTraits.cpp +++ b/vsgvr/src/vsgvr/xr/OpenXRAndroidTraits.cpp @@ -27,3 +27,4 @@ namespace vsgvr OpenXrAndroidTraits::~OpenXrAndroidTraits() {} } + diff --git a/vsgvr/src/vsgvr/xr/OpenXREventHandler.cpp b/vsgvr/src/vsgvr/xr/OpenXREventHandler.cpp index 5172465..cd01a1a 100644 --- a/vsgvr/src/vsgvr/xr/OpenXREventHandler.cpp +++ b/vsgvr/src/vsgvr/xr/OpenXREventHandler.cpp @@ -81,3 +81,4 @@ namespace vsgvr { } } } + diff --git a/vsgvr/src/vsgvr/xr/OpenXRGraphicsBindingVulkan.cpp b/vsgvr/src/vsgvr/xr/OpenXRGraphicsBindingVulkan.cpp index 3cde557..4795520 100644 --- a/vsgvr/src/vsgvr/xr/OpenXRGraphicsBindingVulkan.cpp +++ b/vsgvr/src/vsgvr/xr/OpenXRGraphicsBindingVulkan.cpp @@ -125,3 +125,4 @@ namespace vsgvr { return vkPhysicalDevice; } } + diff --git a/vsgvr/src/vsgvr/xr/OpenXRInstance.cpp b/vsgvr/src/vsgvr/xr/OpenXRInstance.cpp index d6cfc82..47cbfb1 100644 --- a/vsgvr/src/vsgvr/xr/OpenXRInstance.cpp +++ b/vsgvr/src/vsgvr/xr/OpenXRInstance.cpp @@ -194,3 +194,4 @@ namespace vsgvr } } } + diff --git a/vsgvr/src/vsgvr/xr/OpenXRMacros.cpp b/vsgvr/src/vsgvr/xr/OpenXRMacros.cpp index 7e1e30f..e86c9b1 100644 --- a/vsgvr/src/vsgvr/xr/OpenXRMacros.cpp +++ b/vsgvr/src/vsgvr/xr/OpenXRMacros.cpp @@ -55,3 +55,4 @@ namespace { else return nullptr; } } + diff --git a/vsgvr/src/vsgvr/xr/OpenXRSession.cpp b/vsgvr/src/vsgvr/xr/OpenXRSession.cpp index 8e320de..ed23c13 100644 --- a/vsgvr/src/vsgvr/xr/OpenXRSession.cpp +++ b/vsgvr/src/vsgvr/xr/OpenXRSession.cpp @@ -294,3 +294,4 @@ namespace vsgvr { _sessionState = event.state; } } + diff --git a/vsgvr/src/vsgvr/xr/OpenXRSwapchain.cpp b/vsgvr/src/vsgvr/xr/OpenXRSwapchain.cpp index 35a9433..dc51768 100644 --- a/vsgvr/src/vsgvr/xr/OpenXRSwapchain.cpp +++ b/vsgvr/src/vsgvr/xr/OpenXRSwapchain.cpp @@ -160,3 +160,4 @@ namespace vsgvr { xr_check(xrDestroySwapchain(_swapchain)); } } + diff --git a/vsgvr/src/vsgvr/xr/OpenXRTraits.cpp b/vsgvr/src/vsgvr/xr/OpenXRTraits.cpp index b83d81c..1c04f2f 100644 --- a/vsgvr/src/vsgvr/xr/OpenXRTraits.cpp +++ b/vsgvr/src/vsgvr/xr/OpenXRTraits.cpp @@ -36,3 +36,4 @@ namespace vsgvr engineVersion = XR_MAKE_VERSION(maj, min, patch); } } +