projects
/
demo
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
buffer allocation
[demo]
/
src
/
vulkan
/
allocator.cc
diff --git
a/src/vulkan/allocator.cc
b/src/vulkan/allocator.cc
index
5228a72
..
9d71e9b
100644
(file)
--- a/
src/vulkan/allocator.cc
+++ b/
src/vulkan/allocator.cc
@@
-5,7
+5,7
@@
#include "vk.h"
#include "vkutil.h"
#include "vk.h"
#include "vkutil.h"
-VkDeviceMemory vk_allocate(int size)
+bool vku_allocate(int size, DevMemBlock *block)
{
VkDeviceMemory gpu_mem;
{
VkDeviceMemory gpu_mem;
@@
-15,9
+15,13
@@
VkDeviceMemory vk_allocate(int size)
gpu_alloc_inf.allocationSize = size;
if(vkAllocateMemory(vk_device, &gpu_alloc_inf, 0, &gpu_mem) != VK_SUCCESS) {
gpu_alloc_inf.allocationSize = size;
if(vkAllocateMemory(vk_device, &gpu_alloc_inf, 0, &gpu_mem) != VK_SUCCESS) {
- fprintf(stderr, "Failed to allocate device memory, mem size: %d\n");
- return 0;
+ fprintf(stderr, "Failed to allocate device memory, mem size: %d\n", size);
+ return false;
}
}
- return gpu_mem;
+ block->dev_mem = gpu_mem;
+ block->offset = 0;
+ block->size = size;
+
+ return true;
}
}