XRSwapChain.cpp 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 <XR/XRSwapChain.h>
  9. namespace XR
  10. {
  11. SwapChain::View* SwapChain::GetView(const AZ::u32 swapchainIndex) const
  12. {
  13. return m_viewSwapchains[swapchainIndex].get();
  14. }
  15. SwapChain::Image* SwapChain::GetImage(AZ::u32 imageIndex, AZ::u32 swapchainIndex) const
  16. {
  17. return GetView(swapchainIndex)->m_images[imageIndex].get();
  18. }
  19. AZ::RHI::ResultCode SwapChain::Init(const Descriptor& descriptor)
  20. {
  21. m_descriptor = descriptor;
  22. return InitInternal();
  23. }
  24. const SwapChain::Descriptor& SwapChain::GetDescriptor() const
  25. {
  26. return m_descriptor;
  27. }
  28. AZ::u32 SwapChain::GetNumViews() const
  29. {
  30. return m_numViews;
  31. }
  32. void SwapChain::Shutdown()
  33. {
  34. ShutdownInternal();
  35. m_viewSwapchains.clear();
  36. }
  37. } // namespace XR