MythTV  master
mythuniformbuffervulkan.cpp
Go to the documentation of this file.
1 // MythTV
3 
5 {
6  auto* result = new MythUniformBufferVulkan(Vulkan, Size);
7  if (result && !result->IsValidVulkan())
8  {
9  delete result;
10  result = nullptr;
11  }
12  return result;
13 }
14 
16  : MythVulkanObject(Vulkan),
17  m_bufferSize(Size)
18 {
19  if (m_vulkanValid && m_vulkanRender->CreateBuffer(Size, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT,
20  VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
22  {
23  m_vulkanValid = m_vulkanFuncs->vkMapMemory(m_vulkanDevice, m_bufferMemory, 0, Size, 0, &m_mappedMemory) == VK_SUCCESS;
24  }
25 }
26 
28 {
29  if (m_vulkanValid)
30  {
31  m_vulkanFuncs->vkDestroyBuffer(m_vulkanDevice, m_buffer, nullptr);
32  m_vulkanFuncs->vkFreeMemory(m_vulkanDevice, m_bufferMemory, nullptr);
33  }
34 }
35 
36 VkDeviceSize MythUniformBufferVulkan::Size(void) const
37 {
38  return m_bufferSize;
39 }
40 
41 VkDescriptorBufferInfo MythUniformBufferVulkan::GetBufferInfo(void) const
42 {
43  return { m_buffer, 0, VK_WHOLE_SIZE };
44 }
45 
47 {
48  if (Source)
50 }
MythUniformBufferVulkan::MythUniformBufferVulkan
MythUniformBufferVulkan(MythVulkanObject *Vulkan, VkDeviceSize Size)
Definition: mythuniformbuffervulkan.cpp:15
MythUniformBufferVulkan::m_bufferMemory
VkDeviceMemory m_bufferMemory
Definition: mythuniformbuffervulkan.h:23
MythUniformBufferVulkan::GetBufferInfo
VkDescriptorBufferInfo GetBufferInfo(void) const
Definition: mythuniformbuffervulkan.cpp:41
MythUniformBufferVulkan::m_mappedMemory
void * m_mappedMemory
Definition: mythuniformbuffervulkan.h:24
MythVulkanObject
Definition: mythrendervulkan.h:29
MythVulkanObject::m_vulkanValid
bool m_vulkanValid
Definition: mythrendervulkan.h:44
MythUniformBufferVulkan::Update
void Update(void *Source)
Definition: mythuniformbuffervulkan.cpp:46
MythUniformBufferVulkan::Size
VkDeviceSize Size(void) const
Definition: mythuniformbuffervulkan.cpp:36
MythVulkanObject::m_vulkanDevice
VkDevice m_vulkanDevice
Definition: mythrendervulkan.h:46
mythuniformbuffervulkan.h
MythVulkanObject::m_vulkanRender
MythRenderVulkan * m_vulkanRender
Definition: mythrendervulkan.h:45
Source
Definition: channelsettings.cpp:68
MythVulkanObject::m_vulkanFuncs
QVulkanDeviceFunctions * m_vulkanFuncs
Definition: mythrendervulkan.h:47
MythUniformBufferVulkan
Definition: mythuniformbuffervulkan.h:7
MythUniformBufferVulkan::m_buffer
VkBuffer m_buffer
Definition: mythuniformbuffervulkan.h:22
MythUniformBufferVulkan::m_bufferSize
VkDeviceSize m_bufferSize
Definition: mythuniformbuffervulkan.h:21
MythUniformBufferVulkan::~MythUniformBufferVulkan
~MythUniformBufferVulkan()
Definition: mythuniformbuffervulkan.cpp:27
MythUniformBufferVulkan::Create
static MythUniformBufferVulkan * Create(MythVulkanObject *Vulkan, VkDeviceSize Size)
Definition: mythuniformbuffervulkan.cpp:4
MythRenderVulkan::CreateBuffer
bool CreateBuffer(VkDeviceSize Size, VkBufferUsageFlags Usage, VkMemoryPropertyFlags Properties, VkBuffer &Buffer, VkDeviceMemory &Memory)
Definition: mythrendervulkan.cpp:450