diff options
author | Lioncash <mathew1800@gmail.com> | 2020-07-17 01:21:42 +0200 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2020-07-17 01:22:11 +0200 |
commit | 3c060503bcd9fc088a080b4b6985f4236f2441bc (patch) | |
tree | 4a3172a936b0a8ad4279aed0f924cae078f836d3 /src/video_core/renderer_vulkan/vk_stream_buffer.cpp | |
parent | vk_staging_buffer_pool: Make use of designated initializers where applicable (diff) | |
download | yuzu-3c060503bcd9fc088a080b4b6985f4236f2441bc.tar yuzu-3c060503bcd9fc088a080b4b6985f4236f2441bc.tar.gz yuzu-3c060503bcd9fc088a080b4b6985f4236f2441bc.tar.bz2 yuzu-3c060503bcd9fc088a080b4b6985f4236f2441bc.tar.lz yuzu-3c060503bcd9fc088a080b4b6985f4236f2441bc.tar.xz yuzu-3c060503bcd9fc088a080b4b6985f4236f2441bc.tar.zst yuzu-3c060503bcd9fc088a080b4b6985f4236f2441bc.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/renderer_vulkan/vk_stream_buffer.cpp | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/src/video_core/renderer_vulkan/vk_stream_buffer.cpp b/src/video_core/renderer_vulkan/vk_stream_buffer.cpp index 2d28a6c47..a5526a3f5 100644 --- a/src/video_core/renderer_vulkan/vk_stream_buffer.cpp +++ b/src/video_core/renderer_vulkan/vk_stream_buffer.cpp @@ -122,30 +122,27 @@ void VKStreamBuffer::CreateBuffers(VkBufferUsageFlags usage) { // Substract from the preferred heap size some bytes to avoid getting out of memory. const VkDeviceSize heap_size = memory_properties.memoryHeaps[preferred_heap].size; const VkDeviceSize allocable_size = heap_size - 9 * 1024 * 1024; - - VkBufferCreateInfo buffer_ci; - buffer_ci.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; - buffer_ci.pNext = nullptr; - buffer_ci.flags = 0; - buffer_ci.size = std::min(PREFERRED_STREAM_BUFFER_SIZE, allocable_size); - buffer_ci.usage = usage; - buffer_ci.sharingMode = VK_SHARING_MODE_EXCLUSIVE; - buffer_ci.queueFamilyIndexCount = 0; - buffer_ci.pQueueFamilyIndices = nullptr; - - buffer = device.GetLogical().CreateBuffer(buffer_ci); + buffer = device.GetLogical().CreateBuffer({ + .sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, + .pNext = nullptr, + .flags = 0, + .size = std::min(PREFERRED_STREAM_BUFFER_SIZE, allocable_size), + .usage = usage, + .sharingMode = VK_SHARING_MODE_EXCLUSIVE, + .queueFamilyIndexCount = 0, + .pQueueFamilyIndices = nullptr, + }); const auto requirements = device.GetLogical().GetBufferMemoryRequirements(*buffer); const u32 required_flags = requirements.memoryTypeBits; stream_buffer_size = static_cast<u64>(requirements.size); - VkMemoryAllocateInfo memory_ai; - memory_ai.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO; - memory_ai.pNext = nullptr; - memory_ai.allocationSize = requirements.size; - memory_ai.memoryTypeIndex = GetMemoryType(memory_properties, required_flags); - - memory = device.GetLogical().AllocateMemory(memory_ai); + memory = device.GetLogical().AllocateMemory({ + .sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, + .pNext = nullptr, + .allocationSize = requirements.size, + .memoryTypeIndex = GetMemoryType(memory_properties, required_flags), + }); buffer.BindMemory(*memory, 0); } |