Skip to content

Commit

Permalink
Vulkan: Fix trace crash with Vulkan loaders (#1799)
Browse files Browse the repository at this point in the history
So that tracing with VulkanSDK loader won't crash.
  • Loading branch information
Qining authored Apr 13, 2018
1 parent 2ce48b3 commit be2cf54
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/vulkan/vk_virtual_swapchain/cc/layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ namespace swapchain {
// Sets the key of the dispatch tables used in lower layers of the parent
// dispatchable handle to the new child dispatchable handle. This is necessary
// as lower layers may use that key to find the dispatch table, and a child
// handles should share the same dispatch table key. E.g. VkCommandBuffer is a
// handle should share the same dispatch table key. E.g. VkCommandBuffer is a
// child dispatchable handle of VkDevice, all the VkCommandBuffer dispatching
// functions are actually device functions (resolved by VkGetDeviceProcAddress).
// ref: https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/blob/master/loader/LoaderAndLayerInterface.md#creating-new-dispatchable-objects,
// Ref: https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/blob/master/loader/LoaderAndLayerInterface.md#creating-new-dispatchable-objects,
static inline void set_dispatch_from_parent(void* child, void* parent) {
*((const void**)child) = *((const void**)parent);
}
Expand Down Expand Up @@ -252,4 +252,4 @@ Context &GetGlobalContext();

} // swapchain

#endif // VK_VIRTUAL_SWAPCHAIN_LAYER_H
#endif // VK_VIRTUAL_SWAPCHAIN_LAYER_H
6 changes: 6 additions & 0 deletions gapii/cc/vulkan_mid_execution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,12 @@ class StagingCommandBuffer {

device_functions_.vkAllocateCommandBuffers(device, &allocate_info,
&command_buffer_);
// Set the key of the dispatch tables used in lower layers of the parent
// dispatchable handle to the new child dispatchable handle. This is
// necessary as lower layers may use that key to find the dispatch table,
// and a child handle should share the same dispatch table key.
// Ref: https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/blob/master/loader/LoaderAndLayerInterface.md#creating-new-dispatchable-objects
*((const void**)command_buffer_) = *((const void**)device_);

VkCommandBufferBeginInfo begin_info = {
VkStructureType::VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, // sType
Expand Down

0 comments on commit be2cf54

Please sign in to comment.