After going through the tutorial at vulkan tutorial dot com, I am trying to create a similar project in C. Currently, I have no vertex buffers or anything, just a triangle in a vertex shader. After passing all my checks when initializing Vulkan, i get an access violation issue when calling vkWaitForFences(vulkanContext->device.logicalDevice, 1, &vulkanContext->inFlightFence, VK_TRUE, UINT64_MAX);
at the start of the DrawFrame()
function, like in the tutorial.
I am storing my types in a big struct VulkanContext
, mostly for simplicity now. The semaphores / fences are in there like regular members
.
// Semaphores
VkSemaphore imageAvailableSemaphore;
VkSemaphore queueCompleteSemaphore;
uint32 inFlightFenceCount;
VkFence inFlightFence;
And they are created in the CreateSyncObjects()
function
void CreateSyncObjects(VulkanContext *vulkanContext)
{
VkSemaphoreCreateInfo semaphoreInfo = {VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO};
VkFenceCreateInfo fenceInfo = {VK_STRUCTURE_TYPE_FENCE_CREATE_INFO};
fenceInfo.flags = VK_FENCE_CREATE_SIGNALED_BIT;
if (vkCreateSemaphore(vulkanContext->device.logicalDevice, &semaphoreInfo, 0, &vulkanContext->imageAvailableSemaphore) != VK_SUCCESS ||
vkCreateSemaphore(vulkanContext->device.logicalDevice, &semaphoreInfo, 0, &vulkanContext->queueCompleteSemaphore) != VK_SUCCESS ||
vkCreateFence(vulkanContext->device.logicalDevice, &fenceInfo, 0, &vulkanContext->inFlightFence) != VK_SUCCESS)
{
LOG_ERROR("CreateSyncObjects - Failed to create synchronization objects for a frame!");
}
}
The LunarG dump for the fence looks like this:
Thread 0, Frame 0:
vkCreateFence(device, pCreateInfo, pAllocator, pFence) returns VkResult VK_SUCCESS (0):
device: VkDevice = 000002083D968A60
pCreateInfo: const VkFenceCreateInfo* = 000000167198F540:
sType: VkStructureType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO (8)
pNext: const void* = NULL
flags: VkFenceCreateFlags = 1 (VK_FENCE_CREATE_SIGNALED_BIT)
pAllocator: const VkAllocationCallbacks* = NULL
pFence: VkFence* = 0000020840A4B6B0
which to my untrained eye looks fine, no zero’s or strange numbers atleats.
I’m not allowed to post links yet, but you can view a pastebin of the Lunar G dumb at pastebin com / R96J6ECr
I hope anyone can help me solve this issue im facing