BsCommandBuffer.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsCorePrerequisites.h"
  5. namespace BansheeEngine
  6. {
  7. /** @addtogroup RenderAPI
  8. * @{
  9. */
  10. /**
  11. * Contains a list of render API commands that can be queued for execution on the GPU. User is allowed to populate the
  12. * command buffer from any thread, ensuring render API command generation can be multi-threaded. Command buffers
  13. * must always be created on the core thread. Same command buffer cannot be used on multiple threads simulateously
  14. * without external synchronization.
  15. */
  16. class BS_CORE_EXPORT CommandBuffer
  17. {
  18. public:
  19. /**
  20. * Creates a new CommandBuffer.
  21. *
  22. * @param[in] type Determines what type of commands can be added to the command buffer.
  23. * @param[in] deviceIdx Index of the GPU the command buffer will be used to queue commands on. 0 is always
  24. * the primary available GPU.
  25. * @param[in] syncMask Determines how is concurrency handled between multiple command buffers on the same
  26. * device. If buffers don't share the same bits in the sync mask they are allowed to
  27. * execute concurrently on the GPU, however it is up to the user to ensure that they
  28. * do not contain any resources depended on each other. Leave on default to ensure
  29. * no concurrency is possible (safest).
  30. * @param[in] secondary If true the command buffer will not be allowed to execute on its own, but it can
  31. * be appended to a primary command buffer.
  32. * @return New CommandBuffer instance.
  33. *
  34. */
  35. static SPtr<CommandBuffer> create(CommandBufferType type, UINT32 deviceIdx = 0, UINT32 syncMask = 0xFFFFFFFF,
  36. bool secondary = false);
  37. protected:
  38. CommandBuffer(CommandBufferType type, UINT32 syncMask, bool secondary);
  39. CommandBufferType mType;
  40. UINT32 mSyncMask;
  41. bool mIsSecondary;
  42. };
  43. /** @} */
  44. }