Compare commits

...

1 Commits

Author SHA1 Message Date
Caleb Cornett 864d381d2a Remove fixed command buffers + minor cleanup 2023-01-13 20:33:07 -05:00
4 changed files with 6 additions and 32 deletions

View File

@ -1168,15 +1168,9 @@ REFRESHAPI Refresh_TextureFormat Refresh_GetSwapchainFormat(
* A command buffer may only be used on the thread that * A command buffer may only be used on the thread that
* it was acquired on. Using it on any other thread is an error. * it was acquired on. Using it on any other thread is an error.
* *
* fixed:
* If a command buffer is designated as fixed, it can be
* acquired once, have commands recorded into it, and
* be re-submitted indefinitely.
*
*/ */
REFRESHAPI Refresh_CommandBuffer* Refresh_AcquireCommandBuffer( REFRESHAPI Refresh_CommandBuffer* Refresh_AcquireCommandBuffer(
Refresh_Device *device, Refresh_Device *device
uint8_t fixed
); );
/* Acquires a texture to use for presentation. /* Acquires a texture to use for presentation.

View File

@ -789,13 +789,11 @@ void Refresh_UnclaimWindow(
} }
Refresh_CommandBuffer* Refresh_AcquireCommandBuffer( Refresh_CommandBuffer* Refresh_AcquireCommandBuffer(
Refresh_Device *device, Refresh_Device *device
uint8_t fixed
) { ) {
NULL_RETURN_NULL(device); NULL_RETURN_NULL(device);
return device->AcquireCommandBuffer( return device->AcquireCommandBuffer(
device->driverData, device->driverData
fixed
); );
} }

View File

@ -470,8 +470,7 @@ struct Refresh_Device
); );
Refresh_CommandBuffer* (*AcquireCommandBuffer)( Refresh_CommandBuffer* (*AcquireCommandBuffer)(
Refresh_Renderer *driverData, Refresh_Renderer *driverData
uint8_t fixed
); );
Refresh_Texture* (*AcquireSwapchainTexture)( Refresh_Texture* (*AcquireSwapchainTexture)(

View File

@ -1500,10 +1500,6 @@ typedef struct VulkanCommandPool VulkanCommandPool;
typedef struct VulkanCommandBuffer typedef struct VulkanCommandBuffer
{ {
VkCommandBuffer commandBuffer; VkCommandBuffer commandBuffer;
uint8_t fixed;
uint8_t submitted;
uint8_t renderPassInProgress;
VulkanCommandPool *commandPool; VulkanCommandPool *commandPool;
VulkanPresentData *presentDatas; VulkanPresentData *presentDatas;
@ -4662,11 +4658,7 @@ static void VULKAN_INTERNAL_BeginCommandBuffer(
beginInfo.pNext = NULL; beginInfo.pNext = NULL;
beginInfo.flags = 0; beginInfo.flags = 0;
beginInfo.pInheritanceInfo = NULL; beginInfo.pInheritanceInfo = NULL;
if (!commandBuffer->fixed)
{
beginInfo.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT; beginInfo.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
}
result = renderer->vkBeginCommandBuffer( result = renderer->vkBeginCommandBuffer(
commandBuffer->commandBuffer, commandBuffer->commandBuffer,
@ -8484,8 +8476,6 @@ static void VULKAN_BeginRenderPass(
VK_SUBPASS_CONTENTS_INLINE VK_SUBPASS_CONTENTS_INLINE
); );
vulkanCommandBuffer->renderPassInProgress = 1;
SDL_stack_free(clearValues); SDL_stack_free(clearValues);
for (i = 0; i < colorAttachmentCount; i += 1) for (i = 0; i < colorAttachmentCount; i += 1)
@ -8622,7 +8612,6 @@ static void VULKAN_EndRenderPass(
vulkanCommandBuffer->renderPassDepthTexture = NULL; vulkanCommandBuffer->renderPassDepthTexture = NULL;
vulkanCommandBuffer->currentGraphicsPipeline = NULL; vulkanCommandBuffer->currentGraphicsPipeline = NULL;
vulkanCommandBuffer->renderPassInProgress = 0;
} }
static void VULKAN_BindGraphicsPipeline( static void VULKAN_BindGraphicsPipeline(
@ -9197,8 +9186,7 @@ static VulkanCommandBuffer* VULKAN_INTERNAL_GetInactiveCommandBufferFromPool(
} }
static Refresh_CommandBuffer* VULKAN_AcquireCommandBuffer( static Refresh_CommandBuffer* VULKAN_AcquireCommandBuffer(
Refresh_Renderer *driverData, Refresh_Renderer *driverData
uint8_t fixed
) { ) {
VulkanRenderer *renderer = (VulkanRenderer*) driverData; VulkanRenderer *renderer = (VulkanRenderer*) driverData;
VkResult result; VkResult result;
@ -9221,10 +9209,6 @@ static Refresh_CommandBuffer* VULKAN_AcquireCommandBuffer(
commandBuffer->fragmentUniformBuffer = NULL; commandBuffer->fragmentUniformBuffer = NULL;
commandBuffer->computeUniformBuffer = NULL; commandBuffer->computeUniformBuffer = NULL;
commandBuffer->fixed = fixed;
commandBuffer->submitted = 0;
commandBuffer->renderPassInProgress = 0;
commandBuffer->renderPassColorTargetCount = 0; commandBuffer->renderPassColorTargetCount = 0;
VULKAN_INTERNAL_BeginCommandBuffer(renderer, commandBuffer); VULKAN_INTERNAL_BeginCommandBuffer(renderer, commandBuffer);
@ -9920,7 +9904,6 @@ static void VULKAN_Submit(
); );
} }
((VulkanCommandBuffer*)pCommandBuffers[i])->submitted = 1;
renderer->submittedCommandBuffers[renderer->submittedCommandBufferCount] = (VulkanCommandBuffer*) pCommandBuffers[i]; renderer->submittedCommandBuffers[renderer->submittedCommandBufferCount] = (VulkanCommandBuffer*) pCommandBuffers[i];
renderer->submittedCommandBufferCount += 1; renderer->submittedCommandBufferCount += 1;