BsVulkanGpuBuffer.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsVulkanPrerequisites.h"
  5. #include "BsGpuBuffer.h"
  6. namespace bs { namespace ct
  7. {
  8. /** @addtogroup Vulkan
  9. * @{
  10. */
  11. /** DirectX 11 implementation of a generic GPU buffer. */
  12. class VulkanGpuBuffer : public GpuBuffer
  13. {
  14. public:
  15. ~VulkanGpuBuffer();
  16. /** @copydoc GpuBuffer::lock */
  17. void* lock(UINT32 offset, UINT32 length, GpuLockOptions options, UINT32 deviceIdx = 0, UINT32 queueIdx = 0) override;
  18. /** @copydoc GpuBuffer::unlock */
  19. void unlock() override;
  20. /** @copydoc GpuBuffer::readData */
  21. void readData(UINT32 offset, UINT32 length, void* dest, UINT32 deviceIdx = 0, UINT32 queueIdx = 0) override;
  22. /** @copydoc GpuBuffer::writeData */
  23. void writeData(UINT32 offset, UINT32 length, const void* source, BufferWriteType writeFlags = BWT_NORMAL,
  24. UINT32 queueIdx = 0) override;
  25. /** @copydoc GpuBuffer::copyData */
  26. void copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset, UINT32 dstOffset, UINT32 length,
  27. bool discardWholeBuffer = false, const SPtr<CommandBuffer>& commandBuffer = nullptr) override;
  28. /**
  29. * Gets the resource wrapping the buffer object, on the specified device. If GPU param block buffer's device mask
  30. * doesn't include the provided device, null is returned.
  31. */
  32. VulkanBuffer* getResource(UINT32 deviceIdx) const;
  33. protected:
  34. friend class VulkanHardwareBufferManager;
  35. VulkanGpuBuffer(const GPU_BUFFER_DESC& desc, GpuDeviceFlags deviceMask);
  36. /** @copydoc GpuBuffer::initialize */
  37. void initialize() override;
  38. private:
  39. VulkanHardwareBuffer* mBuffer;
  40. GpuDeviceFlags mDeviceMask;
  41. };
  42. /** @} */
  43. }}