DiffuseProbeGridBlendDistancePass.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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/ScopeProducer.h>
  12. #include <Atom/RPI.Public/Pass/RenderPass.h>
  13. #include <Atom/RPI.Public/Shader/Shader.h>
  14. #include <Render/DiffuseProbeGridFeatureProcessor.h>
  15. namespace AZ
  16. {
  17. namespace RHI
  18. {
  19. class PipelineState;
  20. }
  21. namespace Render
  22. {
  23. //! Compute shader that generates the distance texture from the diffuse probe raytrace.
  24. class DiffuseProbeGridBlendDistancePass final
  25. : public RPI::RenderPass
  26. {
  27. public:
  28. AZ_RPI_PASS(DiffuseProbeGridBlendDistancePass);
  29. AZ_RTTI(AZ::Render::DiffuseProbeGridBlendDistancePass, "{8D57B51E-3432-49F6-83F8-DB6DF2F5A5CA}", RPI::RenderPass);
  30. AZ_CLASS_ALLOCATOR(DiffuseProbeGridBlendDistancePass, SystemAllocator);
  31. virtual ~DiffuseProbeGridBlendDistancePass() = default;
  32. static RPI::Ptr<DiffuseProbeGridBlendDistancePass> Create(const RPI::PassDescriptor& descriptor);
  33. private:
  34. DiffuseProbeGridBlendDistancePass(const RPI::PassDescriptor& descriptor);
  35. void LoadShader();
  36. // Pass overrides
  37. bool IsEnabled() const override;
  38. void SetupFrameGraphDependencies(RHI::FrameGraphInterface frameGraph) override;
  39. void CompileResources(const RHI::FrameGraphCompileContext& context) override;
  40. void BuildCommandListInternal(const RHI::FrameGraphExecuteContext& context) override;
  41. // shaders
  42. struct DiffuseProbeGridShader
  43. {
  44. Data::Instance<RPI::Shader> m_shader;
  45. const RHI::PipelineState* m_pipelineState = nullptr;
  46. RHI::Ptr<RHI::ShaderResourceGroupLayout> m_srgLayout;
  47. RHI::DispatchDirect m_dispatchArgs;
  48. };
  49. AZStd::vector<DiffuseProbeGridShader> m_shaders;
  50. };
  51. } // namespace Render
  52. } // namespace AZ