Scope.cpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 (const AZ::RHI::ScopeAttachment* search = attachment.GetFirstScopeAttachment(GetDeviceIndex()); search;
  41. search = search->GetNext())
  42. {
  43. if (search == scopeAttachment)
  44. {
  45. found = true;
  46. break;
  47. }
  48. }
  49. ASSERT_TRUE(found);
  50. }
  51. }