vulkan: add more detail to some error messages

This commit is contained in:
Sasha Szpakowski
2026-06-14 16:48:34 -03:00
parent f1a55bc36d
commit 6b144d3494
+9 -7
View File
@@ -152,10 +152,11 @@ Graphics::Graphics()
createInfo.ppEnabledLayerNames = validationLayers.data(); createInfo.ppEnabledLayerNames = validationLayers.data();
} }
if (vkCreateInstance(&createInfo, nullptr, &instance) != VK_SUCCESS) VkResult result = vkCreateInstance(&createInfo, nullptr, &instance);
if (result != VK_SUCCESS)
{ {
SDL_Vulkan_UnloadLibrary(); SDL_Vulkan_UnloadLibrary();
throw love::Exception("couldn't create vulkan instance"); throw love::Exception("couldn't create vulkan instance: %s", Vulkan::getErrorString(result));
} }
volkLoadInstance(instance); volkLoadInstance(instance);
@@ -401,7 +402,7 @@ void Graphics::submitGpuCommands(SubmitMode submitMode, void *screenshotCallback
&screenshotAllocationInfo); &screenshotAllocationInfo);
if (result != VK_SUCCESS) if (result != VK_SUCCESS)
throw love::Exception("failed to create screenshot readback buffer"); throw love::Exception("failed to create screenshot readback buffer: %s", Vulkan::getErrorString(result));
Vulkan::cmdTransitionImageLayout( Vulkan::cmdTransitionImageLayout(
commandBuffers.at(currentFrame), commandBuffers.at(currentFrame),
@@ -471,8 +472,9 @@ void Graphics::submitGpuCommands(SubmitMode submitMode, void *screenshotCallback
fence = inFlightFences[currentFrame]; fence = inFlightFences[currentFrame];
} }
if (vkQueueSubmit(graphicsQueue, 1, &submitInfo, fence) != VK_SUCCESS) VkResult result = vkQueueSubmit(graphicsQueue, 1, &submitInfo, fence);
throw love::Exception("failed to submit draw command buffer"); if (result != VK_SUCCESS)
throw love::Exception("Failed to submit Vulkan draw command buffer: %s", Vulkan::getErrorString(result));
if (submitMode == SUBMIT_NOPRESENT || submitMode == SUBMIT_RESTART || screenshotBuffer != VK_NULL_HANDLE) if (submitMode == SUBMIT_NOPRESENT || submitMode == SUBMIT_RESTART || screenshotBuffer != VK_NULL_HANDLE)
{ {
@@ -596,7 +598,7 @@ void Graphics::present(void *screenshotCallbackdata)
recreateSwapChain(); recreateSwapChain();
} }
else if (result != VK_SUCCESS) else if (result != VK_SUCCESS)
throw love::Exception("failed to present swap chain image"); throw love::Exception("Failed to present Vulkan swap chain image: %s", Vulkan::getErrorString(result));
for (love::graphics::StreamBuffer *buffer : batchedDrawState.vb) for (love::graphics::StreamBuffer *buffer : batchedDrawState.vb)
buffer->nextFrame(); buffer->nextFrame();
@@ -1370,7 +1372,7 @@ void Graphics::beginSwapChainFrame()
continue; continue;
} }
else if (result != VK_SUCCESS && result != VK_SUBOPTIMAL_KHR) else if (result != VK_SUCCESS && result != VK_SUBOPTIMAL_KHR)
throw love::Exception("failed to acquire swap chain image"); throw love::Exception("Failed to acquire Vulkan swap chain image: %s", Vulkan::getErrorString(result));
break; break;
} }