diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2021-01-19 01:35:47 +0100 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2021-02-13 21:46:24 +0100 |
commit | 21b40de318898a15dee5baa9849cdd2d8cbdd379 (patch) | |
tree | 814c911eafb6a635f295649ac700651e471d06c1 /src/video_core/renderer_vulkan/vk_update_descriptor.h | |
parent | Merge pull request #5921 from ameerj/srgb-views (diff) | |
download | yuzu-21b40de318898a15dee5baa9849cdd2d8cbdd379.tar yuzu-21b40de318898a15dee5baa9849cdd2d8cbdd379.tar.gz yuzu-21b40de318898a15dee5baa9849cdd2d8cbdd379.tar.bz2 yuzu-21b40de318898a15dee5baa9849cdd2d8cbdd379.tar.lz yuzu-21b40de318898a15dee5baa9849cdd2d8cbdd379.tar.xz yuzu-21b40de318898a15dee5baa9849cdd2d8cbdd379.tar.zst yuzu-21b40de318898a15dee5baa9849cdd2d8cbdd379.zip |
Diffstat (limited to 'src/video_core/renderer_vulkan/vk_update_descriptor.h')
-rw-r--r-- | src/video_core/renderer_vulkan/vk_update_descriptor.h | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/video_core/renderer_vulkan/vk_update_descriptor.h b/src/video_core/renderer_vulkan/vk_update_descriptor.h index e214f7195..d35e77c44 100644 --- a/src/video_core/renderer_vulkan/vk_update_descriptor.h +++ b/src/video_core/renderer_vulkan/vk_update_descriptor.h @@ -4,8 +4,7 @@ #pragma once -#include <variant> -#include <boost/container/static_vector.hpp> +#include <array> #include "common/common_types.h" #include "video_core/vulkan_common/vulkan_wrapper.h" @@ -16,13 +15,15 @@ class Device; class VKScheduler; struct DescriptorUpdateEntry { - DescriptorUpdateEntry(VkDescriptorImageInfo image_) : image{image_} {} + struct Empty {}; + DescriptorUpdateEntry() = default; + DescriptorUpdateEntry(VkDescriptorImageInfo image_) : image{image_} {} DescriptorUpdateEntry(VkDescriptorBufferInfo buffer_) : buffer{buffer_} {} - DescriptorUpdateEntry(VkBufferView texel_buffer_) : texel_buffer{texel_buffer_} {} union { + Empty empty{}; VkDescriptorImageInfo image; VkDescriptorBufferInfo buffer; VkBufferView texel_buffer; @@ -41,39 +42,40 @@ public: void Send(VkDescriptorUpdateTemplateKHR update_template, VkDescriptorSet set); void AddSampledImage(VkImageView image_view, VkSampler sampler) { - payload.emplace_back(VkDescriptorImageInfo{ + *(payload_cursor++) = VkDescriptorImageInfo{ .sampler = sampler, .imageView = image_view, .imageLayout = VK_IMAGE_LAYOUT_GENERAL, - }); + }; } void AddImage(VkImageView image_view) { - payload.emplace_back(VkDescriptorImageInfo{ + *(payload_cursor++) = VkDescriptorImageInfo{ .sampler = VK_NULL_HANDLE, .imageView = image_view, .imageLayout = VK_IMAGE_LAYOUT_GENERAL, - }); + }; } - void AddBuffer(VkBuffer buffer, u64 offset, size_t size) { - payload.emplace_back(VkDescriptorBufferInfo{ + void AddBuffer(VkBuffer buffer, VkDeviceSize offset, VkDeviceSize size) { + *(payload_cursor++) = VkDescriptorBufferInfo{ .buffer = buffer, .offset = offset, .range = size, - }); + }; } void AddTexelBuffer(VkBufferView texel_buffer) { - payload.emplace_back(texel_buffer); + *(payload_cursor++) = texel_buffer; } private: const Device& device; VKScheduler& scheduler; + DescriptorUpdateEntry* payload_cursor = nullptr; const DescriptorUpdateEntry* upload_start = nullptr; - boost::container::static_vector<DescriptorUpdateEntry, 0x10000> payload; + std::array<DescriptorUpdateEntry, 0x10000> payload; }; } // namespace Vulkan |