add wait API call

pull/9/head
cosmonaut 2021-01-02 21:07:51 -08:00 committed by thatcosmonaut
parent 540c0985b7
commit 087a60fa52
4 changed files with 34 additions and 1 deletions

View File

@ -1417,6 +1417,11 @@ REFRESHAPI void REFRESH_Submit(
uint32_t commandBufferCount
);
/* Waits for the previous submission to complete. */
REFRESHAPI void REFRESH_Wait(
REFRESH_Device *device
);
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@ -972,4 +972,13 @@ void REFRESH_Submit(
);
}
void REFRESH_Wait(
REFRESH_Device *device
) {
NULL_RETURN(device);
device->Wait(
device->driverData
);
}
/* vim: set noexpandtab shiftwidth=8 tabstop=8: */

View File

@ -564,6 +564,10 @@ struct REFRESH_Device
uint32_t commandBufferCount
);
void(*Wait)(
REFRESH_Renderer *driverData
);
/* Opaque pointer for the Driver */
REFRESH_Renderer *driverData;
};
@ -622,7 +626,8 @@ struct REFRESH_Device
ASSIGN_DRIVER_FUNC(BindComputeTextures, name) \
ASSIGN_DRIVER_FUNC(AcquireCommandBuffer, name) \
ASSIGN_DRIVER_FUNC(QueuePresent, name) \
ASSIGN_DRIVER_FUNC(Submit, name)
ASSIGN_DRIVER_FUNC(Submit, name) \
ASSIGN_DRIVER_FUNC(Wait, name)
typedef struct REFRESH_Driver
{

View File

@ -8501,6 +8501,20 @@ static void VULKAN_Submit(
SDL_stack_free(commandBuffers);
}
static void VULKAN_Wait(
REFRESH_Renderer *driverData
) {
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
renderer->vkWaitForFences(
renderer->logicalDevice,
1,
&renderer->inFlightFence,
VK_TRUE,
UINT64_MAX
);
}
/* Device instantiation */
static inline uint8_t VULKAN_INTERNAL_SupportsExtension(