vkEnumerateDeviceExtensionProperties 抛出神秘的错误代码
vkEnumerateDeviceExtensionProperties Throwing mysterious error code
我跟着这个 vulkan tutorial 到达了交换链部分。
我复制粘贴了有关修改 checkDeviceExtensionProperties 的部分,这让我得到了这个功能:
//globally declared at the top of the file
const std::vector<const char*> deviceExtensions = {
VK_KHR_SWAPCHAIN_EXTENSION_NAME
};
/* code */
bool checkDeviceExtensionSupport(VkPhysicalDevice pDevice) {
uint32_t extensionCount;
vkEnumerateDeviceExtensionProperties(pDevice, nullptr, &extensionCount, nullptr);
std::vector<VkExtensionProperties> availableExtensions(extensionCount);
vkEnumerateDeviceExtensionProperties(pDevice, nullptr, &extensionCount, availableExtensions.data());
/* std::set<std::string> requiredExtensions(deviceExtensions.begin(), deviceExtensions.end());
for (const auto& extension : availableExtensions) {
requiredExtensions.erase(extension.extensionName);
}*/
return true;//requiredExtensions.empty();
}
当我取消注释函数 vkEnumerateDeviceExtensionProperties
时抛出一个错误。
调试回调返回的错误码(即VkDebugUtilsMessageSeverityFlagBitsEXT
的位)为0b10000。这是 vulkan_core.h
.
中定义的位中的 none
关于我可能搞砸了什么有什么建议吗?
编辑:
调试消息的输出是:
[...]
validation layer: Device Extension: VK_KHR_device_group (libGLX_nvidia.so.0) version 0.0.3
Loader Message
16
validation layer: Device Extension: VK_KHR_draw_indirect_count (libGLX_nvidia.so.0) version 0.0.1
Loader Message
16
validation layer: Device Extension: VK_KHR_driver_properties (libGLX_nvidia.so.0) version 0.0.1
Loader Message
16
validation layer: Device Extension: VK_KHR_external_fence (libGLX_nvidia.so.0) version 0.0.1
Loader Message
16
validation layer: Device Extension: VK_KHR_external_fence_fd (libGLX_nvidia.so.0) version 0.0.1
Loader Message
16
validation layer: Device Extension: VK_KHR_external_memory (libGLX_nvidia.so.0) version 0.0.1
Loader Message
16
validation layer: Device Extension: VK_KHR_external_memory_fd (libGLX_nvidia.so.0) version 0.0.1
Loader Message
16
validation layer: Device Extension: VK_KHR_external_semaphore (libGLX_nvidia.so.0) version 0.0.1
Loader Message
16
validation layer: Device Extension: VK_KHR_external_semaphore_fd (libGLX_nvidia.so.0) version 0.0.1
Loader Message
16
validation layer: Device Extension: VK_KHR_get_memory_requirements2 (libGLX_nvidia.so.0) version 0.0.1
Loader Message
16
validation layer: Device Extension: VK_KHR_image_format_list (libGLX_nvidia.so.0) version 0.0.1
[...]
调试回调是:
static VKAPI_ATTR VkBool32 VKAPI_CALL debugCallback(
VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
VkDebugUtilsMessageTypeFlagsEXT messageType,
const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData,
void* pUserData) {
std::cerr << "validation layer: " << pCallbackData->pMessage << std::endl;
cout << pCallbackData->pMessageIdName << endl;
cout << messageSeverity << endl;
if (messageSeverity >= VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT) {
// Message is important enough to show
}
return VK_FALSE;
}
0b10000
是 VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT
。当您使用 vkCreateDebugUtilsMessengerEXT
.
创建回调时,只需过滤 INFO
消息
我跟着这个 vulkan tutorial 到达了交换链部分。
我复制粘贴了有关修改 checkDeviceExtensionProperties 的部分,这让我得到了这个功能:
//globally declared at the top of the file
const std::vector<const char*> deviceExtensions = {
VK_KHR_SWAPCHAIN_EXTENSION_NAME
};
/* code */
bool checkDeviceExtensionSupport(VkPhysicalDevice pDevice) {
uint32_t extensionCount;
vkEnumerateDeviceExtensionProperties(pDevice, nullptr, &extensionCount, nullptr);
std::vector<VkExtensionProperties> availableExtensions(extensionCount);
vkEnumerateDeviceExtensionProperties(pDevice, nullptr, &extensionCount, availableExtensions.data());
/* std::set<std::string> requiredExtensions(deviceExtensions.begin(), deviceExtensions.end());
for (const auto& extension : availableExtensions) {
requiredExtensions.erase(extension.extensionName);
}*/
return true;//requiredExtensions.empty();
}
当我取消注释函数 vkEnumerateDeviceExtensionProperties
时抛出一个错误。
调试回调返回的错误码(即VkDebugUtilsMessageSeverityFlagBitsEXT
的位)为0b10000。这是 vulkan_core.h
.
关于我可能搞砸了什么有什么建议吗?
编辑:
调试消息的输出是:
[...]
validation layer: Device Extension: VK_KHR_device_group (libGLX_nvidia.so.0) version 0.0.3
Loader Message
16
validation layer: Device Extension: VK_KHR_draw_indirect_count (libGLX_nvidia.so.0) version 0.0.1
Loader Message
16
validation layer: Device Extension: VK_KHR_driver_properties (libGLX_nvidia.so.0) version 0.0.1
Loader Message
16
validation layer: Device Extension: VK_KHR_external_fence (libGLX_nvidia.so.0) version 0.0.1
Loader Message
16
validation layer: Device Extension: VK_KHR_external_fence_fd (libGLX_nvidia.so.0) version 0.0.1
Loader Message
16
validation layer: Device Extension: VK_KHR_external_memory (libGLX_nvidia.so.0) version 0.0.1
Loader Message
16
validation layer: Device Extension: VK_KHR_external_memory_fd (libGLX_nvidia.so.0) version 0.0.1
Loader Message
16
validation layer: Device Extension: VK_KHR_external_semaphore (libGLX_nvidia.so.0) version 0.0.1
Loader Message
16
validation layer: Device Extension: VK_KHR_external_semaphore_fd (libGLX_nvidia.so.0) version 0.0.1
Loader Message
16
validation layer: Device Extension: VK_KHR_get_memory_requirements2 (libGLX_nvidia.so.0) version 0.0.1
Loader Message
16
validation layer: Device Extension: VK_KHR_image_format_list (libGLX_nvidia.so.0) version 0.0.1
[...]
调试回调是:
static VKAPI_ATTR VkBool32 VKAPI_CALL debugCallback(
VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
VkDebugUtilsMessageTypeFlagsEXT messageType,
const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData,
void* pUserData) {
std::cerr << "validation layer: " << pCallbackData->pMessage << std::endl;
cout << pCallbackData->pMessageIdName << endl;
cout << messageSeverity << endl;
if (messageSeverity >= VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT) {
// Message is important enough to show
}
return VK_FALSE;
}
0b10000
是 VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT
。当您使用 vkCreateDebugUtilsMessengerEXT
.
INFO
消息