[vulkan] Use only one global staging buffer

I think I did two as a bit of a ring buffer, but the new ring buffer
system used inside a staging buffer makes it less necessary. Also, the
staging buffer is now a fair bit bigger (4M is probably not really
enough)
This commit is contained in:
Bill Currie 2021-01-16 14:37:16 +09:00
parent 92afe9f265
commit 904a91c0b7
2 changed files with 4 additions and 7 deletions

View file

@ -68,7 +68,7 @@ typedef struct vulkan_ctx_s {
VkCommandBuffer cmdbuffer;
VkFence fence; // for ctx->cmdbuffer only
vulkan_renderpass_t renderpass;
struct qfv_stagebuf_s *staging[2];
struct qfv_stagebuf_s *staging;
VkPipeline pipeline;
size_t curFrame;
vulkan_framebufferset_t framebuffers;

View file

@ -174,8 +174,7 @@ Vulkan_Shutdown_Common (vulkan_ctx_t *ctx)
if (ctx->swapchain) {
QFV_DestroySwapchain (ctx->swapchain);
}
QFV_DestroyStagingBuffer (ctx->staging[0]);
QFV_DestroyStagingBuffer (ctx->staging[1]);
QFV_DestroyStagingBuffer (ctx->staging);
Vulkan_DestroyMatrices (ctx);
ctx->instance->funcs->vkDestroySurfaceKHR (ctx->instance->instance,
ctx->surface, 0);
@ -203,10 +202,8 @@ Vulkan_CreateDevice (vulkan_ctx_t *ctx)
void
Vulkan_CreateStagingBuffers (vulkan_ctx_t *ctx)
{
ctx->staging[0] = QFV_CreateStagingBuffer (ctx->device, 1024*1024, 1,
ctx->cmdpool);
ctx->staging[1] = QFV_CreateStagingBuffer (ctx->device, 1024*1024, 1,
ctx->cmdpool);
ctx->staging = QFV_CreateStagingBuffer (ctx->device, 4*1024*1024, 1,
ctx->cmdpool);
}
void