From 15069341c7c8c36c7371ea1de4b63ed52034b3a8 Mon Sep 17 00:00:00 2001 From: ladevieq Date: Mon, 12 Sep 2022 22:04:54 +0200 Subject: Fix texture uploading bug --- include/gltf.hpp | 4 ++-- include/vk-renderer.hpp | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/gltf.hpp b/include/gltf.hpp index 2f7377a..6e89509 100644 --- a/include/gltf.hpp +++ b/include/gltf.hpp @@ -16,8 +16,8 @@ struct node { }; struct raw_image { - int32_t x; - int32_t y; + int32_t width; + int32_t height; int32_t channels; uint8_t *data; }; diff --git a/include/vk-renderer.hpp b/include/vk-renderer.hpp index 6c6d2f0..ab15cd1 100644 --- a/include/vk-renderer.hpp +++ b/include/vk-renderer.hpp @@ -131,9 +131,11 @@ class RingBuffer { [[nodiscard]]size_t alloc(size_t alloc_size) { assert(alloc_size > 0 && alloc_size <= buffer_size); - if (ptr <= buffer_size - alloc_size) { + auto alloc_offset = ptr; + + if (alloc_offset <= buffer_size - alloc_size) { ptr += alloc_size; - return ptr; + return alloc_offset; } return invalid_alloc; -- cgit v1.3