Browse Source

prelim work, flesh out some gems

Signed-off-by: byrcolin <[email protected]>
byrcolin 3 years ago
commit
f8730c3e05
64 changed files with 1413 additions and 0 deletions
  1. 13 0
      Gems/XR/CMakeLists.txt
  2. 76 0
      Gems/XR/Code/CMakeLists.txt
  3. 13 0
      Gems/XR/Code/Include/XR/Platform/Android/XR_Android.h
  4. 9 0
      Gems/XR/Code/Include/XR/Platform/Android/XR_Platform.h
  5. 12 0
      Gems/XR/Code/Include/XR/Platform/Android/platform_private_android_files.cmake
  6. 14 0
      Gems/XR/Code/Include/XR/Platform/Linux/XR_Linux.h
  7. 10 0
      Gems/XR/Code/Include/XR/Platform/Linux/XR_Platform.h
  8. 11 0
      Gems/XR/Code/Include/XR/Platform/Linux/platform_private_linux_files.cmake
  9. 13 0
      Gems/XR/Code/Include/XR/Platform/Mac/XR_Mac.h
  10. 10 0
      Gems/XR/Code/Include/XR/Platform/Mac/XR_Platform.h
  11. 10 0
      Gems/XR/Code/Include/XR/Platform/Mac/platform_private_mac_files.cmake
  12. 9 0
      Gems/XR/Code/Include/XR/Platform/Windows/XR_Platform.h
  13. 15 0
      Gems/XR/Code/Include/XR/Platform/Windows/XR_Windows.h
  14. 12 0
      Gems/XR/Code/Include/XR/Platform/Windows/platform_private_windows_files.cmake
  15. 10 0
      Gems/XR/Code/Include/XR/Platform/iOS/XR_Platform.h
  16. 10 0
      Gems/XR/Code/Include/XR/Platform/iOS/platform_private_ios_files.cmake
  17. 43 0
      Gems/XR/Code/Include/XR/XRDevice.h
  18. 76 0
      Gems/XR/Code/Include/XR/XRFactory.h
  19. 36 0
      Gems/XR/Code/Include/XR/XRGraphicsBinding.h
  20. 50 0
      Gems/XR/Code/Include/XR/XRInput.h
  21. 39 0
      Gems/XR/Code/Include/XR/XRInstance.h
  22. 47 0
      Gems/XR/Code/Include/XR/XRPhysicalDevice.h
  23. 33 0
      Gems/XR/Code/Include/XR/XRResult.h
  24. 44 0
      Gems/XR/Code/Include/XR/XRSession.h
  25. 27 0
      Gems/XR/Code/Include/XR/XRSpace.h
  26. 68 0
      Gems/XR/Code/Include/XR/XRSwapChain.h
  27. 76 0
      Gems/XR/Code/Include/XR/XRSystemInterface.h
  28. 20 0
      Gems/XR/Code/Include/XR/XRUtils.h
  29. 9 0
      Gems/XR/Code/Source/Platform/Android/PAL_android.cmake
  30. 9 0
      Gems/XR/Code/Source/Platform/Android/XR_Traits_Android.h
  31. 10 0
      Gems/XR/Code/Source/Platform/Android/XR_Traits_Platform.h
  32. 12 0
      Gems/XR/Code/Source/Platform/Android/platform_private_android_files.cmake
  33. 8 0
      Gems/XR/Code/Source/Platform/Android/platform_private_static_android.cmake
  34. 9 0
      Gems/XR/Code/Source/Platform/Common/Unimplemented/Empty_Unimplemented.cpp
  35. 31 0
      Gems/XR/Code/Source/Platform/Common/Unimplemented/ModuleStub_Unimplemented.cpp
  36. 9 0
      Gems/XR/Code/Source/Platform/Linux/PAL_linux.cmake
  37. 9 0
      Gems/XR/Code/Source/Platform/Linux/XR_Traits_Linux.h
  38. 10 0
      Gems/XR/Code/Source/Platform/Linux/XR_Traits_Platform.h
  39. 12 0
      Gems/XR/Code/Source/Platform/Linux/platform_private_linux_files.cmake
  40. 8 0
      Gems/XR/Code/Source/Platform/Linux/platform_private_static_linux.cmake
  41. 9 0
      Gems/XR/Code/Source/Platform/Mac/PAL_mac.cmake
  42. 10 0
      Gems/XR/Code/Source/Platform/Windows/PAL_windows.cmake
  43. 10 0
      Gems/XR/Code/Source/Platform/Windows/XR_Traits_Platform.h
  44. 9 0
      Gems/XR/Code/Source/Platform/Windows/XR_Traits_Windows.h
  45. 8 0
      Gems/XR/Code/Source/Platform/Windows/platform_private_static_windows.cmake
  46. 12 0
      Gems/XR/Code/Source/Platform/Windows/platform_private_windows_files.cmake
  47. 9 0
      Gems/XR/Code/Source/Platform/iOS/PAL_ios.cmake
  48. 23 0
      Gems/XR/Code/Source/XRDevice.cpp
  49. 34 0
      Gems/XR/Code/Source/XRFactory.cpp
  50. 19 0
      Gems/XR/Code/Source/XRGraphicsBinding.cpp
  51. 24 0
      Gems/XR/Code/Source/XRInput.cpp
  52. 24 0
      Gems/XR/Code/Source/XRInstance.cpp
  53. 46 0
      Gems/XR/Code/Source/XRModule.cpp
  54. 20 0
      Gems/XR/Code/Source/XRPhysicalDevice.cpp
  55. 38 0
      Gems/XR/Code/Source/XRSession.cpp
  56. 23 0
      Gems/XR/Code/Source/XRSpace.cpp
  57. 36 0
      Gems/XR/Code/Source/XRSwapChain.cpp
  58. 24 0
      Gems/XR/Code/Source/XRSystem.cpp
  59. 20 0
      Gems/XR/Code/Source/XRUtils.cpp
  60. 32 0
      Gems/XR/Code/xr_private_common_files.cmake
  61. 11 0
      Gems/XR/Code/xr_private_common_shared_files.cmake
  62. 11 0
      Gems/XR/Code/xr_stub_module.cmake
  63. 19 0
      Gems/XR/gem.json
  64. BIN
      Gems/XR/preview.png

