diff --git a/src/main/java/com/github/hydos/ginger/VulkanStarter.java b/src/main/java/com/github/hydos/ginger/VulkanStarter.java index edc6286..629c3ac 100644 --- a/src/main/java/com/github/hydos/ginger/VulkanStarter.java +++ b/src/main/java/com/github/hydos/ginger/VulkanStarter.java @@ -1,10 +1,11 @@ package com.github.hydos.ginger; import org.lwjgl.glfw.GLFW; +import org.lwjgl.system.Configuration; import com.github.hydos.ginger.engine.common.info.RenderAPI; import com.github.hydos.ginger.engine.common.io.Window; -import com.github.hydos.ginger.engine.vulkan.api.*; +import com.github.hydos.ginger.engine.vulkan.api.GingerVK; /** @author hydos06 * the non ARR vulkan test example */ @@ -33,7 +34,7 @@ public class VulkanStarter } private void mainLoop() { - + while(!Window.closed()) { if(Window.shouldRender()) { Window.update(); @@ -52,7 +53,7 @@ public class VulkanStarter } public static void main(String[] args) { - + Configuration.DEBUG.set(true); BasicGinger2VulkanExample app = new BasicGinger2VulkanExample(); app.run(); diff --git a/src/main/java/com/github/hydos/ginger/engine/vulkan/render/Swapchain.java b/src/main/java/com/github/hydos/ginger/engine/vulkan/render/Swapchain.java index 6c7d4a3..ff50ad1 100644 --- a/src/main/java/com/github/hydos/ginger/engine/vulkan/render/Swapchain.java +++ b/src/main/java/com/github/hydos/ginger/engine/vulkan/render/Swapchain.java @@ -4,6 +4,7 @@ import java.nio.*; import java.util.*; import org.lwjgl.system.MemoryStack; +import org.lwjgl.system.MemoryUtil; import org.lwjgl.vulkan.*; import com.github.hydos.ginger.engine.common.io.Window; @@ -109,7 +110,7 @@ public class Swapchain imageCount.put(0, swapChainSupport.capabilities.maxImageCount()); } - VkSwapchainCreateInfoKHR createInfo = VkSwapchainCreateInfoKHR.callocStack(stack) + VkSwapchainCreateInfoKHR createInfo = VkSwapchainCreateInfoKHR.calloc() .sType(KHRSwapchain.VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR) .minImageCount(imageCount.get(0)) .imageFormat(surfaceFormat.format()) @@ -132,11 +133,18 @@ public class Swapchain createInfo.presentMode(presentMode); createInfo.clipped(true); - createInfo.oldSwapchain(VK12.VK_NULL_HANDLE); + createInfo.oldSwapchain(1); - LongBuffer pSwapChain = stack.longs(VK12.VK_NULL_HANDLE); + LongBuffer pSwapChain = MemoryUtil.memAllocLong(1); - 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)); }