Add README.md + Check possible error on Surface.java

This commit is contained in:
Florian RICHER 2025-05-19 23:31:13 +02:00
parent cb0fa04383
commit 2dee61f8e0
Signed by: florian.richer
GPG key ID: C73D37CBED7BFC77
2 changed files with 13 additions and 2 deletions

View file

@ -18,4 +18,9 @@ mvn exec:java
```console
mvn package
```
```
## Usefull links
- https://vulkan-tutorial.com/fr/Introduction
- https://github.com/Naitsirc98/Vulkan-Tutorial-Java/tree/master

View file

@ -3,6 +3,7 @@ package fr.mrdev023.vulkan_java.renderer;
import org.lwjgl.glfw.GLFWVulkan;
import org.lwjgl.system.MemoryStack;
import org.lwjgl.vulkan.KHRSurface;
import org.lwjgl.vulkan.VK10;
import org.tinylog.Logger;
import java.nio.LongBuffer;
@ -17,8 +18,13 @@ public class Surface {
this.physicalDevice = physicalDevice;
try (MemoryStack stack = MemoryStack.stackPush()) {
LongBuffer pSurface = stack.mallocLong(1);
GLFWVulkan.glfwCreateWindowSurface(this.physicalDevice.getVkPhysicalDevice().getInstance(), windowHandle,
var result = GLFWVulkan.glfwCreateWindowSurface(this.physicalDevice.getVkPhysicalDevice().getInstance(), windowHandle,
null, pSurface);
if (result != VK10.VK_SUCCESS) {
throw new RuntimeException("Failed to create Vulkan surface");
}
vkSurface = pSurface.get(0);
}
}