Vulkan: Some error handling improvement. Might get us a clue for #10065
This commit is contained in:
parent
4f4eb6f024
commit
70c70b1e76
5 changed files with 16 additions and 10 deletions
|
@ -906,11 +906,10 @@ const char *VulkanResultToString(VkResult res) {
|
|||
case VK_ERROR_OUT_OF_DATE_KHR: return "VK_ERROR_OUT_OF_DATE_KHR";
|
||||
case VK_ERROR_INCOMPATIBLE_DISPLAY_KHR: return "VK_ERROR_INCOMPATIBLE_DISPLAY_KHR";
|
||||
case VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: return "VK_ERROR_NATIVE_WINDOW_IN_USE_KHR";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
case VK_ERROR_OUT_OF_POOL_MEMORY_KHR: return "VK_ERROR_OUT_OF_POOL_MEMORY_KHR";
|
||||
case VK_ERROR_INVALID_EXTERNAL_HANDLE_KHX: return "VK_ERROR_INVALID_EXTERNAL_HANDLE_KHX";
|
||||
|
||||
void VulkanAssertImpl(VkResult check, const char *function, const char *file, int line) {
|
||||
const char *error = "(none)";
|
||||
}
|
||||
default:
|
||||
return "VK_ERROR_...(unknown)";
|
||||
}
|
||||
}
|
|
@ -400,5 +400,7 @@ void init_glslang();
|
|||
void finalize_glslang();
|
||||
bool GLSLtoSPV(const VkShaderStageFlagBits shader_type, const char *pshader, std::vector<uint32_t> &spirv, std::string *errorMessage = nullptr);
|
||||
|
||||
const char *VulkanResultToString(VkResult res);
|
||||
|
||||
#endif // UTIL_INIT
|
||||
|
||||
|
|
|
@ -986,11 +986,11 @@ void DrawEngineVulkan::DoFlush() {
|
|||
Draw::NativeObject object = g_Config.iRenderingMode != 0 ? Draw::NativeObject::FRAMEBUFFER_RENDERPASS : Draw::NativeObject::BACKBUFFER_RENDERPASS;
|
||||
VkRenderPass renderPass = (VkRenderPass)draw_->GetNativeObject(object);
|
||||
VulkanPipeline *pipeline = pipelineManager_->GetOrCreatePipeline(pipelineLayout_, renderPass, pipelineKey_, dec_, vshader, fshader, false);
|
||||
renderManager->BindPipeline(pipeline->pipeline);
|
||||
if (!pipeline) {
|
||||
// Already logged, let's bail out.
|
||||
return;
|
||||
}
|
||||
renderManager->BindPipeline(pipeline->pipeline);
|
||||
if (pipeline != lastPipeline_) {
|
||||
if (lastPipeline_ && !lastPipeline_->useBlendConstant && pipeline->useBlendConstant) {
|
||||
gstate_c.Dirty(DIRTY_BLEND_STATE);
|
||||
|
|
|
@ -281,7 +281,7 @@ static VulkanPipeline *CreateVulkanPipeline(VkDevice device, VkPipelineCache pip
|
|||
VkPipeline pipeline;
|
||||
VkResult result = vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipe, nullptr, &pipeline);
|
||||
if (result != VK_SUCCESS) {
|
||||
ERROR_LOG(G3D, "Failed creating graphics pipeline!");
|
||||
ERROR_LOG(G3D, "Failed creating graphics pipeline! result='%s'", VulkanResultToString(result));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -321,6 +321,7 @@ VulkanPipeline *PipelineManagerVulkan::GetOrCreatePipeline(VkPipelineLayout layo
|
|||
VulkanPipeline *pipeline = CreateVulkanPipeline(
|
||||
vulkan_->GetDevice(), pipelineCache_, layout, renderPass,
|
||||
rasterKey, vtxDec, vs, fs, useHwTransform);
|
||||
// Even if the result is nullptr, insert it so we don't try to create it repeatedly.
|
||||
pipelines_.Insert(key, pipeline);
|
||||
return pipeline;
|
||||
}
|
||||
|
|
|
@ -695,7 +695,11 @@ void VulkanRenderManager::BeginSubmitFrame(int frame) {
|
|||
// Get the index of the next available swapchain image, and a semaphore to block command buffer execution on.
|
||||
// Now, I wonder if we should do this early in the frame or late? Right now we do it early, which should be fine.
|
||||
VkResult res = vkAcquireNextImageKHR(vulkan_->GetDevice(), vulkan_->GetSwapchain(), UINT64_MAX, acquireSemaphore_, (VkFence)VK_NULL_HANDLE, &frameData.curSwapchainImage);
|
||||
assert(res == VK_SUCCESS);
|
||||
if (res == VK_SUBOPTIMAL_KHR) {
|
||||
// Hopefully the resize will happen shortly. Ignore.
|
||||
} else {
|
||||
assert(res == VK_SUCCESS);
|
||||
}
|
||||
// TODO: Deal with the VK_SUBOPTIMAL_KHR and VK_ERROR_OUT_OF_DATE_KHR
|
||||
// return codes
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue