Changeset f94eea9 in opengl-game for vulkan-utils.cpp
- Timestamp:
- Sep 27, 2019, 7:20:55 PM (5 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- 6fc24c7
- Parents:
- 054d9ed
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vulkan-utils.cpp
r054d9ed rf94eea9 166 166 } 167 167 } 168 169 VkImageView VulkanUtils::createImageView(VkDevice device, VkImage image, VkFormat format, VkImageAspectFlags aspectFlags) { 170 VkImageViewCreateInfo viewInfo = {}; 171 viewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; 172 viewInfo.image = image; 173 viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D; 174 viewInfo.format = format; 175 176 viewInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY; 177 viewInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY; 178 viewInfo.components.b = VK_COMPONENT_SWIZZLE_IDENTITY; 179 viewInfo.components.a = VK_COMPONENT_SWIZZLE_IDENTITY; 180 181 viewInfo.subresourceRange.aspectMask = aspectFlags; 182 viewInfo.subresourceRange.baseMipLevel = 0; 183 viewInfo.subresourceRange.levelCount = 1; 184 viewInfo.subresourceRange.baseArrayLayer = 0; 185 viewInfo.subresourceRange.layerCount = 1; 186 187 VkImageView imageView; 188 if (vkCreateImageView(device, &viewInfo, nullptr, &imageView) != VK_SUCCESS) { 189 throw runtime_error("failed to create image view!"); 190 } 191 192 return imageView; 193 }
Note:
See TracChangeset
for help on using the changeset viewer.