TransientAttachmentPool.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. #pragma once
  9. #include <Atom/RHI/DeviceBuffer.h>
  10. #include <Atom/RHI/DeviceImage.h>
  11. #include <Atom/RHI/Factory.h>
  12. #include <Atom/RHI/DeviceTransientAttachmentPool.h>
  13. #include <AzCore/Memory/SystemAllocator.h>
  14. #include <AzCore/std/containers/unordered_map.h>
  15. #include <AzCore/std/containers/unordered_set.h>
  16. namespace UnitTest
  17. {
  18. class TransientAttachmentPool
  19. : public AZ::RHI::DeviceTransientAttachmentPool
  20. {
  21. public:
  22. AZ_CLASS_ALLOCATOR(TransientAttachmentPool, AZ::SystemAllocator);
  23. TransientAttachmentPool() = default;
  24. private:
  25. AZ::RHI::ResultCode InitInternal(AZ::RHI::Device&, const AZ::RHI::TransientAttachmentPoolDescriptor& descriptor) override;
  26. void ShutdownInternal() override;
  27. void BeginInternal(const AZ::RHI::TransientAttachmentPoolCompileFlags flags, const AZ::RHI::TransientAttachmentStatistics::MemoryUsage* memoryHint) override;
  28. AZ::RHI::DeviceImage* ActivateImage(const AZ::RHI::TransientImageDescriptor&) override;
  29. AZ::RHI::DeviceBuffer* ActivateBuffer(const AZ::RHI::TransientBufferDescriptor&) override;
  30. void DeactivateBuffer(const AZ::RHI::AttachmentId&) override;
  31. void DeactivateImage(const AZ::RHI::AttachmentId&) override;
  32. void EndInternal() override;
  33. AZ::RHI::Ptr<AZ::RHI::DeviceImagePool> m_imagePool;
  34. AZ::RHI::Ptr<AZ::RHI::DeviceBufferPool> m_bufferPool;
  35. AZStd::unordered_map<AZ::RHI::AttachmentId, AZ::RHI::Ptr<AZ::RHI::DeviceResource>> m_attachments;
  36. AZStd::unordered_set<AZ::RHI::AttachmentId> m_activeSet;
  37. };
  38. }