@@ -2420,41 +2420,16 @@ void VulkanSurface::create_swap_chain() {
2420
2420
device_->vk_device (), img, surface_format.format , VK_IMAGE_TYPE_2D,
2421
2421
VkExtent3D{uint32_t (width), uint32_t (height), 1 }, 1u , 1u , usage);
2422
2422
2423
- VkImageViewType image_view_type = VK_IMAGE_VIEW_TYPE_MAX_ENUM;
2424
- if (image->array_layers > 1 ) {
2425
- if (image->type == VK_IMAGE_TYPE_1D) {
2426
- image_view_type = VK_IMAGE_VIEW_TYPE_1D_ARRAY;
2427
- } else if (image->type == VK_IMAGE_TYPE_2D) {
2428
- image_view_type = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
2429
- }
2430
- } else {
2431
- if (image->type == VK_IMAGE_TYPE_1D) {
2432
- image_view_type = VK_IMAGE_VIEW_TYPE_1D;
2433
- } else if (image->type == VK_IMAGE_TYPE_2D) {
2434
- image_view_type = VK_IMAGE_VIEW_TYPE_2D;
2435
- } else if (image->type == VK_IMAGE_TYPE_3D) {
2436
- image_view_type = VK_IMAGE_VIEW_TYPE_3D;
2437
- }
2438
- }
2439
-
2440
- VkImageAspectFlags aspect{};
2441
- if (image->format == VK_FORMAT_D16_UNORM ||
2442
- image->format == VK_FORMAT_D32_SFLOAT) {
2443
- aspect = VK_IMAGE_ASPECT_DEPTH_BIT;
2444
- } else if (image->format == VK_FORMAT_D16_UNORM_S8_UINT ||
2445
- image->format == VK_FORMAT_D24_UNORM_S8_UINT ||
2446
- image->format == VK_FORMAT_D32_SFLOAT_S8_UINT) {
2447
- aspect = VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT;
2448
- } else {
2449
- aspect = VK_IMAGE_ASPECT_COLOR_BIT;
2450
- }
2451
-
2452
2423
VkImageViewCreateInfo create_info{};
2453
2424
create_info.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
2454
2425
create_info.image = image->image ;
2455
- create_info.viewType = image_view_type ;
2426
+ create_info.viewType = VK_IMAGE_VIEW_TYPE_2D ;
2456
2427
create_info.format = image->format ;
2457
- create_info.subresourceRange .aspectMask = aspect;
2428
+ create_info.subresourceRange .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
2429
+ create_info.subresourceRange .baseMipLevel = 0 ;
2430
+ create_info.subresourceRange .levelCount = 1 ;
2431
+ create_info.subresourceRange .baseArrayLayer = 0 ;
2432
+ create_info.subresourceRange .layerCount = 1 ;
2458
2433
2459
2434
vkapi::IVkImageView view =
2460
2435
vkapi::create_image_view (device_->vk_device (), image, &create_info);
0 commit comments