add lwjgl debug stuff

liteCraft
hayden v 2020-03-05 10:39:48 +10:00
parent adfdfccd64
commit 14db9b4a22
2 changed files with 16 additions and 7 deletions

View File

@ -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();

View File

@ -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));
}