3
0

EditorStateBufferCopyPass.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 <Pass/State/EditorStateBufferCopyPass.h>
  9. #include <Pass/State/EditorStateBufferCopyPassData.h>
  10. #include <Atom/RPI.Public/Pass/PassUtils.h>
  11. namespace AZ::Render
  12. {
  13. RPI::Ptr<EditorStateBufferCopyPass> EditorStateBufferCopyPass::Create(const RPI::PassDescriptor& descriptor)
  14. {
  15. RPI::Ptr<EditorStateBufferCopyPass> pass = aznew EditorStateBufferCopyPass(descriptor);
  16. return AZStd::move(pass);
  17. }
  18. EditorStateBufferCopyPass::EditorStateBufferCopyPass(const RPI::PassDescriptor& descriptor)
  19. : AZ::RPI::FullscreenTrianglePass(descriptor)
  20. , m_passDescriptor(descriptor)
  21. {
  22. }
  23. bool EditorStateBufferCopyPass::IsEnabled() const
  24. {
  25. const RPI::EditorStateBufferCopyPassData* passData =
  26. RPI::PassUtils::GetPassData<RPI::EditorStateBufferCopyPassData>(m_passDescriptor);
  27. if (passData == nullptr)
  28. {
  29. AZ_Error(
  30. "EditorStateBufferCopyPass", false, "[EditorStateBufferCopyPassData '%s']: Trying to construct without valid EditorStateBufferCopyPassData!", GetPathName().GetCStr());
  31. return false;
  32. }
  33. return passData->editorStatePass->IsEnabled();
  34. }
  35. } // namespace AZ::Render