c++ - Vulkan:AMD vkCmdDebugMarkerBeginEXT 仅在 vkGetInstanceProcAddr 中找到

标签 c++ vulkan amd-gpu

我在使用 vkGetDeviceProcAddr 获取 vkCmdDebugMarkerBeginEXT 句柄时遇到了一些奇怪的行为,这在 AMD 和 Nvidia 之间是不同的。但是,使用 vkGetInstanceProcAddr 是可行的。

VkDevice device = ...; // valid initialized device
VkInstance instance = ...; // valid initialized instance

PFN_vkVoidFunction fnDevice = vkGetDeviceProcAddr(device, "vkCmdDebugMarkerBeginEXT");
// fnDevice == nullptr on AMD. Non-null on Nvidia
PFN_vkVoidFunction fnInstance = vkGetInstanceProcAddr(instance, "vkCmdDebugMarkerBeginEXT");
// fnInstance == Non-null on both

来自layer interface文档:

vkGetDeviceProcAddr can only be used to query for device extension or core device entry points. Device entry points include any command that uses a VkDevice as the first parameter or a dispatchable object that is a child of a VkDevice (currently this includes VkQueue and VkCommandBuffer). vkGetInstanceProcAddr can be used to query either device or instance extension entry points in addition to all core entry points.

vkCmdDebugMarkerBeginEXT 的原型(prototype)似乎符合以下描述:

VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerBeginEXT(
    VkCommandBuffer                             commandBuffer,
    VkDebugMarkerMarkerInfoEXT*                 pMarkerInfo);

虽然我可以很容易地调用设备版本,如果失败,调用实例版本(以避免额外的调度成本,如果可能的话),我想知道这是预期的行为还是驱动程序错误?

最佳答案

是的,vkCmdDebugMarkerBeginEXT 符合该描述。

你应该引用 Vulkan spec相反(IMO 在这件事上应该有更高的指定权力)。

还有一个附加要求:必须在该设备 上启用特定扩展,vkGetDeviceProcAddr 才能工作。否则看起来像是驱动程序错误。

事实上,in-spec Example 2确实使用 vkGetDeviceProcAddr

关于c++ - Vulkan:AMD vkCmdDebugMarkerBeginEXT 仅在 vkGetInstanceProcAddr 中找到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43005218/

相关文章:

c++ - 如何将字符串中的单个字符转换为 int

c++ - Windows TPM 虚拟智能卡 RSA key 存储

c++ - 替代虚拟模板

windows - Vulkan 在 Linux 上找不到物理设备

c++ - 在 vk_chopper 上使用 cmake 时出错

c++ - 如何使用级联阴影贴图制作柔和阴影?

macos - Mac OSX 10.10 AMD APP SDK 位置

opencl - amdgpu-pro 安装失败,现在依赖问题

c++ - Qthread信号发出未连接

c++ - samplerCube 数组