+ 13 - 0
Gems/XR/CMakeLists.txt

@@ -0,0 +1,13 @@
+#
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+#
+
+set(gem_path ${CMAKE_CURRENT_LIST_DIR})
+set(gem_json ${gem_path}/gem.json)
+o3de_restricted_path(${gem_json} gem_restricted_path gem_parent_relative_path)
+
+add_subdirectory(Code)

+ 76 - 0
Gems/XR/Code/CMakeLists.txt

@@ -0,0 +1,76 @@
+#
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+#
+
+o3de_pal_dir(pal_include_dir ${CMAKE_CURRENT_LIST_DIR}/Include/XR/Platform/${PAL_PLATFORM_NAME} ${gem_restricted_path} ${gem_path} ${gem_parent_relative_path})
+o3de_pal_dir(pal_source_dir ${CMAKE_CURRENT_LIST_DIR}/Source/Platform/${PAL_PLATFORM_NAME} ${gem_restricted_path} ${gem_path} ${gem_parent_relative_path})
+
+include(${pal_source_dir}/PAL_${PAL_PLATFORM_NAME_LOWERCASE}.cmake)
+
+if(PAL_TRAIT_XR_TARGETS_ALREADY_DEFINED)
+    return() # XR targets already defined in PAL_${PAL_PLATFORM_NAME_LOWERCASE}.cmake
+endif()
+
+if(NOT PAL_TRAIT_XR_SUPPORTED)
+
+    # Create stub modules. Once we support gem loading configuration, we can remove this stubbed targets
+    ly_add_target(
+        NAME XR.Private ${PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE}
+        NAMESPACE Gem
+        FILES_CMAKE
+            xr_stub_module.cmake
+        INCLUDE_DIRECTORIES
+            PRIVATE
+                Source
+        BUILD_DEPENDENCIES
+            PRIVATE
+                AZ::AzCore
+    )
+
+    return() # Do not create the rest of the targets
+
+endif()
+
+ly_add_target(
+    NAME XR.Private.Static STATIC
+    NAMESPACE Gem
+    FILES_CMAKE
+        xr_private_common_files.cmake
+        ${pal_source_dir}/platform_private_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
+        ${pal_include_dir}/platform_private_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
+    PLATFORM_INCLUDE_FILES
+        ${pal_source_dir}/platform_private_static_${PAL_PLATFORM_NAME_LOWERCASE}.cmake
+    INCLUDE_DIRECTORIES
+        PRIVATE
+            Source
+            ${pal_source_dir}
+        PUBLIC
+            Include
+            ${pal_include_dir}
+    BUILD_DEPENDENCIES
+        PUBLIC
+            AZ::AzCore
+            AZ::AzFramework
+            Gem::Atom_RPI.Public
+)
+
+ly_add_target(
+    NAME XR.Private ${PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE}
+    NAMESPACE Gem
+    FILES_CMAKE
+        xr_private_common_shared_files.cmake
+    INCLUDE_DIRECTORIES
+        PRIVATE
+            Source
+            ${pal_source_dir}
+        PUBLIC
+            Include
+    BUILD_DEPENDENCIES
+        PRIVATE
+            
+)
+

+ 13 - 0
Gems/XR/Code/Include/XR/Platform/Android/XR_Android.h

@@ -0,0 +1,13 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+#pragma once
+
+#include <AzCore/base.h>
+#include <AzCore/PlatformIncl.h>
+#include <AzCore/std/algorithm.h>
+

+ 9 - 0
Gems/XR/Code/Include/XR/Platform/Android/XR_Platform.h

@@ -0,0 +1,9 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+#pragma once
+
+#include <XR_Android.h>

+ 12 - 0
Gems/XR/Code/Include/XR/Platform/Android/platform_private_android_files.cmake

@@ -0,0 +1,12 @@
+#
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+#
+
+set(FILES
+    OpenXRVk_Platform.h
+    OpenXRVk_Android.h
+)

+ 14 - 0
Gems/XR/Code/Include/XR/Platform/Linux/XR_Linux.h

@@ -0,0 +1,14 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+#pragma once
+
+#include <AzCore/base.h>
+#include <AzCore/PlatformIncl.h>
+#include <AzCore/std/algorithm.h>
+
+

+ 10 - 0
Gems/XR/Code/Include/XR/Platform/Linux/XR_Platform.h

@@ -0,0 +1,10 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+#pragma once
+
+#include <XR_Linux.h>

