Hello Guest

Acces Violation Error when call vkGetDeviceQueue

  • 2 Replies
  • 612 Views
Acces Violation Error when call vkGetDeviceQueue
« on: August 05, 2018, 21:49:49 »
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.

*

Offline spasi

  • *****
  • 2054
    • WebHotelier
Re: Acces Violation Error when call vkGetDeviceQueue
« Reply #1 on: August 05, 2018, 22:48:55 »
The bug is in this line:

Code: [Select]
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:

Code: [Select]
FloatBuffer pQueuePriorities = memAllocFloat(1).put(0, 0.0f);

Re: Acces Violation Error when call vkGetDeviceQueue
« Reply #2 on: August 06, 2018, 07:02:30 »
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!