RayTracingAccelerationStructurePass.h 1.9 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/RHI/ScopeProducer.h>
  10. #include <Atom/RPI.Public/Pass/Pass.h>
  11. #include <Atom/RPI.Public/Buffer/Buffer.h>
  12. #include <Atom/RHI/RayTracingBufferPools.h>
  13. namespace AZ
  14. {
  15. namespace Render
  16. {
  17. //! This pass builds the RayTracing acceleration structures for a scene
  18. class RayTracingAccelerationStructurePass final
  19. : public RPI::Pass
  20. , public RHI::ScopeProducer
  21. {
  22. public:
  23. AZ_RPI_PASS(RayTracingAccelerationStructurePass);
  24. AZ_RTTI(RayTracingAccelerationStructurePass, "{6BAA1755-D7D2-497F-BCDB-CA28B42728DC}", Pass);
  25. AZ_CLASS_ALLOCATOR(RayTracingAccelerationStructurePass, SystemAllocator);
  26. //! Creates a RayTracingAccelerationStructurePass
  27. static RPI::Ptr<RayTracingAccelerationStructurePass> Create(const RPI::PassDescriptor& descriptor);
  28. ~RayTracingAccelerationStructurePass() = default;
  29. private:
  30. explicit RayTracingAccelerationStructurePass(const RPI::PassDescriptor& descriptor);
  31. // Scope producer functions
  32. void SetupFrameGraphDependencies(RHI::FrameGraphInterface frameGraph) override;
  33. void BuildCommandList(const RHI::FrameGraphExecuteContext& context) override;
  34. // Pass overrides
  35. void BuildInternal() override;
  36. void FrameBeginInternal(FramePrepareParams params) override;
  37. // buffer view descriptor for the TLAS
  38. RHI::BufferViewDescriptor m_tlasBufferViewDescriptor;
  39. // revision number of the ray tracing data when the TLAS was built
  40. uint32_t m_rayTracingRevision = 0;
  41. };
  42. } // namespace RPI
  43. } // namespace AZ