+ 11 - 0
Gems/XR/Code/Include/XR/Platform/Linux/platform_private_linux_files.cmake

@@ -0,0 +1,11 @@
+#
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+#
+
+set(FILES
+    OpenXRVk_Platform.h
+)

+ 13 - 0
Gems/XR/Code/Include/XR/Platform/Mac/XR_Mac.h

@@ -0,0 +1,13 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+#pragma once
+
+#include <AzCore/base.h>
+#include <AzCore/PlatformIncl.h>
+#include <AzCore/std/algorithm.h>
+

+ 10 - 0
Gems/XR/Code/Include/XR/Platform/Mac/XR_Platform.h

@@ -0,0 +1,10 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+#pragma once
+
+#include <Atom_RHI_Vulkan_Mac.h>

+ 10 - 0
Gems/XR/Code/Include/XR/Platform/Mac/platform_private_mac_files.cmake

@@ -0,0 +1,10 @@
+#
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+#
+
+set(FILES
+)

+ 9 - 0
Gems/XR/Code/Include/XR/Platform/Windows/XR_Platform.h

@@ -0,0 +1,9 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+#pragma once
+
+#include <OpenXRVk_Windows.h>

+ 15 - 0
Gems/XR/Code/Include/XR/Platform/Windows/XR_Windows.h

@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+#pragma once
+
+#include <AzCore/base.h>
+#include <AzCore/PlatformIncl.h>
+#include <AzCore/std/algorithm.h>
+
+
+

+ 12 - 0
Gems/XR/Code/Include/XR/Platform/Windows/platform_private_windows_files.cmake

@@ -0,0 +1,12 @@
+#
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+#
+
+set(FILES
+    OpenXRVk_Platform.h
+    OpenXRVk_Windows.h
+)

+ 10 - 0
Gems/XR/Code/Include/XR/Platform/iOS/XR_Platform.h

@@ -0,0 +1,10 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+#pragma once
+
+

+ 10 - 0
Gems/XR/Code/Include/XR/Platform/iOS/platform_private_ios_files.cmake

@@ -0,0 +1,10 @@
+#
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+#
+
+set(FILES
+)

+ 43 - 0
Gems/XR/Code/Include/XR/XRDevice.h

@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#pragma once
+
+#include <Atom/RHI/Device_Platform.h>
+#include <Atom/RPI.Public/XR/XRPhysicalDevice.h>
+#include <Atom/RPI.Public/XR/XRResult.h>
+
+namespace AZ
+{
+    namespace RPI
+    {
+        namespace XR
+        {
+            // This class will be responsible for creating XR::Device instance
+            // which will then be passed to the renderer to be used as needed.
+            class Device
+            {
+            public:
+                Device() = default;
+                virtual ~Device() = default;
+
+                class Descriptor
+                {
+                public:
+                    Descriptor() = default;
+                    ~Descriptor() = default;
+
+                    PhysicalDevice* physicalDevice;
+                };
+
+                virtual ResultCode InitDeviceInternal(Device::Descriptor descriptor) = 0;
+                Device::Descriptor m_descriptor;
+            };
+        } // namespace XR
+    } // namespace RPI
+} // namespace AZ

+ 76 - 0
Gems/XR/Code/Include/XR/XRFactory.h

@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#pragma once
+
+#include <Atom/RPI.Public/XR/XRResult.h>
+#include <AzCore/std/containers/vector.h>
+#include <AzCore/std/smart_ptr/intrusive_ptr.h>
+#include <Atom/RPI.Public/XR/XRPhysicalDevice.h>
+#include <Atom/RPI.Public/XR/XRInstance.h>
+#include <Atom/RPI.Public/XR/XRDevice.h>
+#include <Atom/RPI.Public/XR/XRSession.h>
+#include <Atom/RPI.Public/XR/XRInput.h>
+#include <Atom/RPI.Public/XR/XRSwapChain.h>
+#include <Atom/RPI.Public/XR/XRGraphicsBinding.h>
+
+namespace AZ
+{
+    namespace RPI
+    {
+        namespace XR
+        {
+            //! Interface responsible for creating all the XR objects which are
+            //! internally backed by concrete objects
+            class Factory
+            {
+            public:
+                AZ_TYPE_INFO(Factory, "{A3D7271A-64FD-442C-9116-DBC32224222F}");
+
+                Factory() = default;
+                virtual ~Factory() = default;
+
+                AZ_DISABLE_COPY_MOVE(Factory);
+
+                //! Registers the global factory instance.
+                static void Register(AZ::RPI::XR::Factory* instance);
+
+                //! Unregisters the global factory instance.
+                static void Unregister(AZ::RPI::XR::Factory* instance);
+
+                //! Access the global factory instance.
+                static AZ::RPI::XR::Factory& Get();
+
+                // Create XR::Instance object
+                virtual AZStd::intrusive_ptr<AZ::RPI::XR::Instance> CreateInstance() = 0;
+
+                // Create XR::Device object
+                virtual AZStd::intrusive_ptr<AZ::RPI::XR::Device> CreateDevice() = 0;
+
+                // Return a list of XR::PhysicalDevice
+                virtual AZStd::vector<AZStd::intrusive_ptr<AZ::RPI::XR::PhysicalDevice>> EnumerateDeviceList() = 0;
+
+                // Create XR::Session object
+                virtual AZStd::intrusive_ptr<AZ::RPI::XR::Session> CreateSession() = 0;
+
+                // Create XR::Input object
+                virtual AZStd::intrusive_ptr<AZ::RPI::XR::Input> CreateInput() = 0;
+
+                // Create XR::SwapChain object
+                virtual AZStd::intrusive_ptr<AZ::RPI::XR::SwapChain> CreateSwapchain() = 0;
+
+                // Create XR::ViewSwapChain object
+                virtual AZStd::intrusive_ptr<AZ::RPI::XR::SwapChain::View> CreateViewSwapchain() = 0;
+
+                // Create RPI::XR::GraphicsBindingDescriptor that will contain
+                // renderer information needed to start a session
+                virtual AZStd::intrusive_ptr<AZ::RPI::XR::GraphicsBinding::Descriptor> CreateGraphicsBindingDescriptor() = 0;
+            };
+        } // namespace XR
+    } // namespace RPI
+} // namespace AZ

