LuminanceHistogramGeneratorPass.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 <AzCore/Memory/SystemAllocator.h>
  10. #include <Atom/RHI/CommandList.h>
  11. #include <Atom/RHI/DeviceDrawItem.h>
  12. #include <Atom/RHI/ScopeProducer.h>
  13. #include <Atom/RHI.Reflect/ShaderResourceGroupLayoutDescriptor.h>
  14. #include <Atom/RPI.Public/Pass/ComputePass.h>
  15. #include <Atom/RPI.Public/Shader/Shader.h>
  16. #include <Atom/RPI.Public/Shader/ShaderResourceGroup.h>
  17. namespace AZ
  18. {
  19. namespace Render
  20. {
  21. //! This class generates a histogram of luminance values for the input color buffer.
  22. class LuminanceHistogramGeneratorPass final
  23. : public RPI::ComputePass
  24. {
  25. AZ_RPI_PASS(LuminanceHistogramGeneratorPass);
  26. public:
  27. AZ_RTTI(LuminanceHistogramGeneratorPass, "{062D0696-B159-491C-9ECC-AA02767ED4CF}", RPI::ComputePass);
  28. AZ_CLASS_ALLOCATOR(LuminanceHistogramGeneratorPass, SystemAllocator);
  29. ~LuminanceHistogramGeneratorPass() = default;
  30. static RPI::Ptr<LuminanceHistogramGeneratorPass> Create(const RPI::PassDescriptor& descriptor);
  31. void BuildCommandListInternal(const RHI::FrameGraphExecuteContext& context) override;
  32. protected:
  33. LuminanceHistogramGeneratorPass(const RPI::PassDescriptor& descriptor);
  34. virtual void BuildInternal() override;
  35. void CreateHistogramBuffer();
  36. void AttachHistogramBuffer();
  37. AZ::RHI::Size GetColorBufferResolution();
  38. Data::Instance<RPI::Buffer> m_histogram;
  39. };
  40. } // namespace Render
  41. } // namespace AZ