Acces Violation Error when call vkGetDeviceQueue

Started by Matthew_VK, August 05, 2018, 21:49:49

Previous topic - Next topic

Matthew_VK

Hello Everyone! I've got a problem with creating VkQueue by call vkGetDeviceQueue(), I tried nvkGetDeviceQueue() too. When I run application I get error written to file, whitch contains this paste https://pastebin.com/hZpb3YfU . I tried to combine example code and mine, but still not works... My code: https://pastebin.com/WDC6sUNG I showed every function of my code but important are only initializeRenderer and createQueue. Don't pay attention on function names, they're temporary.

Ps. Wanted to add that I tried to update lwjgl libs, update Java, copy some of example code, restarting pc, reinstalling drivers and VulkanAPI.

spasi

The bug is in this line:

FloatBuffer pQueuePriorities = memAllocFloat(1).put(0.0f);


The put is relative, which increments the buffer's current position (from 0 to 1). The buffer is not flipped after that, so when it is passed to VkDeviceQueueCreateInfo::pQueuePriorities, its .remaining() is 0. That 0 is automatically written to the queueCount member. So you're effectively asking Vulkan to not create any queues, that's why vkGetDeviceQueue fails.

An absolute put fixes the issue:

FloatBuffer pQueuePriorities = memAllocFloat(1).put(0, 0.0f);

Matthew_VK

Wow, I didn't think that it can be the problem! Thank You very much Spasi, added .flip(); and works fine! Thank you very much!