ScopeAttachment.cpp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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 <Atom/RHI/ScopeAttachment.h>
  9. #include <Atom/RHI/SwapChainFrameAttachment.h>
  10. #include <Atom/RHI/FrameAttachment.h>
  11. namespace AZ::RHI
  12. {
  13. ScopeAttachment::ScopeAttachment(
  14. Scope& scope,
  15. FrameAttachment& attachment,
  16. ScopeAttachmentUsage usage,
  17. ScopeAttachmentAccess access,
  18. ScopeAttachmentStage stage)
  19. : m_scope{&scope}
  20. , m_attachment{&attachment}
  21. , m_usage(usage)
  22. , m_access(access)
  23. , m_stage(stage)
  24. {
  25. m_isSwapChainAttachment = azrtti_cast<const RHI::SwapChainFrameAttachment*>(m_attachment) != nullptr;
  26. }
  27. const Scope& ScopeAttachment::GetScope() const
  28. {
  29. return *m_scope;
  30. }
  31. Scope& ScopeAttachment::GetScope()
  32. {
  33. return *m_scope;
  34. }
  35. const FrameAttachment& ScopeAttachment::GetFrameAttachment() const
  36. {
  37. return *m_attachment;
  38. }
  39. FrameAttachment& ScopeAttachment::GetFrameAttachment()
  40. {
  41. return *m_attachment;
  42. }
  43. ScopeAttachmentUsage ScopeAttachment::GetUsage() const
  44. {
  45. return m_usage;
  46. }
  47. ScopeAttachmentAccess ScopeAttachment::GetAccess() const
  48. {
  49. return m_access;
  50. }
  51. ScopeAttachmentStage ScopeAttachment::GetStage() const
  52. {
  53. return m_stage;
  54. }
  55. const ScopeAttachment* ScopeAttachment::GetPrevious() const
  56. {
  57. return m_prev;
  58. }
  59. ScopeAttachment* ScopeAttachment::GetPrevious()
  60. {
  61. return m_prev;
  62. }
  63. const ScopeAttachment* ScopeAttachment::GetNext() const
  64. {
  65. return m_next;
  66. }
  67. ScopeAttachment* ScopeAttachment::GetNext()
  68. {
  69. return m_next;
  70. }
  71. const char* ScopeAttachment::GetTypeName() const
  72. {
  73. return ToString(m_usage, m_access);
  74. }
  75. const ResourceView* ScopeAttachment::GetResourceView() const
  76. {
  77. return m_resourceView.get();
  78. }
  79. void ScopeAttachment::SetResourceView(ConstPtr<ResourceView> resourceView)
  80. {
  81. m_resourceView = AZStd::move(resourceView);
  82. }
  83. bool ScopeAttachment::IsSwapChainAttachment() const
  84. {
  85. return m_isSwapChainAttachment;
  86. }
  87. }