You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First discovered as I was creating a staging buffer for vertex data:
MemoryStack.stackPush().use {
val bufferCreateInfo = VkBufferCreateInfo.callocStack(it)
.sType(VK10.VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO)
.size(4L * 2L * 3L) // vertex buffer for a triangle of vec2
.usage(VK10.VK_BUFFER_USAGE_TRANSFER_SRC_BIT)
val allocationCreateInfo = VmaAllocationCreateInfo.callocStack(it)
.usage(Vma.VMA_MEMORY_USAGE_CPU_ONLY)
val buffer = it.mallocLong(1)
val allocation = it.mallocPointer(1)
val allocationInfo = VmaAllocationInfo.mallocStack(it)
Vma.vmaCreateBuffer(allocator, bufferCreateInfo, allocationCreateInfo, buffer, allocation, allocationInfo)
.takeUnless { result -> result == VK10.VK_SUCCESS }
?.also { throw IllegalStateException("Failed to create buffer: $this") }
val mapping = it.mallocPointer(1)
Vma.vmaMapMemory(allocator, allocation[0], mapping)
.takeUnless { result -> result == VK10.VK_SUCCESS }
?.also { throw IllegalStateException("Failed to map buffer: $this") }
}
Validation layers report:
[ERROR|VALIDATION] Mapping Memory without VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT set: mem obj 0x13. The Vulkan spec states: memory must have been created with a memory type that reports VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT (https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-vkMapMemory-memory-00682)
And the IllegalStateException is thrown: Failed to map buffer: -5 which is the error code for ERROR_MEMORY_MAP_FAILED.
Inspecting allocationInfo shows that the memory type only supports VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, and not VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT as "guaranteed" by Vma.VMA_MEMORY_USAGE_CPU_ONLY.
Simply hard-coding allocationCreateInfo.usage(2) resolves the issue.
The text was updated successfully, but these errors were encountered:
Environment
3.2.1
12
Oracle JDK 1.8.0_212
Linux (Fedora 29) / macOS (Mojave) / Windows 10
lwjgl-vma
Intel Core i5-4690K
NVIDIA GeForce GTX 980
Description
In https://github.com/LWJGL/lwjgl3/blob/master/modules/lwjgl/vma/src/main/c/vk_mem_alloc.h the values are declared as:
But in https://github.com/LWJGL/lwjgl3/blob/master/modules/lwjgl/vma/src/generated/java/org/lwjgl/util/vma/Vma.java the values are:
Reproducing (Kotlin)
First discovered as I was creating a staging buffer for vertex data:
Validation layers report:
And the IllegalStateException is thrown:
Failed to map buffer: -5
which is the error code forERROR_MEMORY_MAP_FAILED
.Inspecting
allocationInfo
shows that the memory type only supportsVK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT
, and notVK_MEMORY_PROPERTY_HOST_VISIBLE_BIT
as "guaranteed" byVma.VMA_MEMORY_USAGE_CPU_ONLY
.Simply hard-coding
allocationCreateInfo.usage(2)
resolves the issue.The text was updated successfully, but these errors were encountered: