DiffuseProbeGridClassificationPass.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. #include <Render/DiffuseProbeGridFeatureProcessor.h>
  21. namespace AZ
  22. {
  23. namespace Render
  24. {
  25. //! Compute shader that classifies probes as active or inactive in the diffuse probe grid.
  26. class DiffuseProbeGridClassificationPass final
  27. : public RPI::RenderPass
  28. {
  29. public:
  30. AZ_RPI_PASS(DiffuseProbeGridClassificationPass);
  31. AZ_RTTI(AZ::Render::DiffuseProbeGridClassificationPass, "{98A6477A-F31C-4390-9BEB-9DB8E30BB281}", RPI::RenderPass);
  32. AZ_CLASS_ALLOCATOR(DiffuseProbeGridClassificationPass, SystemAllocator);
  33. virtual ~DiffuseProbeGridClassificationPass() = default;
  34. static RPI::Ptr<DiffuseProbeGridClassificationPass> Create(const RPI::PassDescriptor& descriptor);
  35. private:
  36. DiffuseProbeGridClassificationPass(const RPI::PassDescriptor& descriptor);
  37. void LoadShader();
  38. // Pass overrides
  39. bool IsEnabled() const 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. // shader
  44. struct DiffuseProbeGridShader
  45. {
  46. Data::Instance<RPI::Shader> m_shader;
  47. const RHI::PipelineState* m_pipelineState = nullptr;
  48. RHI::Ptr<RHI::ShaderResourceGroupLayout> m_srgLayout;
  49. RHI::DispatchDirect m_dispatchArgs;
  50. };
  51. AZStd::vector<DiffuseProbeGridShader> m_shaders;
  52. };
  53. } // namespace Render
  54. } // namespace AZ