BsGLCommandBuffer.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 "BsDrawOps.h"
  7. #include "BsGLRenderAPI.h"
  8. namespace BansheeEngine
  9. {
  10. /** @addtogroup GL
  11. * @{
  12. */
  13. /**
  14. * Command buffer implementation for OpenGL, which doesn't support multi-threaded command generation. Instead all
  15. * commands are stored in an internal buffer, and then sent to the actual render API when the buffer is executed.
  16. */
  17. class GLCommandBuffer : public CommandBuffer
  18. {
  19. public:
  20. /** Registers a new command in the command buffer. */
  21. void queueCommand(const std::function<void()> command);
  22. /** Appends all commands from the secondary buffer into this command buffer. */
  23. void appendSecondary(const SPtr<GLCommandBuffer>& secondaryBuffer);
  24. /** Executes all commands in the command buffer. Not supported on secondary buffer. */
  25. void executeCommands();
  26. /** Removes all commands from the command buffer. */
  27. void clear();
  28. private:
  29. friend class GLCommandBufferManager;
  30. friend class GLRenderAPI;
  31. GLCommandBuffer(CommandBufferType type, UINT32 deviceIdx, UINT32 syncMask, bool secondary);
  32. UINT32 mDeviceIdx;
  33. Vector<std::function<void()>> mCommands;
  34. DrawOperationType mCurrentDrawOperation;
  35. };
  36. /** @} */
  37. }