| 1123 | } |
| 1124 | |
| 1125 | VkResult IBLLib::vkHelper::createImageView(VkImageView& _outView, VkImage _image, VkImageSubresourceRange _range, VkFormat _format, VkImageViewType _type, VkComponentMapping _swizzle) |
| 1126 | { |
| 1127 | if (m_logicalDevice == VK_NULL_HANDLE) |
| 1128 | { |
| 1129 | return VK_RESULT_MAX_ENUM; |
| 1130 | } |
| 1131 | |
| 1132 | for (Image& img : m_images) |
| 1133 | { |
| 1134 | if (img.image == _image) |
| 1135 | { |
| 1136 | VkImageViewCreateInfo info{}; |
| 1137 | info.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; |
| 1138 | info.pNext = nullptr; |
| 1139 | info.format = _format == VK_FORMAT_UNDEFINED ? img.info.format : _format; |
| 1140 | info.flags = 0u; |
| 1141 | info.image = _image; |
| 1142 | info.components = _swizzle; |
| 1143 | info.viewType = _type; |
| 1144 | info.subresourceRange = _range; |
| 1145 | |
| 1146 | VkResult res = vkCreateImageView(m_logicalDevice, &info, nullptr, &_outView); |
| 1147 | |
| 1148 | if (res == VK_SUCCESS) |
| 1149 | { |
| 1150 | img.views.emplace_back(_outView); |
| 1151 | } |
| 1152 | else |
| 1153 | { |
| 1154 | printf("Failed to create image view [%u]\n", res); |
| 1155 | } |
| 1156 | |
| 1157 | return res; |
| 1158 | } |
| 1159 | } |
| 1160 | |
| 1161 | return VK_RESULT_MAX_ENUM; |
| 1162 | } |
| 1163 | |
| 1164 | void IBLLib::vkHelper::copyBufferToBasicImage2D(VkCommandBuffer _cmdBuffer, VkBuffer _src, VkImage _dst) const |
| 1165 | { |
no outgoing calls
no test coverage detected