From 118d68a64ef5d2f81a41bdc84bfe59ce056aa947 Mon Sep 17 00:00:00 2001 From: halotroop2288 Date: Wed, 4 Mar 2020 12:17:52 -0800 Subject: [PATCH] Nice capitalization. --- .classpath | 11 ++---- .../github/hydos/ginger/VulkanStarter.java | 4 +-- .../ginger/engine/vulkan/VKConstants.java | 2 +- .../ginger/engine/vulkan/api/GingerVK.java | 16 ++++----- .../ginger/engine/vulkan/io/VkWindow.java | 10 +++--- .../ginger/engine/vulkan/utils/VKUtils.java | 34 +++++++++---------- 6 files changed, 34 insertions(+), 43 deletions(-) diff --git a/.classpath b/.classpath index a93fc90..6c19c79 100644 --- a/.classpath +++ b/.classpath @@ -1,6 +1,6 @@ - + @@ -16,18 +16,11 @@ - + - - - - - - - diff --git a/src/main/java/com/github/hydos/ginger/VulkanStarter.java b/src/main/java/com/github/hydos/ginger/VulkanStarter.java index 2470024..f5b6734 100644 --- a/src/main/java/com/github/hydos/ginger/VulkanStarter.java +++ b/src/main/java/com/github/hydos/ginger/VulkanStarter.java @@ -4,7 +4,7 @@ import org.lwjgl.glfw.GLFW; 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.GingerVk; +import com.github.hydos.ginger.engine.vulkan.api.*; /** @author hydos06 * the non ARR vulkan test example */ @@ -29,7 +29,7 @@ public class VulkanStarter } private void initVulkan() { - new GingerVk().start("Vulkan demo"); + new GingerVK().start("Vulkan demo"); } private void mainLoop() { diff --git a/src/main/java/com/github/hydos/ginger/engine/vulkan/VKConstants.java b/src/main/java/com/github/hydos/ginger/engine/vulkan/VKConstants.java index 9cc0d63..0dca3b0 100644 --- a/src/main/java/com/github/hydos/ginger/engine/vulkan/VKConstants.java +++ b/src/main/java/com/github/hydos/ginger/engine/vulkan/VKConstants.java @@ -2,7 +2,7 @@ package com.github.hydos.ginger.engine.vulkan; import org.lwjgl.vulkan.*; -public class VkConstants +public class VKConstants { public static VkInstance vulkanInstance; diff --git a/src/main/java/com/github/hydos/ginger/engine/vulkan/api/GingerVK.java b/src/main/java/com/github/hydos/ginger/engine/vulkan/api/GingerVK.java index e2923b8..75cd493 100644 --- a/src/main/java/com/github/hydos/ginger/engine/vulkan/api/GingerVK.java +++ b/src/main/java/com/github/hydos/ginger/engine/vulkan/api/GingerVK.java @@ -1,18 +1,16 @@ package com.github.hydos.ginger.engine.vulkan.api; import com.github.hydos.ginger.engine.vulkan.io.VkWindow; -import com.github.hydos.ginger.engine.vulkan.utils.VkUtils; +import com.github.hydos.ginger.engine.vulkan.utils.VKUtils; -public class GingerVk +public class GingerVK { - - public void start(String gameName) { + public void start(String gameName) + { System.out.println("Game " + gameName + " successfuly started in Vulkan mode."); - VkUtils.createInstance(); + VKUtils.createInstance(); VkWindow.createSurface(); - VkUtils.createPhysicalDevice(); - VkUtils.createLogicalDevice(); + VKUtils.createPhysicalDevice(); + VKUtils.createLogicalDevice(); } - - } diff --git a/src/main/java/com/github/hydos/ginger/engine/vulkan/io/VkWindow.java b/src/main/java/com/github/hydos/ginger/engine/vulkan/io/VkWindow.java index f54b79c..7b60e6d 100644 --- a/src/main/java/com/github/hydos/ginger/engine/vulkan/io/VkWindow.java +++ b/src/main/java/com/github/hydos/ginger/engine/vulkan/io/VkWindow.java @@ -7,8 +7,8 @@ import org.lwjgl.system.MemoryStack; import org.lwjgl.vulkan.VK12; import com.github.hydos.ginger.engine.common.io.Window; -import com.github.hydos.ginger.engine.vulkan.VkConstants; -import com.github.hydos.ginger.engine.vulkan.utils.VkUtils; +import com.github.hydos.ginger.engine.vulkan.VKConstants; +import com.github.hydos.ginger.engine.vulkan.utils.*; /** * used for window related vulkan only things @@ -23,13 +23,13 @@ public class VkWindow { LongBuffer pSurface = stack.longs(VK12.VK_NULL_HANDLE); - int status = GLFWVulkan.glfwCreateWindowSurface(VkConstants.vulkanInstance, Window.getWindow(), null, pSurface); + int status = GLFWVulkan.glfwCreateWindowSurface(VKConstants.vulkanInstance, Window.getWindow(), null, pSurface); if(status != VK12.VK_SUCCESS) { - throw new VulkanException("Failed to create vulkan surface for window reason: " + VkUtils.translateVulkanResult(status)); + throw new VulkanException("Failed to create vulkan surface for window reason: " + VKUtils.translateVulkanResult(status)); } - VkConstants.windowSurface = pSurface.get(0); + VKConstants.windowSurface = pSurface.get(0); } } } diff --git a/src/main/java/com/github/hydos/ginger/engine/vulkan/utils/VKUtils.java b/src/main/java/com/github/hydos/ginger/engine/vulkan/utils/VKUtils.java index f18fbd1..2d0c155 100644 --- a/src/main/java/com/github/hydos/ginger/engine/vulkan/utils/VKUtils.java +++ b/src/main/java/com/github/hydos/ginger/engine/vulkan/utils/VKUtils.java @@ -8,9 +8,9 @@ import org.lwjgl.glfw.*; import org.lwjgl.system.MemoryStack; import org.lwjgl.vulkan.*; -import com.github.hydos.ginger.engine.vulkan.VkConstants; +import com.github.hydos.ginger.engine.vulkan.VKConstants; -public class VkUtils +public class VKUtils { private static PointerBuffer getRequiredExtensions() { @@ -50,7 +50,7 @@ public class VkUtils throw new RuntimeException("Failed to create instance"); } - VkConstants.vulkanInstance = new VkInstance(instancePtr.get(0), createInfo); + VKConstants.vulkanInstance = new VkInstance(instancePtr.get(0), createInfo); } } @@ -59,7 +59,7 @@ public class VkUtils IntBuffer deviceCount = stack.ints(0); - VK12.vkEnumeratePhysicalDevices(VkConstants.vulkanInstance, deviceCount, null); + VK12.vkEnumeratePhysicalDevices(VKConstants.vulkanInstance, deviceCount, null); if(deviceCount.get(0) == 0) { throw new RuntimeException("Failed to find GPUs with Vulkan support"); @@ -67,13 +67,13 @@ public class VkUtils PointerBuffer ppPhysicalDevices = stack.mallocPointer(deviceCount.get(0)); - VK12.vkEnumeratePhysicalDevices(VkConstants.vulkanInstance, deviceCount, ppPhysicalDevices); + VK12.vkEnumeratePhysicalDevices(VKConstants.vulkanInstance, deviceCount, ppPhysicalDevices); VkPhysicalDevice device = null; for(int i = 0;i < ppPhysicalDevices.capacity();i++) { - device = new VkPhysicalDevice(ppPhysicalDevices.get(i), VkConstants.vulkanInstance); + device = new VkPhysicalDevice(ppPhysicalDevices.get(i), VKConstants.vulkanInstance); } @@ -81,7 +81,7 @@ public class VkUtils throw new RuntimeException("Failed to find a suitable GPU"); } - VkConstants.physicalDevice = device; + VKConstants.physicalDevice = device; } } @@ -129,19 +129,19 @@ public class VkUtils PointerBuffer pDevice = stack.pointers(VK12.VK_NULL_HANDLE); - if(VK12.vkCreateDevice(VkConstants.physicalDevice, createInfo, null, pDevice) != VK12.VK_SUCCESS) { + if(VK12.vkCreateDevice(VKConstants.physicalDevice, createInfo, null, pDevice) != VK12.VK_SUCCESS) { throw new RuntimeException("Failed to create logical device"); } - VkConstants.device = new VkDevice(pDevice.get(0), VkConstants.physicalDevice, createInfo); + VKConstants.device = new VkDevice(pDevice.get(0), VKConstants.physicalDevice, createInfo); PointerBuffer pQueue = stack.pointers(VK12.VK_NULL_HANDLE); - VK12.vkGetDeviceQueue(VkConstants.device, indices.graphicsFamily, 0, pQueue); - VkConstants.graphicsQueue = new VkQueue(pQueue.get(0), VkConstants.device); + VK12.vkGetDeviceQueue(VKConstants.device, indices.graphicsFamily, 0, pQueue); + VKConstants.graphicsQueue = new VkQueue(pQueue.get(0), VKConstants.device); - VK12.vkGetDeviceQueue(VkConstants.device, indices.presentFamily, 0, pQueue); - VkConstants.presentQueue = new VkQueue(pQueue.get(0), VkConstants.device); + VK12.vkGetDeviceQueue(VKConstants.device, indices.presentFamily, 0, pQueue); + VKConstants.presentQueue = new VkQueue(pQueue.get(0), VKConstants.device); } } @@ -153,11 +153,11 @@ public class VkUtils IntBuffer queueFamilyCount = stack.ints(0); - VK12.vkGetPhysicalDeviceQueueFamilyProperties(VkConstants.physicalDevice, queueFamilyCount, null); + VK12.vkGetPhysicalDeviceQueueFamilyProperties(VKConstants.physicalDevice, queueFamilyCount, null); VkQueueFamilyProperties.Buffer queueFamilies = VkQueueFamilyProperties.mallocStack(queueFamilyCount.get(0), stack); - VK12.vkGetPhysicalDeviceQueueFamilyProperties(VkConstants.physicalDevice, queueFamilyCount, queueFamilies); + VK12.vkGetPhysicalDeviceQueueFamilyProperties(VKConstants.physicalDevice, queueFamilyCount, queueFamilies); IntBuffer presentSupport = stack.ints(VK12.VK_FALSE); @@ -168,8 +168,8 @@ public class VkUtils } KHRSurface.vkGetPhysicalDeviceSurfaceSupportKHR( - VkConstants.physicalDevice, - i, VkConstants.windowSurface, + VKConstants.physicalDevice, + i, VKConstants.windowSurface, presentSupport); if(presentSupport.get(0) == VK12.VK_TRUE) {