MythTV
master
mythtv
libs
libmythui
vulkan
mythuniformbuffervulkan.cpp
Go to the documentation of this file.
1
// MythTV
2
#include "
vulkan/mythuniformbuffervulkan.h
"
3
4
MythUniformBufferVulkan
*
MythUniformBufferVulkan::Create
(
MythVulkanObject
* Vulkan, VkDeviceSize Size)
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
15
MythUniformBufferVulkan::MythUniformBufferVulkan
(
MythVulkanObject
* Vulkan, VkDeviceSize Size)
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,
21
m_buffer
,
m_bufferMemory
))
22
{
23
m_vulkanValid
=
m_vulkanFuncs
->vkMapMemory(
m_vulkanDevice
,
m_bufferMemory
, 0,
Size
, 0, &
m_mappedMemory
) == VK_SUCCESS;
24
}
25
}
26
27
MythUniformBufferVulkan::~MythUniformBufferVulkan
()
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
46
void
MythUniformBufferVulkan::Update
(
void
*
Source
)
47
{
48
if
(
Source
)
49
memcpy(
m_mappedMemory
,
Source
,
m_bufferSize
);
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:32
MythVulkanObject::m_vulkanValid
bool m_vulkanValid
Definition:
mythrendervulkan.h:47
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:49
mythuniformbuffervulkan.h
MythVulkanObject::m_vulkanRender
MythRenderVulkan * m_vulkanRender
Definition:
mythrendervulkan.h:48
Source
Definition:
channelsettings.cpp:93
MythVulkanObject::m_vulkanFuncs
QVulkanDeviceFunctions * m_vulkanFuncs
Definition:
mythrendervulkan.h:50
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
Generated on Tue Jan 7 2025 03:18:37 for MythTV by
1.8.17