BsCommandBuffer.h 2.0 KB

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