diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/gltf.hpp | 2 | ||||
| -rw-r--r-- | include/vk-api.hpp | 2 | ||||
| -rw-r--r-- | include/vk-renderer.hpp | 14 |
3 files changed, 10 insertions, 8 deletions
diff --git a/include/gltf.hpp b/include/gltf.hpp index 59189d4..2f7377a 100644 --- a/include/gltf.hpp +++ b/include/gltf.hpp @@ -18,7 +18,7 @@ struct node { struct raw_image {
int32_t x;
int32_t y;
- int32_t n;
+ int32_t channels;
uint8_t *data;
};
diff --git a/include/vk-api.hpp b/include/vk-api.hpp index 2318eff..b50e751 100644 --- a/include/vk-api.hpp +++ b/include/vk-api.hpp @@ -115,7 +115,7 @@ class vkapi { handle create_buffer(size_t data_size, VkBufferUsageFlags buffer_usage, uint32_t mem_usage); void copy_buffer(VkCommandBuffer cmd_buf, handle src, handle dst, size_t size); - void copy_buffer(VkCommandBuffer cmd_buf, handle src, handle dst, off_t buffer_offset = 0); + void copy_buffer(VkCommandBuffer cmd_buf, handle src, handle dst, size_t size, size_t buffer_offset = 0); void destroy_buffer(handle buffer); diff --git a/include/vk-renderer.hpp b/include/vk-renderer.hpp index 614569a..6c6d2f0 100644 --- a/include/vk-renderer.hpp +++ b/include/vk-renderer.hpp @@ -124,20 +124,22 @@ class vkrenderer { class RingBuffer { public: - static const off_t invalid_alloc = -1; + static const size_t invalid_alloc = -1; RingBuffer(size_t size); - [[nodiscard]]off_t alloc(size_t alloc_size) const { - assert(alloc_size > 0); + [[nodiscard]]size_t alloc(size_t alloc_size) { + assert(alloc_size > 0 && alloc_size <= buffer_size); - if (ptr + alloc_size < buffer_size) { + if (ptr <= buffer_size - alloc_size) { + ptr += alloc_size; return ptr; } + return invalid_alloc; } - void write(void* data, off_t alloc_offset, size_t data_size) const { + void write(void* data, size_t alloc_offset, size_t data_size) const { auto api_buffer = vkrenderer::api.get_buffer(device_buffer); std::memcpy((uint8_t*)api_buffer.device_ptr + alloc_offset, data, data_size); @@ -150,7 +152,7 @@ class RingBuffer { handle device_buffer; size_t buffer_size; - off_t ptr = 0; + size_t ptr = 0; }; class Sampler { |
