SsaoPasses.h 2.5 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. #pragma once
  9. #include <Atom/RPI.Public/Pass/ComputePass.h>
  10. #include <Atom/RPI.Public/Pass/ParentPass.h>
  11. namespace AZ
  12. {
  13. namespace Render
  14. {
  15. // Parent pass for SSAO that contains the SSAO compute pass
  16. class SsaoParentPass final
  17. : public RPI::ParentPass
  18. {
  19. AZ_RPI_PASS(SsaoParentPass);
  20. public:
  21. AZ_RTTI(AZ::Render::SsaoParentPass, "{A03B5913-B201-4146-AF0A-999E6BF31A1A}", AZ::RPI::ParentPass);
  22. AZ_CLASS_ALLOCATOR(SsaoParentPass, SystemAllocator);
  23. virtual ~SsaoParentPass() = default;
  24. //! Creates an SsaoParentPass
  25. static RPI::Ptr<SsaoParentPass> Create(const RPI::PassDescriptor& descriptor);
  26. bool IsEnabled() const override;
  27. protected:
  28. // Behavior functions override...
  29. void InitializeInternal() override;
  30. void FrameBeginInternal(FramePrepareParams params) override;
  31. private:
  32. SsaoParentPass(const RPI::PassDescriptor& descriptor);
  33. // Direct pointers to child passes for enable/disable
  34. ParentPass* m_blurParentPass = nullptr;
  35. FastDepthAwareBlurHorPass* m_blurHorizontalPass = nullptr;
  36. FastDepthAwareBlurVerPass* m_blurVerticalPass = nullptr;
  37. Pass* m_downsamplePass = nullptr;
  38. Pass* m_upsamplePass = nullptr;
  39. };
  40. // Computer shader pass that calculates SSAO from a linear depth buffer
  41. class SsaoComputePass final
  42. : public RPI::ComputePass
  43. {
  44. AZ_RPI_PASS(SsaoComputePass);
  45. public:
  46. AZ_RTTI(AZ::Render::SsaoComputePass, "{0BA5F6F7-15D2-490A-8254-7E61F25B62F9}", AZ::RPI::ComputePass);
  47. AZ_CLASS_ALLOCATOR(SsaoComputePass, SystemAllocator);
  48. virtual ~SsaoComputePass() = default;
  49. //! Creates an SsaoComputePass
  50. static RPI::Ptr<SsaoComputePass> Create(const RPI::PassDescriptor& descriptor);
  51. protected:
  52. // Behavior functions override...
  53. void FrameBeginInternal(FramePrepareParams params) override;
  54. private:
  55. SsaoComputePass(const RPI::PassDescriptor& descriptor);
  56. // SRG binding indices...
  57. AZ::RHI::ShaderInputNameIndex m_constantsIndex = "m_constants";
  58. };
  59. } // namespace Render
  60. } // namespace AZ