+ 36 - 0
Gems/XR/Code/Include/XR/XRGraphicsBinding.h

@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#pragma once
+
+#include <Atom/RHI/GraphicsBinding.h>
+
+namespace AZ
+{
+    namespace RPI
+    {
+        namespace XR
+        {
+            class GraphicsBinding
+                : public AZ::RHI::GraphicsBinding
+            {
+            public:
+                GraphicsBinding() = default;
+                ~GraphicsBinding() = default;
+
+                class Descriptor
+                    : public AZ::RHI::GraphicsBinding::Descriptor
+                {
+                public:
+                    Descriptor() = default;
+                    ~Descriptor() = default;
+                };
+            };
+        } // namespace XR
+    } // namespace RPI
+} // namespace AZ

+ 50 - 0
Gems/XR/Code/Include/XR/XRInput.h

@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#pragma once
+
+#include <Atom/RPI.Public/XR/XRResult.h>
+#include <AzCore/std/smart_ptr/intrusive_ptr.h>
+#include <Atom/RPI.Public/XR/XRSession.h>
+
+namespace AZ
+{
+    namespace RPI
+    {
+        namespace XR
+        {
+            // This class will be responsible for creating XR::Input
+            // which manage event queue or poll actions
+            class Input
+            {
+            public:
+                Input() = default;
+                virtual ~Input() = default;
+
+                class Descriptor
+                {
+                public:
+                    Descriptor() = default;
+                    ~Descriptor() = default;
+
+                    Session* m_session;
+                };
+
+                ResultCode Init(Input::Descriptor descriptor);
+
+                virtual void InitializeActions() = 0;
+                virtual void PollActions() = 0;
+                virtual void PollEvents() = 0;
+                virtual ResultCode InitInternal() = 0;
+
+            private:
+                AZStd::intrusive_ptr<Session> m_session;
+            };
+        } // namespace XR
+    } // namespace RPI
+} // namespace AZ

+ 39 - 0
Gems/XR/Code/Include/XR/XRInstance.h

@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#pragma once
+
+#include <Atom/RPI.Public/XR/XRResult.h>
+#include <Atom/RPI.Public/XR/XRPhysicalDevice.h>
+
+namespace AZ
+{
+    namespace RPI
+    {
+        namespace XR
+        {
+            // XR::Instance class. It will be responsible for collecting all the data like
+            // form factor, physical device etc that will be needed to initialize an instance
+            class Instance
+            {
+            public:
+                Instance() = default;
+                virtual ~Instance() = default;
+
+                class Descriptor
+                {
+                public:
+                    // Form Factor enum
+                    PhysicalDevice* physicalDevice;
+                };
+
+                virtual ResultCode InitInstanceInternal() = 0;
+            };
+        } // namespace XR
+    } // namespace RPI
+} // namespace AZ

+ 47 - 0
Gems/XR/Code/Include/XR/XRPhysicalDevice.h

@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#pragma once
+
+#include <Atom/RHI/PhysicalDevice.h>
+#include <Atom/RHI.Reflect/PhysicalDeviceDescriptor.h>
+
+namespace AZ
+{
+    namespace RPI
+    {
+        namespace XR
+        {
+            class PhysicalDeviceDescriptor
+                : public AZ::RHI::PhysicalDeviceDescriptor
+            {
+            public:
+                AZ_RTTI(PhysicalDeviceDescriptor, "{4E11244B-FDED-4CD6-89D7-DC3B4A1C33A8}", AZ::RHI::PhysicalDeviceDescriptor);
+
+                PhysicalDeviceDescriptor() = default;
+                virtual ~PhysicalDeviceDescriptor() = default;
+
+                // Other data related to xr device
+            };
+
+            // This class will be responsible for iterating over all the compatible physical
+            // devices and picking one that will be used for the app
+            class PhysicalDevice
+                : public AZ::RHI::PhysicalDevice
+            {
+            public:
+                AZ_RTTI(PhysicalDevice, "{E7B78CC5-53A9-492E-AA1C-8815FB882E0A}", AZ::RHI::PhysicalDevice);
+
+                PhysicalDevice() = default;
+                virtual ~PhysicalDevice() = default;
+
+                PhysicalDeviceDescriptor m_descriptor;
+            };
+        } // namespace XR
+    } // namespace RPI
+} // namespace AZ

