DiffuseProbeGridRelocationPass.h 2.4 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/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. #include <Atom/RPI.Reflect/Pass/PassName.h>
  18. #include <Atom/RPI.Public/Image/AttachmentImage.h>
  19. #include <Render/DiffuseProbeGrid.h>
  20. namespace AZ
  21. {
  22. namespace Render
  23. {
  24. //! Compute shader that relocates probes in the diffuse probe grid.
  25. class DiffuseProbeGridRelocationPass final
  26. : public RPI::RenderPass
  27. {
  28. public:
  29. AZ_RPI_PASS(DiffuseProbeGridRelocationPass);
  30. AZ_RTTI(AZ::Render::DiffuseProbeGridRelocationPass, "{E6FCBE1A-0404-49B3-AA78-C2B0DEE94FB1}", RPI::RenderPass);
  31. AZ_CLASS_ALLOCATOR(DiffuseProbeGridRelocationPass, SystemAllocator);
  32. virtual ~DiffuseProbeGridRelocationPass() = default;
  33. static RPI::Ptr<DiffuseProbeGridRelocationPass> Create(const RPI::PassDescriptor& descriptor);
  34. private:
  35. DiffuseProbeGridRelocationPass(const RPI::PassDescriptor& descriptor);
  36. void LoadShader();
  37. // Pass overrides
  38. bool IsEnabled() const override;
  39. void FrameBeginInternal(FramePrepareParams params) override;
  40. void SetupFrameGraphDependencies(RHI::FrameGraphInterface frameGraph) override;
  41. void CompileResources(const RHI::FrameGraphCompileContext& context) override;
  42. void BuildCommandListInternal(const RHI::FrameGraphExecuteContext& context) override;
  43. void FrameEndInternal() override;
  44. // shader
  45. Data::Instance<RPI::Shader> m_shader;
  46. const RHI::PipelineState* m_pipelineState = nullptr;
  47. RHI::Ptr<RHI::ShaderResourceGroupLayout> m_srgLayout;
  48. RHI::DispatchDirect m_dispatchArgs;
  49. // revision number of the ray tracing data when the shader table was built
  50. uint32_t m_rayTracingDataRevision = 0;
  51. };
  52. } // namespace Render
  53. } // namespace AZ