mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-09 23:02:02 +00:00
vk: replace index buffer after new frame only
This commit is contained in:
parent
10ee6eace3
commit
33ebf6c193
1 changed files with 4 additions and 7 deletions
|
@ -236,7 +236,6 @@ static VkDescriptorSet vk_uboDescriptorSets[NUM_DYNBUFFERS];
|
|||
static qvkstagingbuffer_t vk_stagingBuffers[NUM_DYNBUFFERS];
|
||||
static int vk_activeDynBufferIdx = 0;
|
||||
static int vk_activeSwapBufferIdx = 0;
|
||||
static int vk_dynIndex = 0;
|
||||
|
||||
// swap buffers used if primary dynamic buffers get full
|
||||
#define NUM_SWAPBUFFER_SLOTS 4
|
||||
|
@ -1138,14 +1137,12 @@ UpdateIndexBuffer(const uint16_t *data, VkDeviceSize bufferSize, VkDeviceSize *d
|
|||
{
|
||||
uint16_t *iboData = NULL;
|
||||
|
||||
vk_dynIndex = (vk_dynIndex + 1) % NUM_DYNBUFFERS;
|
||||
|
||||
VK_VERIFY(buffer_invalidate(&vk_dynIndexBuffers[vk_dynIndex].resource));
|
||||
iboData = (uint16_t *)QVk_GetIndexBuffer(bufferSize, dstOffset, vk_dynIndex);
|
||||
VK_VERIFY(buffer_invalidate(&vk_dynIndexBuffers[vk_activeDynBufferIdx].resource));
|
||||
iboData = (uint16_t *)QVk_GetIndexBuffer(bufferSize, dstOffset, vk_activeDynBufferIdx);
|
||||
memcpy(iboData, data, bufferSize);
|
||||
VK_VERIFY(buffer_flush(&vk_dynIndexBuffers[vk_dynIndex].resource));
|
||||
VK_VERIFY(buffer_flush(&vk_dynIndexBuffers[vk_activeDynBufferIdx].resource));
|
||||
|
||||
return &vk_dynIndexBuffers[vk_dynIndex].resource.buffer;
|
||||
return &vk_dynIndexBuffers[vk_activeDynBufferIdx].resource.buffer;
|
||||
}
|
||||
|
||||
static void CreateStagingBuffer(VkDeviceSize size, qvkstagingbuffer_t *dstBuffer, int i)
|
||||
|
|
Loading…
Reference in a new issue