BsVulkanIndexBuffer.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 "RenderAPI/BsIndexBuffer.h"
  6. namespace bs { namespace ct
  7. {
  8. /** @addtogroup Vulkan
  9. * @{
  10. */
  11. /** Vulkan implementation of an index buffer. */
  12. class VulkanIndexBuffer : public IndexBuffer
  13. {
  14. public:
  15. VulkanIndexBuffer(const INDEX_BUFFER_DESC& desc, GpuDeviceFlags deviceMask);
  16. ~VulkanIndexBuffer();
  17. /** @copydoc IndexBuffer::readData */
  18. void readData(UINT32 offset, UINT32 length, void* dest, UINT32 deviceIdx = 0, UINT32 queueIdx = 0) override;
  19. /** @copydoc IndexBuffer::writeData */
  20. void writeData(UINT32 offset, UINT32 length, const void* source,
  21. BufferWriteType writeFlags = BWT_NORMAL, UINT32 queueIdx = 0) override;
  22. /** @copydoc IndexBuffer::copyData */
  23. void copyData(HardwareBuffer& srcBuffer, UINT32 srcOffset, UINT32 dstOffset, UINT32 length,
  24. bool discardWholeBuffer = false, const SPtr<CommandBuffer>& commandBuffer = nullptr) override;
  25. /**
  26. * Gets the resource wrapping the buffer object, on the specified device. If GPU param block buffer's device mask
  27. * doesn't include the provided device, null is returned.
  28. */
  29. VulkanBuffer* getResource(UINT32 deviceIdx) const;
  30. protected:
  31. /** @copydoc IndexBuffer::map */
  32. void* map(UINT32 offset, UINT32 length, GpuLockOptions options, UINT32 deviceIdx, UINT32 queueIdx) override;
  33. /** @copydoc IndexBuffer::unmap */
  34. void unmap() override;
  35. /** @copydoc IndexBuffer::initialize */
  36. void initialize() override;
  37. private:
  38. VulkanHardwareBuffer* mBuffer;
  39. GpuBufferUsage mUsage;
  40. GpuDeviceFlags mDeviceMask;
  41. };
  42. /** @} */
  43. }}