Query.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 <AzCore/UnitTest/TestTypes.h>
  10. #include <Atom/RHI/DeviceQuery.h>
  11. #include <Atom/RHI/DeviceQueryPool.h>
  12. #include <AzCore/Memory/SystemAllocator.h>
  13. namespace UnitTest
  14. {
  15. class Query
  16. : public AZ::RHI::DeviceQuery
  17. {
  18. public:
  19. AZ_CLASS_ALLOCATOR(Query, AZ::SystemAllocator);
  20. private:
  21. AZ::RHI::ResultCode BeginInternal(AZ::RHI::CommandList& commandList, AZ::RHI::QueryControlFlags flags) override;
  22. AZ::RHI::ResultCode EndInternal(AZ::RHI::CommandList& commandList) override;
  23. AZ::RHI::ResultCode WriteTimestampInternal(AZ::RHI::CommandList& commandList) override;
  24. };
  25. class QueryPool
  26. : public AZ::RHI::DeviceQueryPool
  27. {
  28. public:
  29. AZ_CLASS_ALLOCATOR(QueryPool, AZ::SystemAllocator);
  30. AZStd::vector<AZ::RHI::Interval> m_calledIntervals;
  31. private:
  32. AZ::RHI::ResultCode InitInternal(AZ::RHI::Device& device, const AZ::RHI::QueryPoolDescriptor& descriptor) override;
  33. AZ::RHI::ResultCode InitQueryInternal(AZ::RHI::DeviceQuery& query) override;
  34. AZ::RHI::ResultCode GetResultsInternal(uint32_t startIndex, uint32_t queryCount, uint64_t* results, uint32_t resultsCount, AZ::RHI::QueryResultFlagBits flags) override;
  35. };
  36. }