+ 33 - 0
Gems/XR/Code/Include/XR/XRResult.h

@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#pragma once
+
+namespace AZ
+{
+    namespace RPI
+    {
+        namespace XR
+        {
+            enum class ResultCode : int
+            {
+                // The operation succeeded.
+                Success = 0,
+
+                // The operation failed with an unknown error.
+                Fail,
+
+                // The operation failed because the feature is unimplemented on the particular platform.
+                Unimplemented,
+
+                // The operation failed due to invalid arguments.
+                InvalidArgument
+            };
+        }
+    } // namespace RPI
+} // namespace AZ

+ 44 - 0
Gems/XR/Code/Include/XR/XRSession.h

@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#pragma once
+
+#include <Atom/RPI.Public/XR/XRResult.h>
+#include <Atom/RPI.Public/XR/XRGraphicsBinding.h>
+
+namespace AZ
+{
+    namespace RPI
+    {
+        namespace XR
+        {
+            // This class will be responsible for creating XR::Session and
+            // all the code around managing the session state
+            class Session
+            {
+            public:
+                class Descriptor
+                {
+                public:
+                    // Graphics Binding will contain renderer related data to start a xr session
+                    GraphicsBinding* m_graphicsBinding;
+                };
+
+                ResultCode Init(Session::Descriptor sessionDesc);
+                bool IsSessionRunning() const;
+                bool IsSessionFocused() const;
+                virtual ResultCode InitSessionInternal(Session::Descriptor descriptor);
+
+            private:
+                Session::Descriptor m_descriptor;
+                bool m_sessionRunning = false;
+                bool m_sessionFocused = false;
+            };
+        } // namespace XR
+    } // namespace RPI
+} // namespace AZ

+ 27 - 0
Gems/XR/Code/Include/XR/XRSpace.h

@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#pragma once
+
+#include <Atom/RPI.Public/XR/XRResult.h>
+
+namespace AZ
+{
+    namespace RPI
+    {
+        namespace XR
+        {
+            // This class will be responsible for managing XR Space
+            class Space
+            {
+            public:
+                virtual ResultCode InitInternal() = 0;
+            };
+        } // namespace XR
+    } // namespace RPI
+} // namespace AZ

+ 68 - 0
Gems/XR/Code/Include/XR/XRSwapChain.h

@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#pragma once
+
+#include <Atom/RPI.Public/XR/XRResult.h>
+#include <AzCore/std/containers/vector.h>
+#include <AzCore/std/smart_ptr/intrusive_ptr.h>
+
+namespace AZ
+{
+    namespace RPI
+    {
+        namespace XR
+        {
+            // This class will be responsible for creating multiple XR::SwapChain::ViewSwapchains
+            // (one per view). Each XR::SwapChain::ViewSwapchain will then be responsible
+            // for manging and synchronizing multiple swap chain images
+            class SwapChain
+            {
+            public:
+                virtual ~SwapChain() = default;
+
+                class Image
+                {
+                public:
+                    class Descriptor
+                    {
+                    public:
+                        uint16_t m_width;
+                        uint16_t m_height;
+                        uint16_t m_arraySize;
+                    };
+                    AZStd::intrusive_ptr<Descriptor> m_descriptor;
+                };
+
+                class View
+                {
+                public:
+                    //! All the images associated with this ViewSwapChain
+                    AZStd::vector<AZStd::intrusive_ptr<SwapChain::Image>> m_images;
+
+                    //! The current image index.
+                    uint32_t m_currentImageIndex = 0;
+                };
+
+                //! Returns the view swap chain related to the index
+                SwapChain::View* GetView(const uint32_t swapChainIndex) const;
+
+                //! Returns the image associated with the provided image
+                //! index and view swap chain index
+                SwapChain::Image* GetImage(uint32_t imageIndex, uint32_t swapChainIndex) const;
+
+                ResultCode Init();
+
+                virtual ResultCode InitInternal();
+
+            private:
+                AZStd::vector<AZStd::intrusive_ptr<SwapChain::View>> m_viewSwapchains;
+            };
+        } // namespace XR
+    } // namespace RPI
+} // namespace AZ

+ 76 - 0
Gems/XR/Code/Include/XR/XRSystemInterface.h

