can someone do research and figure out why the swapchain is broken while im gone

liteCraft
hYdos 2020-03-05 08:08:36 +10:00
parent 4bb3409cef
commit adfdfccd64
2 changed files with 11 additions and 14 deletions

View File

@ -2,6 +2,7 @@ package com.github.hydos.ginger.engine.vulkan.api;
import com.github.hydos.ginger.engine.vulkan.io.VKWindow;
import com.github.hydos.ginger.engine.vulkan.render.Swapchain;
import com.github.hydos.ginger.engine.vulkan.utils.VKUtils;
public class GingerVK
@ -13,5 +14,6 @@ public class GingerVK
VKWindow.createSurface();
VKUtils.createPhysicalDevice();
VKUtils.createLogicalDevice();
Swapchain.createSwapChain();
}
}

View File

@ -109,18 +109,14 @@ public class Swapchain
imageCount.put(0, swapChainSupport.capabilities.maxImageCount());
}
VkSwapchainCreateInfoKHR createInfo = VkSwapchainCreateInfoKHR.callocStack(stack);
createInfo.sType(KHRSwapchain.VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR);
createInfo.surface(VKConstants.windowSurface);
// Image settings
createInfo.minImageCount(imageCount.get(0));
createInfo.imageFormat(surfaceFormat.format());
createInfo.imageColorSpace(surfaceFormat.colorSpace());
createInfo.imageExtent(extent);
createInfo.imageArrayLayers(1);
createInfo.imageUsage(VK12.VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT);
VkSwapchainCreateInfoKHR createInfo = VkSwapchainCreateInfoKHR.callocStack(stack)
.sType(KHRSwapchain.VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR)
.minImageCount(imageCount.get(0))
.imageFormat(surfaceFormat.format())
.imageColorSpace(surfaceFormat.colorSpace())
.imageExtent(extent)
.imageArrayLayers(1)
.imageUsage(VK12.VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT);
QueueFamilyIndices indices = VKUtils.findQueueFamilies();
@ -140,8 +136,7 @@ public class Swapchain
LongBuffer pSwapChain = stack.longs(VK12.VK_NULL_HANDLE);
int result = KHRSwapchain.vkCreateSwapchainKHR(
VKConstants.device, createInfo, null, pSwapChain);
int result = KHRSwapchain.vkCreateSwapchainKHR(VKConstants.device, createInfo, null, pSwapChain);
if(result != VK12.VK_SUCCESS) {
throw new RuntimeException("Failed to create swap chain reason: " + VKUtils.translateVulkanResult(result));
}