Skip to content

VERY experimental Nintendo Switch 2 emulator

C++

[vk] handle mali/adreno5xx driver bug returning VK_INCOMPLETE on graphics pipeline creation (#3383)

lizzie5027aecf7729
diff --git a/src/video_core/vulkan_common/vulkan_wrapper.cpp b/src/video_core/vulkan_common/vulkan_wrapper.cpp
index f59ac7d6bc..3d082c8360 100644
--- a/src/video_core/vulkan_common/vulkan_wrapper.cpp
+++ b/src/video_core/vulkan_common/vulkan_wrapper.cpp
@@ -725,10 +725,15 @@ PipelineLayout Device::CreatePipelineLayout(const VkPipelineLayoutCreateInfo& ci
return PipelineLayout(object, handle, *dld);
}
-Pipeline Device::CreateGraphicsPipeline(const VkGraphicsPipelineCreateInfo& ci,
- VkPipelineCache cache) const {
- VkPipeline object;
- Check(dld->vkCreateGraphicsPipelines(handle, cache, 1, &ci, nullptr, &object));
+Pipeline Device::CreateGraphicsPipeline(const VkGraphicsPipelineCreateInfo& ci, VkPipelineCache cache) const {
+ VkPipeline object = VK_NULL_HANDLE;
+ auto const result = dld->vkCreateGraphicsPipelines(handle, cache, 1, &ci, nullptr, &object);
+ // Adreno 5xx drivers do not properly return when a graphics pipeline fails to be created
+ // Some (unkown) Mali drivers also do not properly return
+ // This result code is out of spec, but should be handled as "kinda working"
+ if (result == VK_INCOMPLETE)
+ return Pipeline(object, handle, *dld);
+ Check(result);
return Pipeline(object, handle, *dld);
}