little memory related changes.

This commit is contained in:
David Carlier 2022-07-11 21:00:58 +01:00
parent 29c0fd21cc
commit d147aa10c3
2 changed files with 3 additions and 4 deletions

View file

@ -63,8 +63,7 @@ vulkan_memory_init(void)
{
memory_block_threshold = MEMORY_THRESHOLD;
used_memory_size = 1024; // Size of buffers history
used_memory = malloc(used_memory_size * sizeof(MemoryResource_t));
memset(used_memory, 0, used_memory_size * sizeof(MemoryResource_t));
used_memory = calloc(used_memory_size, sizeof(MemoryResource_t));
}
static void
@ -345,7 +344,7 @@ memory_create(VkDeviceSize size,
VkDeviceSize new_size = ROUNDUP(size, used_memory[pos].alignment);
// split to several blocks
memcpy(&used_memory[new_pos], &used_memory[pos], sizeof(MemoryResource_t));
memmove(&used_memory[new_pos], &used_memory[pos], sizeof(MemoryResource_t));
used_memory[new_pos].offset = used_memory[pos].offset + new_size;
used_memory[new_pos].size = used_memory[pos].size - new_size;

View file

@ -148,7 +148,7 @@ static void SubdividePolygon (int numverts, float *verts)
poly->verts[0][4] = total_t/numverts;
// copy first vertex to last
memcpy (poly->verts[i+1], poly->verts[1], sizeof(poly->verts[0]));
memmove (poly->verts[i+1], poly->verts[1], sizeof(poly->verts[0]));
}
/*