MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Samples / BufferBuilder

Class BufferBuilder

framework/core/buffer.h:37–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35
36template <vkb::BindingType bindingType>
37struct BufferBuilder
38 : public vkb::allocated::BuilderBase<bindingType,
39 BufferBuilder<bindingType>,
40 typename std::conditional<bindingType == vkb::BindingType::Cpp, vk::BufferCreateInfo, VkBufferCreateInfo>::type>
41{
42 public:
43 using BufferCreateFlagsType = typename std::conditional<bindingType == vkb::BindingType::Cpp, vk::BufferCreateFlags, VkBufferCreateFlags>::type;
44 using BufferCreateInfoType = typename std::conditional<bindingType == vkb::BindingType::Cpp, vk::BufferCreateInfo, VkBufferCreateInfo>::type;
45 using BufferUsageFlagsType = typename std::conditional<bindingType == vkb::BindingType::Cpp, vk::BufferUsageFlags, VkBufferUsageFlags>::type;
46 using DeviceSizeType = typename std::conditional<bindingType == vkb::BindingType::Cpp, vk::DeviceSize, VkDeviceSize>::type;
47 using SharingModeType = typename std::conditional<bindingType == vkb::BindingType::Cpp, vk::SharingMode, VkSharingMode>::type;
48
49 private:
50 using ParentType = vkb::allocated::BuilderBase<bindingType, BufferBuilder<bindingType>, BufferCreateInfoType>;
51
52 public:
53 BufferBuilder(DeviceSizeType size);
54
55 Buffer<bindingType> build(vkb::core::Device<bindingType> &device) const;
56 BufferPtr<bindingType> build_unique(vkb::core::Device<bindingType> &device) const;
57 BufferBuilder &with_flags(BufferCreateFlagsType flags);
58 BufferBuilder &with_usage(BufferUsageFlagsType usage);
59 BufferBuilder &with_alignment(DeviceSizeType align);
60 DeviceSizeType get_alignment() const
61 {
62 return alignment;
63 }
64
65 private:
66 DeviceSizeType alignment{0};
67};
68
69using BufferBuilderC = BufferBuilder<vkb::BindingType::C>;
70using BufferBuilderCpp = BufferBuilder<vkb::BindingType::Cpp>;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected