Skip to content

Commit

Permalink
Add a workaround for some Linux drivers.
Browse files Browse the repository at this point in the history
We can get a crash when cleaning an instance in some
circumstances with Vulkan drivers on Linux.

If we force the Loader to keep an instance alive, then
we won't run into this problem. The downside is that we
leak a single instance.
  • Loading branch information
AWoloszyn committed May 22, 2018
1 parent 46970b6 commit d88f76e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions gapir/cc/linux/vulkan_renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,21 @@ class VulkanRendererImpl : public VulkanRenderer {

VulkanRendererImpl::VulkanRendererImpl() {
mApi.resolve();
// Create a dummy instance renderer that never gets cleaned up.
// This works around some driver bugs.
// See https://github.com/google/gapid/issues/1899
auto create_info = Vulkan::VkInstanceCreateInfo{
Vulkan::VkStructureType::VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
nullptr,
0,
nullptr,
0,
nullptr,
0,
nullptr
};
Vulkan::VkInstance inst;
mApi.mFunctionStubs.vkCreateInstance(&create_info, nullptr, &inst);
}

VulkanRendererImpl::~VulkanRendererImpl() {
Expand Down

0 comments on commit d88f76e

Please sign in to comment.