Skip to content

Commit

Permalink
Fix misc crashes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Themaister committed Dec 11, 2023
1 parent ba5c537 commit fc4f84d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion util/arena_allocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ void SliceAllocator::free(const Util::AllocatedSlice &slice)
{
if (slice.alloc)
slice.alloc->free(slice.heap, slice.mask);
else
else if (slice.buffer_index != UINT32_MAX)
global_allocator->free(slice.buffer_index);
}

Expand Down
2 changes: 1 addition & 1 deletion util/arena_allocator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ struct SliceSubAllocator;

struct AllocatedSlice
{
uint32_t buffer_index = 0;
uint32_t buffer_index = UINT32_MAX;
uint32_t offset = 0;
uint32_t count = 0;
uint32_t mask = 0;
Expand Down
2 changes: 1 addition & 1 deletion vulkan/managers/resource_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ void MeshGlobalAllocator::free(uint32_t index)
VK_ASSERT(index < global_buffers.size());
for (uint32_t i = 0; i < soa_count; i++)
{
std::swap(preallocated[i], global_buffers[index + 1]);
std::swap(preallocated[i], global_buffers[index + i]);
global_buffers[index + i].reset();
}
}
Expand Down

0 comments on commit fc4f84d

Please sign in to comment.