FrameGraph.cpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 <Tests/FrameGraph.h>
  9. namespace UnitTest
  10. {
  11. using namespace AZ;
  12. RHI::ResultCode FrameGraphCompiler::InitInternal()
  13. {
  14. return RHI::ResultCode::Success;
  15. }
  16. void FrameGraphCompiler::ShutdownInternal()
  17. {
  18. }
  19. RHI::MessageOutcome FrameGraphCompiler::CompileInternal(const RHI::FrameGraphCompileRequest& request)
  20. {
  21. (void)request;
  22. return AZ::Success();
  23. }
  24. void FrameGraphExecuteGroup::Init(const RHI::ScopeId& scopeId)
  25. {
  26. m_scopeId = scopeId;
  27. InitRequest request;
  28. request.m_scopeId = scopeId;
  29. request.m_commandListCount = 1;
  30. request.m_commandLists = &m_commandList;
  31. Base::Init(request);
  32. }
  33. const RHI::ScopeId& FrameGraphExecuteGroup::GetId() const
  34. {
  35. return m_scopeId;
  36. }
  37. RHI::ResultCode FrameGraphExecuter::InitInternal(const AZ::RHI::FrameGraphExecuterDescriptor&)
  38. {
  39. return RHI::ResultCode::Success;
  40. }
  41. void FrameGraphExecuter::ShutdownInternal()
  42. {
  43. }
  44. void FrameGraphExecuter::BeginInternal(const RHI::FrameGraph& graph)
  45. {
  46. for (const RHI::Scope* scope : graph.GetScopes())
  47. {
  48. FrameGraphExecuteGroup* group = AddGroup<FrameGraphExecuteGroup>();
  49. group->Init(scope->GetId());
  50. [[maybe_unused]] const bool wasInserted = m_scopeIds.emplace(scope->GetId()).second;
  51. AZ_Assert(wasInserted, "scope was inserted already");
  52. }
  53. }
  54. void FrameGraphExecuter::ExecuteGroupInternal(RHI::FrameGraphExecuteGroup& group)
  55. {
  56. m_scopeIds.erase(static_cast<FrameGraphExecuteGroup&>(group).GetId());
  57. }
  58. void FrameGraphExecuter::EndInternal()
  59. {
  60. AZ_Assert(m_scopeIds.empty(), "there are still scopes in the queue");
  61. }
  62. }