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

Class Attachment

framework/rendering/render_target.h:38–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36 */
37template <vkb::BindingType bindingType>
38struct Attachment
39{
40 using FormatType = typename std::conditional<bindingType == BindingType::Cpp, vk::Format, VkFormat>::type;
41 using ImageLayoutType = typename std::conditional<bindingType == BindingType::Cpp, vk::ImageLayout, VkImageLayout>::type;
42 using ImageUsageFlagsType = typename std::conditional<bindingType == BindingType::Cpp, vk::ImageUsageFlags, VkImageUsageFlags>::type;
43 using SampleCountFlagBitsType = typename std::conditional<bindingType == BindingType::Cpp, vk::SampleCountFlagBits, VkSampleCountFlagBits>::type;
44
45 private:
46 constexpr FormatType default_format() const
47 {
48 if constexpr (bindingType == BindingType::Cpp)
49 {
50 return vk::Format::eUndefined;
51 }
52 else
53 {
54 return VK_FORMAT_UNDEFINED;
55 }
56 }
57
58 constexpr ImageLayoutType default_image_layout() const
59 {
60 if constexpr (bindingType == BindingType::Cpp)
61 {
62 return vk::ImageLayout::eUndefined;
63 }
64 else
65 {
66 return VK_IMAGE_LAYOUT_UNDEFINED;
67 }
68 }
69
70 constexpr ImageUsageFlagsType default_image_usage_flags() const
71 {
72 if constexpr (bindingType == BindingType::Cpp)
73 {
74 return vk::ImageUsageFlagBits::eSampled;
75 }
76 else
77 {
78 return VK_IMAGE_USAGE_SAMPLED_BIT;
79 }
80 }
81
82 constexpr SampleCountFlagBitsType default_sample_count_flag_bits() const
83 {
84 if constexpr (bindingType == BindingType::Cpp)
85 {
86 return vk::SampleCountFlagBits::e1;
87 }
88 else
89 {
90 return VK_SAMPLE_COUNT_1_BIT;
91 }
92 }
93
94 public:
95 FormatType format = default_format();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected