ClusterBinning.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. /// @addtogroup renderer
  9. /// @{
  10. /// Bins clusterer objects to the clusterer.
  11. class ClusterBinning : public RendererObject
  12. {
  13. public:
  14. ClusterBinning(Renderer* r);
  15. ~ClusterBinning();
  16. ANKI_USE_RESULT Error init(const ConfigSet& config);
  17. /// Populate the rendergraph.
  18. void populateRenderGraph(RenderingContext& ctx);
  19. /// It will populate the clusters and the rest of the objects (lights, probes etc) in an async job. Needs to be
  20. /// called after the render queue is finalized.
  21. void writeClusterBuffersAsync();
  22. private:
  23. ShaderProgramResourcePtr m_prog;
  24. ShaderProgramPtr m_grProg;
  25. U32 m_tileCount = 0;
  26. U32 m_clusterCount = 0;
  27. class
  28. {
  29. public:
  30. RenderingContext* m_ctx = nullptr;
  31. } m_runCtx;
  32. void writeClustererBuffers(RenderingContext& ctx);
  33. void writeClustererBuffersTask();
  34. };
  35. /// @}
  36. } // end namespace anki