5 QVulkanDeviceFunctions *Functions,
6 const std::vector<uint16_t> &Indices)
9 if (result && !result->m_valid)
18 QVulkanDeviceFunctions *Functions,
19 const std::vector<uint16_t> &Indices)
22 m_size =
static_cast<uint32_t
>(Indices.size());
23 VkDeviceSize size =
sizeof(Indices[0]) * Indices.size();
24 VkBuffer stagingbuf =
nullptr;
25 VkDeviceMemory stagingmem =
nullptr;
27 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
28 stagingbuf, stagingmem))
31 m_devFuncs->vkMapMemory(m_device, stagingmem, 0, size, 0, &
tmp);
32 memcpy(
tmp, Indices.data(),
static_cast<size_t>(size));
33 m_devFuncs->vkUnmapMemory(m_device, stagingmem);
35 if (
Render->
CreateBuffer(size, VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_INDEX_BUFFER_BIT,
36 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
43 m_devFuncs->vkDestroyBuffer(m_device, stagingbuf,
nullptr);
44 m_devFuncs->vkFreeMemory(m_device, stagingmem,
nullptr);
50 if (m_device && m_devFuncs)
52 m_devFuncs->vkDestroyBuffer(m_device,
m_buffer,
nullptr);
53 m_devFuncs->vkFreeMemory(m_device,
m_memory,
nullptr);
A device containing images (ie. USB stick, CD, storage group etc)
MythIndexBufferVulkan(MythRenderVulkan *Render, VkDevice Device, QVulkanDeviceFunctions *Functions, const std::vector< uint16_t > &Indices)
static MythIndexBufferVulkan * Create(MythRenderVulkan *Render, VkDevice Device, QVulkanDeviceFunctions *Functions, const std::vector< uint16_t > &Indices)
uint32_t GetSize(void) const
VkBuffer GetBuffer(void) const
bool CreateBuffer(VkDeviceSize Size, VkBufferUsageFlags Usage, VkMemoryPropertyFlags Properties, VkBuffer &Buffer, VkDeviceMemory &Memory)
void CopyBuffer(VkBuffer Src, VkBuffer Dst, VkDeviceSize Size, VkCommandBuffer CommandBuffer=nullptr)
MythRenderVulkan * Render()