ClusterBinning.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // Copyright (C) 2009-2021, Panagiotis Christopoulos Charitos and contributors.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. #pragma once
  6. #include <AnKi/Renderer/RendererObject.h>
  7. namespace anki
  8. {
  9. /// @addtogroup renderer
  10. /// @{
  11. /// Bins clusterer objects to the clusterer.
  12. class ClusterBinning : public RendererObject
  13. {
  14. public:
  15. ClusterBinning(Renderer* r);
  16. ~ClusterBinning();
  17. ANKI_USE_RESULT Error init(const ConfigSet& config);
  18. /// Populate the rendergraph.
  19. void populateRenderGraph(RenderingContext& ctx);
  20. /// It will populate the clusters and the rest of the objects (lights, probes etc) in an async job. Needs to be
  21. /// called after the render queue is finalized.
  22. void writeClusterBuffersAsync();
  23. private:
  24. ShaderProgramResourcePtr m_prog;
  25. ShaderProgramPtr m_grProg;
  26. U32 m_tileCount = 0;
  27. U32 m_clusterCount = 0;
  28. class
  29. {
  30. public:
  31. RenderingContext* m_ctx = nullptr;
  32. } m_runCtx;
  33. void run(RenderPassWorkContext& rgraphCtx);
  34. void writeClustererBuffers(RenderingContext& ctx);
  35. void writeClustererBuffersTask();
  36. };
  37. /// @}
  38. } // end namespace anki