Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/sysgpu/vulkan.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3558,7 +3558,19 @@ const MemoryAllocator = struct {
const heap_size = mem_heaps[mem_type.heap_index].size;
const candidate = switch (mem_kind) {
.lazily_allocated => flags.lazily_allocated_bit,
.linear_write_mappable => flags.host_visible_bit and flags.host_coherent_bit and !flags.device_coherent_bit_amd,
.linear_write_mappable => blk: {
if (flags.host_visible_bit and flags.host_coherent_bit and !flags.device_coherent_bit_amd) {
if (best_type) |best| {
const best_heap_size = mem_heaps[mem_types[best].heap_index].size;
if (heap_size > best_heap_size) {
break :blk true;
}
break :blk false;
}
break :blk true;
}
break :blk false;
},
.linear_read_mappable => blk: {
if (flags.host_visible_bit and flags.host_coherent_bit and !flags.device_coherent_bit_amd) {
if (best_type) |best| {
Expand All @@ -3584,7 +3596,7 @@ const MemoryAllocator = struct {
if (mem_types[best].property_flags.device_local_bit) {
if (flags.device_local_bit and !flags.device_coherent_bit_amd) {
const best_heap_size = mem_heaps[mem_types[best].heap_index].size;
if (heap_size > best_heap_size or flags.host_visible_bit) {
if (heap_size > best_heap_size) {
break :blk true;
}
}
Expand Down