ReflectionScreenSpaceBlurChildPass.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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/FullscreenTrianglePass.h>
  10. namespace AZ
  11. {
  12. namespace Render
  13. {
  14. //! This pass takes performs a separable Gaussian blur of the input reflection image
  15. //! to the lower mip levels of that image. The blurred mips are used as roughness levels
  16. //! when applying reflection data to a surface material.
  17. class ReflectionScreenSpaceBlurChildPass
  18. : public RPI::FullscreenTrianglePass
  19. {
  20. AZ_RPI_PASS(ReflectionScreenSpaceBlurChildPass);
  21. public:
  22. AZ_RTTI(Render::ReflectionScreenSpaceBlurChildPass, "{238E4D6C-3213-4BA2-8DFE-EAC469346E77}", FullscreenTrianglePass);
  23. AZ_CLASS_ALLOCATOR(Render::ReflectionScreenSpaceBlurChildPass, SystemAllocator);
  24. //! Creates a new pass without a PassTemplate
  25. static RPI::Ptr<ReflectionScreenSpaceBlurChildPass> Create(const RPI::PassDescriptor& descriptor);
  26. enum PassType
  27. {
  28. Vertical,
  29. Horizontal
  30. };
  31. void SetType(PassType passType) { m_passType = passType; }
  32. void SetMipLevel(uint32_t mipLevel) { m_mipLevel = mipLevel; }
  33. private:
  34. explicit ReflectionScreenSpaceBlurChildPass(const RPI::PassDescriptor& descriptor);
  35. // Pass Overrides...
  36. void FrameBeginInternal(FramePrepareParams params) override;
  37. void CompileResources(const RHI::FrameGraphCompileContext& context) override;
  38. RHI::ShaderInputNameIndex m_invOutputScaleNameIndex = "m_invOutputScale";
  39. RHI::ShaderInputNameIndex m_mipLevelNameIndex = "m_mipLevel";
  40. bool m_updateSrg = false;
  41. PassType m_passType;
  42. uint32_t m_mipLevel = 0;
  43. RHI::Size m_imageSize;
  44. float m_invOutputScale = 1.0f;
  45. };
  46. } // namespace RPI
  47. } // namespace AZ