MCPcopy Create free account
hub / github.com/KhronosGroup/glTF-IBL-Sampler / createImageView

Method createImageView

lib/source/vkHelper.cpp:1125–1162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1123}
1124
1125VkResult 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
1164void IBLLib::vkHelper::copyBufferToBasicImage2D(VkCommandBuffer _cmdBuffer, VkBuffer _src, VkImage _dst) const
1165{

Callers 2

panoramaToCubemapFunction · 0.80
sampleMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected