Remove fixed command buffers + minor cleanup (#33)

Removes the `fixed` parameter from AcquireCommandBuffer, and removes a couple other unused bools from the VulkanCommandBuffer struct.

Co-authored-by: Caleb Cornett <caleb.cornett@outlook.com>
Reviewed-on: MoonsideGames/Refresh#33
Co-authored-by: TheSpydog <thespydog@noreply.example.org>
Co-committed-by: TheSpydog <thespydog@noreply.example.org>
3dtextures
TheSpydog 2023-01-14 18:03:58 +00:00 committed by cosmonaut
parent 903192cb4c
commit f7250ab12a
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
* 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(
Refresh_Device *device,
uint8_t fixed
Refresh_Device *device
);
/* Acquires a texture to use for presentation.

View File

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

View File

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

View File

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