-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VK renderer backend causes NPE #114
Labels
type: bug
Something isn't working
Comments
See |
这是一个暂时性的修复: .../graphics/vulkan/VulkanMemoryAllocator.java | 22 +++++++++++++++++++++-
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/graphics/src/main/java/engine/graphics/vulkan/VulkanMemoryAllocator.java b/graphics/src/main/java/engine/graphics/vulkan/VulkanMemoryAllocator.java
index 3da57c7..b238a13 100644
--- a/graphics/src/main/java/engine/graphics/vulkan/VulkanMemoryAllocator.java
+++ b/graphics/src/main/java/engine/graphics/vulkan/VulkanMemoryAllocator.java
@@ -6,6 +6,8 @@ import org.lwjgl.system.MemoryStack;
import org.lwjgl.util.vma.Vma;
import org.lwjgl.util.vma.VmaAllocationCreateInfo;
import org.lwjgl.util.vma.VmaAllocatorCreateInfo;
+import org.lwjgl.util.vma.VmaVulkanFunctions;
+import org.lwjgl.vulkan.VK;
import org.lwjgl.vulkan.VK10;
import org.lwjgl.vulkan.VkBufferCreateInfo;
@@ -28,7 +30,25 @@ public class VulkanMemoryAllocator {
try(var stack = MemoryStack.stackPush()){
var info = VmaAllocatorCreateInfo.callocStack(stack)
.physicalDevice(device.getPhysicalDevice().getNativePhysicalDevice())
- .device(device.getNativeDevice());
+ .device(device.getNativeDevice())
+ .pVulkanFunctions(VmaVulkanFunctions.callocStack(stack)
+ .vkGetPhysicalDeviceProperties(VK10.vkGetInstanceProcAddr(device.getNativeDevice().getPhysicalDevice().getInstance(), stack.ASCII("vkGetPhysicalDeviceProperties")))
+ .vkGetPhysicalDeviceMemoryProperties(VK10.vkGetInstanceProcAddr(device.getNativeDevice().getPhysicalDevice().getInstance(),stack.ASCII("vkGetPhysicalDeviceMemoryProperties")))
+ .vkAllocateMemory(VK10.vkGetDeviceProcAddr(device.getNativeDevice(),stack.ASCII("vkAllocateMemory")))
+ .vkFreeMemory(VK10.vkGetDeviceProcAddr(device.getNativeDevice(),stack.ASCII("vkFreeMemory")))
+ .vkMapMemory(VK10.vkGetDeviceProcAddr(device.getNativeDevice(),stack.ASCII("vkMapMemory")))
+ .vkUnmapMemory(VK10.vkGetDeviceProcAddr(device.getNativeDevice(),stack.ASCII("vkUnmapMemory")))
+ .vkFlushMappedMemoryRanges(VK10.vkGetDeviceProcAddr(device.getNativeDevice(),stack.ASCII("vkFlushMappedMemoryRanges")))
+ .vkInvalidateMappedMemoryRanges(VK10.vkGetDeviceProcAddr(device.getNativeDevice(),stack.ASCII("vkInvalidateMappedMemoryRanges")))
+ .vkBindBufferMemory(VK10.vkGetDeviceProcAddr(device.getNativeDevice(),stack.ASCII("vkBindBufferMemory")))
+ .vkBindImageMemory(VK10.vkGetDeviceProcAddr(device.getNativeDevice(),stack.ASCII("vkBindImageMemory")))
+ .vkGetBufferMemoryRequirements(VK10.vkGetDeviceProcAddr(device.getNativeDevice(),stack.ASCII("vkGetBufferMemoryRequirements")))
+ .vkGetImageMemoryRequirements(VK10.vkGetDeviceProcAddr(device.getNativeDevice(),stack.ASCII("vkGetImageMemoryRequirements")))
+ .vkCreateBuffer(VK10.vkGetDeviceProcAddr(device.getNativeDevice(),stack.ASCII("vkCreateBuffer")))
+ .vkDestroyBuffer(VK10.vkGetDeviceProcAddr(device.getNativeDevice(),stack.ASCII("vkDestroyBuffer")))
+ .vkCreateImage(VK10.vkGetDeviceProcAddr(device.getNativeDevice(),stack.ASCII("vkCreateImage")))
+ .vkDestroyImage(VK10.vkGetDeviceProcAddr(device.getNativeDevice(),stack.ASCII("vkDestroyImage")))
+ .vkCmdCopyBuffer(VK10.vkGetDeviceProcAddr(device.getNativeDevice(),stack.ASCII("vkCmdCopyBuffer"))));
var ptr = stack.mallocPointer(1);
var err = Vma.vmaCreateAllocator(info, ptr);
if(err != VK_SUCCESS){
@mouse0w0
|
这咋整啊 |
修啊(((( |
Vulkan实现的维护者是@cvrunmin,现在这个光荣的任务就交给你们了。 |
I think you need those last 2 lines of code. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Log:
Crash report:
Here is the patch to enable VK backend:
The text was updated successfully, but these errors were encountered: