Vulkan: fix dummy UBOs becoming invalid after defrag
continuous-integration/drone/push Build is passing Details

pull/48/head
cosmonaut 2023-12-05 12:22:40 -08:00
parent f01d5d817a
commit 483c07f3a8
1 changed files with 14 additions and 16 deletions

View File

@ -2986,7 +2986,7 @@ static uint8_t VULKAN_INTERNAL_BindMemoryForBuffer(
VkBuffer buffer, VkBuffer buffer,
VkDeviceSize size, VkDeviceSize size,
uint8_t preferDeviceLocal, uint8_t preferDeviceLocal,
uint8_t isTransferBuffer, uint8_t dedicatedAllocation,
VulkanMemoryUsedRegion** usedRegion VulkanMemoryUsedRegion** usedRegion
) { ) {
uint8_t bindResult = 0; uint8_t bindResult = 0;
@ -3022,7 +3022,7 @@ static uint8_t VULKAN_INTERNAL_BindMemoryForBuffer(
renderer, renderer,
memoryTypeIndex, memoryTypeIndex,
&memoryRequirements, &memoryRequirements,
isTransferBuffer, dedicatedAllocation,
size, size,
buffer, buffer,
VK_NULL_HANDLE, VK_NULL_HANDLE,
@ -3066,7 +3066,7 @@ static uint8_t VULKAN_INTERNAL_BindMemoryForBuffer(
renderer, renderer,
memoryTypeIndex, memoryTypeIndex,
&memoryRequirements, &memoryRequirements,
isTransferBuffer, dedicatedAllocation,
size, size,
buffer, buffer,
VK_NULL_HANDLE, VK_NULL_HANDLE,
@ -4104,7 +4104,7 @@ static VulkanBuffer* VULKAN_INTERNAL_CreateBuffer(
VulkanResourceAccessType resourceAccessType, VulkanResourceAccessType resourceAccessType,
VkBufferUsageFlags usage, VkBufferUsageFlags usage,
uint8_t preferDeviceLocal, uint8_t preferDeviceLocal,
uint8_t isTransferBuffer uint8_t dedicatedAllocation
) { ) {
VulkanBuffer* buffer; VulkanBuffer* buffer;
VkResult vulkanResult; VkResult vulkanResult;
@ -4140,7 +4140,7 @@ static VulkanBuffer* VULKAN_INTERNAL_CreateBuffer(
buffer->buffer, buffer->buffer,
buffer->size, buffer->size,
buffer->preferDeviceLocal, buffer->preferDeviceLocal,
isTransferBuffer, dedicatedAllocation,
&buffer->usedRegion &buffer->usedRegion
); );
@ -4243,7 +4243,8 @@ static VulkanBufferContainer* VULKAN_INTERNAL_CreateBufferContainer(
VulkanRenderer *renderer, VulkanRenderer *renderer,
uint32_t sizeInBytes, uint32_t sizeInBytes,
VulkanResourceAccessType resourceAccessType, VulkanResourceAccessType resourceAccessType,
VkBufferUsageFlags usageFlags VkBufferUsageFlags usageFlags,
uint8_t dedicated
) { ) {
VulkanBufferContainer* bufferContainer; VulkanBufferContainer* bufferContainer;
VulkanBuffer* buffer; VulkanBuffer* buffer;
@ -4257,7 +4258,7 @@ static VulkanBufferContainer* VULKAN_INTERNAL_CreateBufferContainer(
resourceAccessType, resourceAccessType,
usageFlags, usageFlags,
1, 1,
0 dedicated
); );
if (buffer == NULL) if (buffer == NULL)
@ -4307,7 +4308,8 @@ static uint8_t VULKAN_INTERNAL_CreateUniformBuffer(
renderer, renderer,
UBO_BUFFER_SIZE, UBO_BUFFER_SIZE,
resourceAccessType, resourceAccessType,
VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT,
0
); );
if (uniformBuffer->vulkanBufferContainer == NULL) if (uniformBuffer->vulkanBufferContainer == NULL)
@ -4396,7 +4398,8 @@ static VulkanUniformBuffer* VULKAN_INTERNAL_CreateDummyUniformBuffer(
renderer, renderer,
UBO_BUFFER_SIZE, UBO_BUFFER_SIZE,
resourceAccessType, resourceAccessType,
VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT,
1
); );
uniformBuffer->offset = 0; uniformBuffer->offset = 0;
@ -7111,7 +7114,8 @@ static Refresh_Buffer* VULKAN_CreateBuffer(
(VulkanRenderer*) driverData, (VulkanRenderer*) driverData,
sizeInBytes, sizeInBytes,
resourceAccessType, resourceAccessType,
vulkanUsageFlags vulkanUsageFlags,
0
); );
} }
@ -10545,7 +10549,6 @@ static uint8_t VULKAN_INTERNAL_DefragmentMemory(
VkBufferCopy bufferCopy; VkBufferCopy bufferCopy;
VkImageCopy *imageCopyRegions; VkImageCopy *imageCopyRegions;
VulkanCommandBuffer *commandBuffer; VulkanCommandBuffer *commandBuffer;
VkCommandBufferBeginInfo beginInfo;
uint32_t i, level; uint32_t i, level;
VulkanResourceAccessType copyResourceAccessType = RESOURCE_ACCESS_NONE; VulkanResourceAccessType copyResourceAccessType = RESOURCE_ACCESS_NONE;
VulkanResourceAccessType originalResourceAccessType; VulkanResourceAccessType originalResourceAccessType;
@ -10555,11 +10558,6 @@ static uint8_t VULKAN_INTERNAL_DefragmentMemory(
renderer->needDefrag = 0; renderer->needDefrag = 0;
renderer->defragInProgress = 1; renderer->defragInProgress = 1;
beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
beginInfo.pNext = NULL;
beginInfo.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
beginInfo.pInheritanceInfo = NULL;
commandBuffer = (VulkanCommandBuffer*) VULKAN_AcquireCommandBuffer((Refresh_Renderer *) renderer); commandBuffer = (VulkanCommandBuffer*) VULKAN_AcquireCommandBuffer((Refresh_Renderer *) renderer);
if (VULKAN_INTERNAL_FindAllocationToDefragment( if (VULKAN_INTERNAL_FindAllocationToDefragment(