@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#pragma once
+
+#include <Atom/RPI.Public/XR/XRResult.h>
+#include <Atom/RPI.Public/XR/XRDevice.h>
+#include <Atom/RPI.Public/XR/XRInstance.h>
+#include <Atom/RPI.Public/XR/XRSwapChain.h>
+#include <Atom/RPI.Public/XR/XRGraphicsBinding.h>
+
+namespace AZ
+{
+    namespace RPI
+    {
+        namespace XR
+        {
+            class SystemInterface
+            {
+            public:
+                AZ_RTTI(SystemInterface, "{0B08E0D2-FB6C-4290-89BB-556F36CCF50A}");
+
+                AZ_DISABLE_COPY_MOVE(SystemInterface);
+
+                static SystemInterface* Get();
+
+                SystemInterface() = default;
+                virtual ~SystemInterface() = default;
+
+                // Creates the XR::Instance which is responsible for managing
+                // XrInstance (amongst other things) for OpenXR backend
+                // Also initializes the XR::Device
+                virtual ResultCode InitializeSystem() = 0;
+
+                // Create a Session and other basic session-level initialization.
+                virtual ResultCode InitializeSession(AZStd::intrusive_ptr<XR::GraphicsBinding> graphicsBinding) = 0;
+
+                // Start of the frame related XR work
+                virtual void BeginFrame() = 0;
+
+                // End of the frame related XR work
+                virtual void EndFrame() = 0;
+
+                // Start of the XR view related work
+                virtual void BeginView() = 0;
+
+                // End of the XR view related work
+                virtual void EndView() = 0;
+
+                // Manage session lifecycle to track if RenderFrame should be called.
+                virtual bool IsSessionRunning() const = 0;
+
+                // Create a swap chain which will responsible for managing
+                // multiple XR swap chains and multiple swap chain images within it
+                virtual void CreateSwapchain() = 0;
+
+                // This will allow XR gem to provide device related data to RHI
+                virtual Device::Descriptor* GetDeviceDescriptor() = 0;
+
+                // Provide access to instance specific data to RHI
+                virtual Instance::Descriptor* GetInstanceDescriptor() = 0;
+
+                // Provide swap chain specific data to RHI
+                virtual SwapChain::Image::Descriptor* GetSwapChainImageDescriptor(uint32_t swapchainIndex) = 0;
+
+                // Provide access to Graphics Binding specific data that RHI can populate
+                virtual XR::GraphicsBinding::Descriptor* GetGraphicsBindingDescriptor() = 0;
+            };
+        } // namespace XR
+    } // namespace RPI
+} // namespace AZ

+ 20 - 0
Gems/XR/Code/Include/XR/XRUtils.h

@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#pragma once
+
+namespace AZ
+{
+    namespace RPI
+    {
+        namespace XR
+        {
+
+        }
+    }
+}

+ 9 - 0
Gems/XR/Code/Source/Platform/Android/PAL_android.cmake

@@ -0,0 +1,9 @@
+#
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+#
+
+set(PAL_TRAIT_XR_SUPPORTED TRUE)

+ 9 - 0
Gems/XR/Code/Source/Platform/Android/XR_Traits_Android.h

@@ -0,0 +1,9 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+#pragma once
+

+ 10 - 0
Gems/XR/Code/Source/Platform/Android/XR_Traits_Platform.h

@@ -0,0 +1,10 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+#pragma once
+
+#include <OpenXRVk_Traits_Android.h>

+ 12 - 0
Gems/XR/Code/Source/Platform/Android/platform_private_android_files.cmake

@@ -0,0 +1,12 @@
+#
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+#
+
+set(FILES
+    XR_Traits_Android.h
+    XR_Traits_Platform.h
+)

+ 8 - 0
Gems/XR/Code/Source/Platform/Android/platform_private_static_android.cmake

@@ -0,0 +1,8 @@
+#
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+#
+

+ 9 - 0
Gems/XR/Code/Source/Platform/Common/Unimplemented/Empty_Unimplemented.cpp

@@ -0,0 +1,9 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+// This is an intentionally empty file used to compile on platforms that cannot support artifacts without at least one source file

+ 31 - 0
Gems/XR/Code/Source/Platform/Common/Unimplemented/ModuleStub_Unimplemented.cpp

@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+#include <AzCore/Module/Module.h>
+
+namespace AZ
+{
+    namespace XR
+    {
+        class Module
+            : public AZ::Module
+        {
+        public:
+            AZ_RTTI(Module, "{3A378AD3-B176-43F4-A49B-9D9FE053243A}", AZ::Module);
+
+            Module() = default;
+            ~Module() override = default;
+
+            AZ::ComponentTypeList GetRequiredSystemComponents() const override
+            {
+                return AZ::ComponentTypeList();
+            }
+        };
+    }
+}
+
+AZ_DECLARE_MODULE_CLASS(Gem_XR_Private, AZ::XR::Module)

+ 9 - 0
Gems/XR/Code/Source/Platform/Linux/PAL_linux.cmake

@@ -0,0 +1,9 @@
+#
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+#
+
+set(PAL_TRAIT_XR_SUPPORTED TRUE)

+ 9 - 0
Gems/XR/Code/Source/Platform/Linux/XR_Traits_Linux.h

@@ -0,0 +1,9 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+#pragma once
+

+ 10 - 0
Gems/XR/Code/Source/Platform/Linux/XR_Traits_Platform.h

@@ -0,0 +1,10 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+#pragma once
+
+#include <XR_Traits_Linux.h>

+ 12 - 0
Gems/XR/Code/Source/Platform/Linux/platform_private_linux_files.cmake

@@ -0,0 +1,12 @@
+#
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+#
+
+set(FILES
+    XR_Traits_Linux.h
+    XR_Traits_Platform.h
+)

+ 8 - 0
Gems/XR/Code/Source/Platform/Linux/platform_private_static_linux.cmake

@@ -0,0 +1,8 @@
+#
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+#
+

+ 9 - 0
Gems/XR/Code/Source/Platform/Mac/PAL_mac.cmake

@@ -0,0 +1,9 @@
+#
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+#
+
+set(PAL_TRAIT_XR_SUPPORTED FALSE)

+ 10 - 0
Gems/XR/Code/Source/Platform/Windows/PAL_windows.cmake

@@ -0,0 +1,10 @@
+#
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+#
+
+set(PAL_TRAIT_XR_SUPPORTED TRUE)
+

+ 10 - 0
Gems/XR/Code/Source/Platform/Windows/XR_Traits_Platform.h

