From 61bdec035795048682cdcf3c59be0ed19827a7d9 Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Fri, 18 Dec 2020 17:32:27 -0800 Subject: [PATCH] GenVertexBuffer and GenIndexBuffer --- src/Refresh_Driver_Vulkan.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/Refresh_Driver_Vulkan.c b/src/Refresh_Driver_Vulkan.c index ecf3b9c..162feec 100644 --- a/src/Refresh_Driver_Vulkan.c +++ b/src/Refresh_Driver_Vulkan.c @@ -2931,14 +2931,40 @@ static REFRESH_Buffer* VULKAN_GenVertexBuffer( REFRESH_Renderer *driverData, uint32_t sizeInBytes ) { - SDL_assert(0); + VulkanBuffer *buffer = (VulkanBuffer*) SDL_malloc(sizeof(VulkanBuffer)); + + if(!VULKAN_INTERNAL_CreateBuffer( + (VulkanRenderer*) driverData, + sizeInBytes, + RESOURCE_ACCESS_VERTEX_BUFFER, + VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, + buffer + )) { + REFRESH_LogError("Failed to create vertex buffer!"); + return NULL; + } + + return (REFRESH_Buffer*) buffer; } static REFRESH_Buffer* VULKAN_GenIndexBuffer( REFRESH_Renderer *driverData, uint32_t sizeInBytes ) { - SDL_assert(0); + VulkanBuffer *buffer = (VulkanBuffer*) SDL_malloc(sizeof(VulkanBuffer)); + + if (!VULKAN_INTERNAL_CreateBuffer( + (VulkanRenderer*) driverData, + sizeInBytes, + RESOURCE_ACCESS_INDEX_BUFFER, + VK_BUFFER_USAGE_INDEX_BUFFER_BIT, + buffer + )) { + REFRESH_LogError("Failed to create index buffer!"); + return NULL; + } + + return (REFRESH_Buffer*) buffer; } static REFRESH_Buffer* VULKAN_GenShaderParamBuffer(