BsCommandBuffer.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #include "BsCommandBuffer.h"
  4. #include "BsCommandBufferManager.h"
  5. namespace BansheeEngine
  6. {
  7. void CommandSyncMask::addDependency(const SPtr<CommandBuffer>& buffer)
  8. {
  9. if (buffer == nullptr)
  10. return;
  11. mMask |= getGlobalQueueIdx(buffer->getType(), buffer->getQueueIdx());
  12. }
  13. UINT32 CommandSyncMask::getGlobalQueueIdx(GpuQueueType type, UINT32 queueIdx)
  14. {
  15. UINT32 bitShift = 0;
  16. switch (type)
  17. {
  18. case GQT_GRAPHICS:
  19. break;
  20. case GQT_COMPUTE:
  21. bitShift = 8;
  22. break;
  23. case GQT_UPLOAD:
  24. bitShift = 16;
  25. break;
  26. default:
  27. break;
  28. }
  29. return (1 << queueIdx) << bitShift;
  30. }
  31. CommandBuffer::CommandBuffer(GpuQueueType type, UINT32 deviceIdx, UINT32 queueIdx, bool secondary)
  32. :mType(type), mDeviceIdx(deviceIdx), mQueueIdx(queueIdx), mIsSecondary(secondary)
  33. {
  34. }
  35. SPtr<CommandBuffer> CommandBuffer::create(GpuQueueType type, UINT32 deviceIdx, UINT32 queueIdx,
  36. bool secondary)
  37. {
  38. return CommandBufferManager::instance().create(type, deviceIdx, queueIdx, secondary);
  39. }
  40. }