DepthOfFieldWriteFocusDepthFromGpuPass.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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/RPI.Public/Pass/ComputePass.h>
  11. #include <Atom/RPI.Public/Buffer/Buffer.h>
  12. namespace AZ
  13. {
  14. namespace Render
  15. {
  16. //! This pass is used to write the depth value of the specified screen coordinates to the buffer.
  17. class DepthOfFieldWriteFocusDepthFromGpuPass final
  18. : public RPI::ComputePass
  19. {
  20. AZ_RPI_PASS(DepthOfFieldWriteFocusDepthFromGpuPass);
  21. public:
  22. AZ_RTTI(DepthOfFieldWriteFocusDepthFromGpuPass, "{60DF04D2-A9FE-4B21-8050-96AFFC46BB87}", RPI::ComputePass);
  23. AZ_CLASS_ALLOCATOR(DepthOfFieldWriteFocusDepthFromGpuPass, SystemAllocator);
  24. /// Creates a DepthOfFieldWriteFocusDepthFromGpuPass
  25. static RPI::Ptr<DepthOfFieldWriteFocusDepthFromGpuPass> Create(const RPI::PassDescriptor& descriptor);
  26. // Set pass parameter interfaces...
  27. void SetScreenPosition(const AZ::Vector2& screenPosition);
  28. void SetBufferRef(RPI::Ptr<RPI::Buffer> bufferRef);
  29. private:
  30. DepthOfFieldWriteFocusDepthFromGpuPass(const RPI::PassDescriptor& descriptor);
  31. // SRG binding indices...
  32. RHI::ShaderInputNameIndex m_autoFocusDataBufferIndex = "m_outputFocusDepth";
  33. RHI::ShaderInputNameIndex m_autoFocusScreenPositionIndex = "m_autoFocusScreenPosition";
  34. RPI::Ptr<RPI::Buffer> m_bufferRef = nullptr;
  35. AZ::Vector2 m_autoFocusScreenPosition{ 0.0f, 0.0f };
  36. // Scope producer functions...
  37. void CompileResources(const RHI::FrameGraphCompileContext& context) override;
  38. // Pass overrides
  39. void BuildInternal() override;
  40. };
  41. } // namespace Render
  42. } // namespace AZ