From 05350a93320e5457d93bea321c0b7422efcb7326 Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Sat, 13 Jan 2024 23:39:58 -0800 Subject: [PATCH] UBO offsets should respect alignment --- src/Refresh_Driver_Vulkan.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Refresh_Driver_Vulkan.c b/src/Refresh_Driver_Vulkan.c index 36250e3..9c78167 100644 --- a/src/Refresh_Driver_Vulkan.c +++ b/src/Refresh_Driver_Vulkan.c @@ -79,8 +79,8 @@ typedef struct VulkanExtensions #define ALLOCATION_INCREMENT 16000000 /* 16MB */ #define TRANSFER_BUFFER_STARTING_SIZE 8000000 /* 8MB */ #define POOLED_TRANSFER_BUFFER_SIZE 16000000 /* 16MB */ -#define UBO_BUFFER_SIZE 16000000 /* 16MB */ -#define UBO_SECTION_SIZE 4000 /* 4KB */ +#define UBO_BUFFER_SIZE 1048576 /* 16MB */ +#define UBO_SECTION_SIZE 4096 /* 4KB */ #define DESCRIPTOR_POOL_STARTING_SIZE 128 #define DEFRAG_TIME 200 #define WINDOW_DATA "Refresh_VulkanWindowData" @@ -4345,7 +4345,7 @@ static uint8_t VULKAN_INTERNAL_CreateUniformBuffer( uniformBuffer->poolOffset = bufferPool->nextAvailableOffset; uniformBuffer->offset = 0; - bufferPool->nextAvailableOffset += UBO_SECTION_SIZE; + bufferPool->nextAvailableOffset += VULKAN_INTERNAL_NextHighestAlignment(UBO_SECTION_SIZE, renderer->minUBOAlignment); if (bufferPool->nextAvailableOffset >= UBO_BUFFER_SIZE) {