Skip to content

Commit

Permalink
restore vk_layerGetPhysicalDeviceProcAddr entry in procaddr table (#714)
Browse files Browse the repository at this point in the history
* restore vk_layerGetPhysicalDeviceProcAddr entry in procaddr table
* unwrap instance for downchain GIPA
  • Loading branch information
bradgrantham-lunarg authored Jun 8, 2022
1 parent 46cbaef commit 82e04fa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions framework/generated/generated_layer_func_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,7 @@ const std::unordered_map<std::string, PFN_vkVoidFunction> func_table = {
{ "vkCmdTraceRaysIndirectKHR", reinterpret_cast<PFN_vkVoidFunction>(encode::CmdTraceRaysIndirectKHR) },
{ "vkGetRayTracingShaderGroupStackSizeKHR", reinterpret_cast<PFN_vkVoidFunction>(encode::GetRayTracingShaderGroupStackSizeKHR) },
{ "vkCmdSetRayTracingPipelineStackSizeKHR", reinterpret_cast<PFN_vkVoidFunction>(encode::CmdSetRayTracingPipelineStackSizeKHR) },
{ "vk_layerGetPhysicalDeviceProcAddr", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceProcAddr) },
};

GFXRECON_END_NAMESPACE(gfxrecon)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ def beginFile(self, gen_opts):
)

def endFile(self):
"""Method override."""
# Manually output the physical device proc address function as its name doesn't
# match the scheme used by self.LAYER_FUNCTIONS:
align = 100 - len('vk_layerGetPhysicalDeviceProcAddr')
write(' { "vk_layerGetPhysicalDeviceProcAddr",%sreinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceProcAddr) },' % (' ' * align), file=self.outFile)

write('};', file=self.outFile)
self.newline()
write('GFXRECON_END_NAMESPACE(gfxrecon)', file=self.outFile)
Expand Down
3 changes: 2 additions & 1 deletion layer/trace_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ VKAPI_ATTR VkResult VKAPI_CALL dispatch_CreateInstance(const VkInstanceCreateInf
if ((result == VK_SUCCESS) && pInstance && (*pInstance != nullptr))
{
add_instance_handle(*pInstance);
VkInstance unwrapped_instance = *pInstance;

encode::VulkanCaptureManager* manager = encode::VulkanCaptureManager::Get();
assert(manager != nullptr);
Expand All @@ -160,7 +161,7 @@ VKAPI_ATTR VkResult VKAPI_CALL dispatch_CreateInstance(const VkInstanceCreateInf
// Register the next layer's GetPhysicalDeviceProcAddr func only after *pInstance
// has been updated to our wrapper in manager->InitVkInstance() above:
auto fpNextGetPhysicalDeviceProcAddr = reinterpret_cast<PFN_GetPhysicalDeviceProcAddr>(
fpGetInstanceProcAddr(*pInstance, "vk_layerGetPhysicalDeviceProcAddr"));
fpGetInstanceProcAddr(unwrapped_instance, "vk_layerGetPhysicalDeviceProcAddr"));
set_instance_next_gpdpa(*pInstance, fpNextGetPhysicalDeviceProcAddr);
}
}
Expand Down

0 comments on commit 82e04fa

Please sign in to comment.