BsD3D11CommandBuffer.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 "BsD3D11Prerequisites.h"
  5. #include "RenderAPI/BsCommandBuffer.h"
  6. #include "BsD3D11RenderAPI.h"
  7. namespace bs { namespace ct
  8. {
  9. /** @addtogroup D3D11
  10. * @{
  11. */
  12. /**
  13. * Command buffer implementation for DirectX 11, 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 D3D11CommandBuffer : 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<D3D11CommandBuffer>& 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 D3D11CommandBufferManager;
  29. friend class D3D11RenderAPI;
  30. D3D11CommandBuffer(GpuQueueType type, UINT32 deviceIdx, UINT32 queueIdx, bool secondary);
  31. Vector<std::function<void()>> mCommands;
  32. DrawOperationType mActiveDrawOp;
  33. };
  34. /** @} */
  35. }}