DiffuseProbeGridVisualizationPreparePass.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 <Atom/RPI.Public/Pass/RenderPass.h>
  10. #include <Atom/RPI.Public/Shader/Shader.h>
  11. namespace AZ
  12. {
  13. namespace Render
  14. {
  15. //! This pass updates the DiffuseProbeGrid visualization TLAS instances buffer
  16. class DiffuseProbeGridVisualizationPreparePass final
  17. : public RPI::RenderPass
  18. {
  19. public:
  20. AZ_RPI_PASS(DiffuseProbeGridVisualizationPreparePass);
  21. AZ_RTTI(DiffuseProbeGridVisualizationPreparePass, "{33BD769D-378B-4142-8C11-6A2ADA2BB095}", Pass);
  22. AZ_CLASS_ALLOCATOR(DiffuseProbeGridVisualizationPreparePass, SystemAllocator);
  23. //! Creates a DiffuseProbeGridVisualizationPreparePass
  24. static RPI::Ptr<DiffuseProbeGridVisualizationPreparePass> Create(const RPI::PassDescriptor& descriptor);
  25. ~DiffuseProbeGridVisualizationPreparePass() = default;
  26. private:
  27. explicit DiffuseProbeGridVisualizationPreparePass(const RPI::PassDescriptor& descriptor);
  28. void LoadShader();
  29. bool ShouldUpdate(const AZStd::shared_ptr<DiffuseProbeGrid>& diffuseProbeGrid) const;
  30. // Pass overrides
  31. bool IsEnabled() const override;
  32. void FrameBeginInternal(FramePrepareParams params) override;
  33. void SetupFrameGraphDependencies(RHI::FrameGraphInterface frameGraph) override;
  34. void CompileResources(const RHI::FrameGraphCompileContext& context) override;
  35. void BuildCommandListInternal(const RHI::FrameGraphExecuteContext& context) override;
  36. // shader
  37. Data::Instance<RPI::Shader> m_shader;
  38. const RHI::PipelineState* m_pipelineState = nullptr;
  39. RHI::Ptr<RHI::ShaderResourceGroupLayout> m_srgLayout;
  40. RHI::DispatchDirect m_dispatchArgs;
  41. };
  42. } // namespace RPI
  43. } // namespace AZ