2
0

OpenXRVkSystemComponent.cpp 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <AzCore/Serialization/SerializeContext.h>
  9. #include <OpenXRVk/OpenXRVkDevice.h>
  10. #include <OpenXRVk/OpenXRVkInput.h>
  11. #include <OpenXRVk/OpenXRVkInstance.h>
  12. #include <OpenXRVk/OpenXRVkSession.h>
  13. #include <OpenXRVk/OpenXRVkSpace.h>
  14. #include <OpenXRVk/OpenXRVkSwapChain.h>
  15. #include <OpenXRVk/OpenXRVkSystemComponent.h>
  16. namespace OpenXRVk
  17. {
  18. void SystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
  19. {
  20. provided.push_back(XR::Factory::GetPlatformService());
  21. }
  22. void SystemComponent::Reflect(AZ::ReflectContext* context)
  23. {
  24. if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
  25. {
  26. serializeContext->Class<SystemComponent, AZ::Component>()
  27. ->Version(1);
  28. }
  29. }
  30. SystemComponent::SystemComponent()
  31. {
  32. // Only have Vulkan back-end implementation for XR at the moment so register it.
  33. XR::Factory::Register(this);
  34. }
  35. SystemComponent::~SystemComponent()
  36. {
  37. XR::Factory::Unregister(this);
  38. }
  39. XR::Ptr<XR::Instance> SystemComponent::CreateInstance()
  40. {
  41. return Instance::Create();
  42. }
  43. XR::Ptr<XR::Device> SystemComponent::CreateDevice()
  44. {
  45. return Device::Create();
  46. }
  47. XR::Ptr<XR::Session> SystemComponent::CreateSession()
  48. {
  49. return Session::Create();
  50. }
  51. XR::Ptr<XR::Input> SystemComponent::CreateInput()
  52. {
  53. return Input::Create();
  54. }
  55. XR::Ptr<XR::Space> SystemComponent::CreateSpace()
  56. {
  57. return Space::Create();
  58. }
  59. XR::Ptr<XR::SwapChain> SystemComponent::CreateSwapChain()
  60. {
  61. return SwapChain::Create();
  62. }
  63. XR::Ptr<XR::SwapChain::View> SystemComponent::CreateSwapChainView()
  64. {
  65. return SwapChain::View::Create();
  66. }
  67. XR::Ptr<XR::SwapChain::Image> SystemComponent::CreateSwapChainImage()
  68. {
  69. return SwapChain::Image::Create();
  70. }
  71. void SystemComponent::Activate()
  72. {
  73. }
  74. void SystemComponent::Deactivate()
  75. {
  76. }
  77. }