Scope.cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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/Scope.h>
  9. namespace UnitTest
  10. {
  11. using namespace AZ;
  12. void Scope::InitInternal()
  13. {
  14. AZ_Assert(IsInitialized() == false, "Is initialized!");
  15. }
  16. void Scope::ActivateInternal()
  17. {
  18. AZ_Assert(IsActive() == false, "Is Active");
  19. }
  20. void Scope::CompileInternal()
  21. {
  22. for (const AZ::RHI::ScopeAttachment* scopeAttachment : GetAttachments())
  23. {
  24. ValidateBinding(scopeAttachment);
  25. }
  26. }
  27. void Scope::DeactivateInternal()
  28. {
  29. AZ_Assert(IsActive(), "Is not active");
  30. }
  31. void Scope::ShutdownInternal()
  32. {
  33. AZ_Assert(IsInitialized(), "Is not initialized");
  34. }
  35. void Scope::ValidateBinding(const AZ::RHI::ScopeAttachment* scopeAttachment)
  36. {
  37. ASSERT_TRUE(&scopeAttachment->GetScope() == this);
  38. const AZ::RHI::FrameAttachment& attachment = scopeAttachment->GetFrameAttachment();
  39. bool found = false;
  40. for (
  41. const AZ::RHI::ScopeAttachment* search = attachment.GetFirstScopeAttachment();
  42. search;
  43. search = search->GetNext())
  44. {
  45. if (search == scopeAttachment)
  46. {
  47. found = true;
  48. break;
  49. }
  50. }
  51. ASSERT_TRUE(found);
  52. }
  53. }