| 231 | |
| 232 | template <vkb::BindingType bindingType> |
| 233 | inline void RenderTarget<bindingType>::init(std::vector<vkb::core::HPPImage> &&images_) |
| 234 | { |
| 235 | assert(!images_.empty()); |
| 236 | |
| 237 | device = &images_.back().get_device(); |
| 238 | images = std::move(images_); |
| 239 | |
| 240 | // Returns the image extent as a vk::Extent2D structure from a vk::Extent3D |
| 241 | auto get_image_extent = [](const vkb::core::HPPImage &image) { return vk::Extent2D{image.get_extent().width, image.get_extent().height}; }; |
| 242 | |
| 243 | extent = get_image_extent(images.front()); |
| 244 | if (std::ranges::find_if(images, |
| 245 | [extent = this->extent, &get_image_extent](const vkb::core::HPPImage &image) { return get_image_extent(image) != extent; }) != images.end()) |
| 246 | { |
| 247 | throw vkb::common::HPPVulkanException{vk::Result::eErrorInitializationFailed, "Extent size is not unique"}; |
| 248 | } |
| 249 | |
| 250 | for (auto &image : images) |
| 251 | { |
| 252 | if (image.get_type() != vk::ImageType::e2D) |
| 253 | { |
| 254 | throw vkb::common::HPPVulkanException{vk::Result::eErrorInitializationFailed, "Image type is not 2D"}; |
| 255 | } |
| 256 | |
| 257 | views.emplace_back(image, vk::ImageViewType::e2D); |
| 258 | |
| 259 | attachments.emplace_back(image.get_format(), image.get_sample_count(), image.get_usage()); |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | template <vkb::BindingType bindingType> |
| 264 | inline RenderTarget<bindingType>::RenderTarget(std::vector<ImageViewType> &&image_views) |
nothing calls this directly
no test coverage detected