BsGLCommandBuffer.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsGLPrerequisites.h"
  5. #include "BsCommandBuffer.h"
  6. #include "BsGLRenderAPI.h"
  7. namespace BansheeEngine
  8. {
  9. /** @addtogroup GL
  10. * @{
  11. */
  12. /**
  13. * Command buffer implementation for OpenGL, which doesn't support multi-threaded command generation. Instead all
  14. * commands are stored in an internal buffer, and then sent to the actual render API when the buffer is executed.
  15. */
  16. class GLCommandBuffer : public CommandBuffer
  17. {
  18. public:
  19. /** Registers a new command in the command buffer. */
  20. void queueCommand(const std::function<void()> command);
  21. /** Appends all commands from the secondary buffer into this command buffer. */
  22. void appendSecondary(const SPtr<GLCommandBuffer>& secondaryBuffer);
  23. /** Executes all commands in the command buffer. Not supported on secondary buffer. */
  24. void executeCommands();
  25. /** Removes all commands from the command buffer. */
  26. void clear();
  27. private:
  28. friend class GLCommandBufferManager;
  29. friend class GLRenderAPI;
  30. GLCommandBuffer(UINT32 id, GpuQueueType type, UINT32 deviceIdx, UINT32 queueIdx, bool secondary);
  31. Vector<std::function<void()>> mCommands;
  32. DrawOperationType mCurrentDrawOperation;
  33. };
  34. /** @} */
  35. }