Skip to content

Commit edfc68a

Browse files
authored
Fix hello_triangle for macOS AMD: change VMA to request host coherent memory (KhronosGroup#1352)
* Fix hello_triangle for macOS AMD: change VMA usage flag to auto_prefer_host * Update VMA allocation to use Auto but require Host Coherent memory
1 parent 6b7c69c commit edfc68a

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

samples/api/hello_triangle/hello_triangle.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,9 @@ void HelloTriangle::init_vertex_buffer()
401401
// We use the Vulkan Memory Allocator to find a memory type that can be written and mapped from the host
402402
// On most setups this will return a memory type that resides in VRAM and is accessible from the host
403403
VmaAllocationCreateInfo buffer_alloc_ci{
404-
.flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT | VMA_ALLOCATION_CREATE_MAPPED_BIT,
405-
.usage = VMA_MEMORY_USAGE_AUTO};
404+
.flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT | VMA_ALLOCATION_CREATE_MAPPED_BIT,
405+
.usage = VMA_MEMORY_USAGE_AUTO,
406+
.requiredFlags = VK_MEMORY_PROPERTY_HOST_COHERENT_BIT};
406407

407408
VmaAllocationInfo buffer_alloc_info{};
408409
vmaCreateBuffer(context.vma_allocator, &buffer_info, &buffer_alloc_ci, &vertex_buffer, &vertex_buffer_allocation, &buffer_alloc_info);

0 commit comments

Comments
 (0)