@@ -0,0 +1,10 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+#pragma once
+
+#include <XR_Traits_Windows.h>

+ 9 - 0
Gems/XR/Code/Source/Platform/Windows/XR_Traits_Windows.h

@@ -0,0 +1,9 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+#pragma once
+

+ 8 - 0
Gems/XR/Code/Source/Platform/Windows/platform_private_static_windows.cmake

@@ -0,0 +1,8 @@
+#
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+#
+

+ 12 - 0
Gems/XR/Code/Source/Platform/Windows/platform_private_windows_files.cmake

@@ -0,0 +1,12 @@
+#
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+#
+
+set(FILES
+    XR_Traits_Windows.h
+    XR_Traits_Platform.h
+)

+ 9 - 0
Gems/XR/Code/Source/Platform/iOS/PAL_ios.cmake

@@ -0,0 +1,9 @@
+#
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+#
+
+set(PAL_TRAIT_XR_SUPPORTED FALSE)

+ 23 - 0
Gems/XR/Code/Source/XRDevice.cpp

@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#include <Atom/RPI.Public/XR/XRDevice.h>
+
+namespace AZ
+{
+    namespace RPI
+    {
+        namespace XR
+        {
+            ResultCode Device::InitDeviceInternal(Device::Descriptor /* descriptor */)
+            {
+                return ResultCode::Success;
+            }
+        } // namespace XR
+    } // namespace RPI
+} // namespace AZ

+ 34 - 0
Gems/XR/Code/Source/XRFactory.cpp

@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#include <Atom/RPI.Public/XR/XRFactory.h>
+
+namespace AZ
+{
+    namespace RPI
+    {
+        namespace XR
+        {
+            //! Registers the global factory instance.
+            void Factory::Register(Factory* /*instance*/)
+            {
+            }
+
+            //! Unregisters the global factory instance.
+            void Factory::Unregister(Factory* /*instance*/)
+            {
+            }
+
+            //! Access the global factory instance.
+            Factory& Factory::Get()
+            {
+                return;
+            }
+        } // namespace XR
+    } // namespace RPI
+} // namespace AZ

+ 19 - 0
Gems/XR/Code/Source/XRGraphicsBinding.cpp

@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#include <Atom/RPI.Public/XR/XRGraphicsBinding.h>
+
+namespace AZ
+{
+    namespace RPI
+    {
+        namespace XR
+        {
+        } // namespace XR
+    } // namespace RPI
+} // namespace AZ

+ 24 - 0
Gems/XR/Code/Source/XRInput.cpp

@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#include <Atom/RPI.Public/XR/XRInput.h>
+
+namespace AZ
+{
+    namespace RPI
+    {
+        namespace XR
+        {
+            ResultCode Input::Init(Input::Descriptor descriptor)
+            {
+                m_session = descriptor.m_session;
+                return InitInternal();
+            }
+        } // namespace XR
+    } // namespace RPI
+} // namespace AZ

+ 24 - 0
Gems/XR/Code/Source/XRInstance.cpp

@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#include <Atom/RPI.Public/XR/XRInstance.h>
+
+namespace AZ
+{
+    namespace RPI
+    {
+        namespace XR
+        {
+            ResultCode Instance::InitInstanceInternal()
+            {
+                return ResultCode::Success;
+            }
+        } // namespace XR
+    } // namespace RPI
+} // namespace AZ
+

+ 46 - 0
Gems/XR/Code/Source/XRModule.cpp

@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#include <AzCore/Module/Module.h>
+
+namespace AZ
+{
+    namespace XR
+    {
+        class Module
+            : public AZ::Module
+        {
+        public:
+            AZ_RTTI(Module, "{71A99524-7D31-42D3-955E-3F4774F310AC}", AZ::Module);
+
+            Module()
+            {
+                m_descriptors.insert(m_descriptors.end(), {
+                    ReflectSystemComponent::CreateDescriptor(),
+                    FactoryManagerSystemComponent::CreateDescriptor(),
+                    FactoryRegistrationFinalizerSystemComponent::CreateDescriptor()
+                });
+            }
+            ~Module() override = default;
+
+            AZ::ComponentTypeList GetRequiredSystemComponents() const override
+            {
+                return AZ::ComponentTypeList
+                {
+                    azrtti_typeid<FactoryManagerSystemComponent>(),
+                    azrtti_typeid<FactoryRegistrationFinalizerSystemComponent>()
+                };
+            }
+        };
+    }
+}
+
+// DO NOT MODIFY THIS LINE UNLESS YOU RENAME THE GEM
+// The first parameter should be GemName_GemIdLower
+// The second should be the fully qualified name of the class above
+AZ_DECLARE_MODULE_CLASS(XR_Private, AZ::XR::Module)

+ 20 - 0
Gems/XR/Code/Source/XRPhysicalDevice.cpp

@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#include <Atom/RPI.Public/XR/XRPhysicalDevice.h>
+
+namespace AZ
+{
+    namespace RPI
+    {
+        namespace XR
+        {
+
+        } // namespace XR
+    } // namespace RPI
+} // namespace AZ

+ 38 - 0
Gems/XR/Code/Source/XRSession.cpp

@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#include <Atom/RPI.Public/XR/XRSession.h>
+
+namespace AZ
+{
+    namespace RPI
+    {
+        namespace XR
+        {
+            ResultCode Session::Init(Session::Descriptor sessionDesc)
+            {
+                return InitSessionInternal(sessionDesc);
+            }
+
+            bool Session::IsSessionRunning() const
+            {
+                return m_sessionRunning;
+            }
+
+            bool Session::IsSessionFocused() const
+            {
+                return m_sessionFocused;
+            }
+
+            ResultCode Session::InitSessionInternal(Session::Descriptor descriptor)
+            {
+                return ResultCode::Success;
+            }
+        } // namespace XR
+    } // namespace RPI
+} // namespace AZ

+ 23 - 0
Gems/XR/Code/Source/XRSpace.cpp

@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#include <Atom/RPI.Public/XR/XRSpace.h>
+
+namespace AZ
+{
+    namespace RPI
+    {
+        namespace XR
+        {
+            ResultCode Space::InitInternal()
+            {
+                return ResultCode::Success;
+            }
+        } // namespace XR
+    } // namespace RPI
+} // namespace AZ

+ 36 - 0
Gems/XR/Code/Source/XRSwapChain.cpp

@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#include <Atom/RPI.Public/XR/XRSwapChain.h>
+
+namespace AZ
+{
+    namespace RPI
+    {
+        namespace XR
+        {
+            //! Returns the view swap chain related to the index
+            SwapChain::View* SwapChain::GetView(const uint32_t swapchainIndex) const
+            {
+                return m_viewSwapchains[swapchainIndex].get();
+            }
+
+            //! Returns the image associated with the provided image
+            //! index and view swap chain index
+            SwapChain::Image* SwapChain::GetImage(uint32_t imageIndex, uint32_t swapchainIndex) const
+            {
+                return GetView(swapchainIndex)->m_images[imageIndex].get();
+            }
+
+            ResultCode SwapChain::Init()
+            {
+                return InitInternal();
+            }
+        } // namespace XR
+    } // namespace RPI
+} // namespace AZ

+ 24 - 0
Gems/XR/Code/Source/XRSystem.cpp

@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#include <Atom/RPI.Public/XR/XRSystemInterface.h>
+#include <AZCore/Interface/Interface.h>
+
+namespace AZ
+{
+    namespace RPI
+    {
+        namespace XR
+        {
+            SystemInterface* SystemInterface::Get()
+            {
+                return Interface<SystemInterface>::Get();
+            }
+        } // namespace XR
+    } // namespace RPI
+} // namespace AZ

+ 20 - 0
Gems/XR/Code/Source/XRUtils.cpp

@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) Contributors to the Open 3D Engine Project.
+ * For complete copyright and license terms please see the LICENSE at the root of this distribution.
+ *
+ * SPDX-License-Identifier: Apache-2.0 OR MIT
+ *
+ */
+
+#include <Atom/RPI.Public/XR/XRUtils.h>
+
+namespace AZ
+{
+    namespace RPI
+    {
+        namespace XR
+        {
+
+        }
+    }
+}

+ 32 - 0
Gems/XR/Code/xr_private_common_files.cmake

@@ -0,0 +1,32 @@
+#
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+#
+
+set(FILES
+    Include/XR/XRDevice.h
+    Include/XR/XRFactory.h
+    Include/XR/XRGraphicsBinding.h
+    Include/XRVk/XRInput.h
+    Include/XRVk/XRInstance.h
+    Include/XRVk/XRPhysicalDevice.h
+    Include/XRVk/XRSession.h
+    Include/XRVk/XRSpace.h
+    Include/XRVk/XRSwapChain.h
+    Include/XRVk/XRSystem.h
+    Include/XRVk/XRUtils.h
+    Source/XRVkDevice.cpp
+    Source/XRVkFactory.cpp
+    Source/XRVkGraphicsBinding.cpp
+    Source/XRVkInput.cpp
+    Source/XRVkInstance.cpp
+    Source/XRVkPhysicalDevice.cpp
+    Source/XRVkSession.cpp
+    Source/XRVkSpace.cpp
+    Source/XRVkSwapChain.cpp
+    Source/XRVkSystem.cpp
+    Source/XRVkUtils.cpp
+)

+ 11 - 0
Gems/XR/Code/xr_private_common_shared_files.cmake

@@ -0,0 +1,11 @@
+#
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+#
+
+set(FILES
+    Source/XRModule.cpp
+)

+ 11 - 0
Gems/XR/Code/xr_stub_module.cmake

@@ -0,0 +1,11 @@
+#
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+#
+
+set(FILES
+    Source/Platform/Common/Unimplemented/ModuleStub_Unimplemented.cpp
+)

+ 19 - 0
Gems/XR/gem.json

@@ -0,0 +1,19 @@
+{
+    "gem_name": "XR",
+    "display_name": "XR",
+    "license": "Apache-2.0 Or MIT",
+    "license_url": "https://github.com/o3de/o3de/blob/development/LICENSE.txt",
+    "origin": "Open 3D Engine - o3de.org",
+    "origin_url": "https://github.com/o3de/o3de",
+    "type": "Code",
+    "summary": "XR",
+    "canonical_tags": [
+        "Gem"
+    ],
+    "user_tags": [],
+    "requirements": "",
+    "documentation_url": "",
+    "dependencies": [
+        "Atom_RPI"
+    ]
+}

BIN
Gems/XR/preview.png