mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 07:12:07 +00:00
vk: use 32 command buffers in queue
Workaround for: Validation Error: [ VUID-vkAcquireNextImageKHR-semaphore-01779 ] Object 0: handle = 0x90000000009, name = Semaphore: image available #0, type = VK_OBJECT_TYPE_SEMAPHORE; | MessageID = 0x5717e75b | vkAcquireNextImageKHR(): Semaphore must not have any pending operations. The Vulkan spec states: If semaphore is not VK_NULL_HANDLE it must not have any uncompleted signal or wait operations pending (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkAcquireNextImageKHR-semaphore-01779) (validation)
This commit is contained in:
parent
3cd735cd23
commit
6d1a911a86
2 changed files with 9 additions and 5 deletions
|
@ -211,7 +211,7 @@ typedef enum
|
|||
} qvkrenderpasstype_t;
|
||||
|
||||
// Vulkan constants: command and dynamic buffer count
|
||||
#define NUM_CMDBUFFERS 2
|
||||
#define NUM_CMDBUFFERS 32
|
||||
#define NUM_DYNBUFFERS 2
|
||||
|
||||
// Vulkan instance
|
||||
|
|
|
@ -86,7 +86,7 @@ qvkrenderpass_t vk_renderpasses[RP_COUNT] = {
|
|||
};
|
||||
|
||||
// Vulkan pools
|
||||
VkCommandPool vk_commandPool[NUM_CMDBUFFERS] = { VK_NULL_HANDLE, VK_NULL_HANDLE };
|
||||
VkCommandPool vk_commandPool[NUM_CMDBUFFERS] = { 0 };
|
||||
VkCommandPool vk_transferCommandPool = VK_NULL_HANDLE;
|
||||
VkDescriptorPool vk_descriptorPool = VK_NULL_HANDLE;
|
||||
static VkCommandPool vk_stagingCommandPool[NUM_DYNBUFFERS] = { VK_NULL_HANDLE, VK_NULL_HANDLE };
|
||||
|
@ -1733,6 +1733,8 @@ void QVk_PostInit(void)
|
|||
*/
|
||||
qboolean QVk_Init(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
PFN_vkEnumerateInstanceVersion vkEnumerateInstanceVersion = (PFN_vkEnumerateInstanceVersion)vkGetInstanceProcAddr(NULL, "vkEnumerateInstanceVersion");
|
||||
uint32_t instanceVersion = VK_API_VERSION_1_0;
|
||||
|
||||
|
@ -1817,7 +1819,7 @@ qboolean QVk_Init(void)
|
|||
#endif
|
||||
|
||||
R_Printf(PRINT_ALL, "Enabled extensions: ");
|
||||
for (int i = 0; i < extCount; i++)
|
||||
for (i = 0; i < extCount; i++)
|
||||
{
|
||||
R_Printf(PRINT_ALL, "%s ", wantedExtensions[i]);
|
||||
vk_config.extensions[i] = wantedExtensions[i];
|
||||
|
@ -2019,8 +2021,9 @@ qboolean QVk_Init(void)
|
|||
.pNext = NULL,
|
||||
.flags = 0
|
||||
};
|
||||
for (int i = 0; i < NUM_CMDBUFFERS; ++i)
|
||||
for (i = 0; i < NUM_CMDBUFFERS; ++i)
|
||||
{
|
||||
vk_commandPool[i] = VK_NULL_HANDLE;
|
||||
VK_VERIFY(vkCreateFence(vk_device.logical, &fCreateInfo, NULL, &vk_fences[i]));
|
||||
VK_VERIFY(vkCreateSemaphore(vk_device.logical, &sCreateInfo, NULL, &vk_imageAvailableSemaphores[i]));
|
||||
VK_VERIFY(vkCreateSemaphore(vk_device.logical, &sCreateInfo, NULL, &vk_renderFinishedSemaphores[i]));
|
||||
|
@ -2173,7 +2176,8 @@ VkResult QVk_BeginFrame(const VkViewport* viewport, const VkRect2D* scissor)
|
|||
|
||||
ReleaseSwapBuffers();
|
||||
|
||||
VkResult result = vkAcquireNextImageKHR(vk_device.logical, vk_swapchain.sc, 500000000, vk_imageAvailableSemaphores[vk_activeBufferIdx], VK_NULL_HANDLE, &vk_imageIndex);
|
||||
VkResult result = vkAcquireNextImageKHR(vk_device.logical, vk_swapchain.sc, 500000000 /* 0.5 sec */,
|
||||
vk_imageAvailableSemaphores[vk_activeBufferIdx], VK_NULL_HANDLE, &vk_imageIndex);
|
||||
if (result == VK_ERROR_OUT_OF_DATE_KHR || result == VK_SUBOPTIMAL_KHR || result == VK_ERROR_SURFACE_LOST_KHR || result == VK_TIMEOUT)
|
||||
{
|
||||
vk_recreateSwapchainNeeded = true;
|
||||
|
|
Loading…
Reference in a new issue