我正在努力弄清楚如何使用debugPrintfEXT,但没有运气。首先,我在我的顶点着色器中启用了扩展
#version 450
#extension GL_EXT_debug_printf : enable
void main()
{
debugPrintfEXT("Test");
// ... some more stuff here ...
}
然后,我为Vulkan实例指定必要的扩展。
VkValidationFeatureEnableEXT enables[] = {VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT};
VkValidationFeaturesEXT features = {};
features.sType = VK_STRUCTURE_TYPE_VALIDATION_FEATURES_EXT;
features.enabledValidationFeatureCount = 1;
features.pEnabledValidationFeatures = enables;
VkInstanceCreateInfo info = {};
info.pNext = &features;
在info.ppEnabledExtensionNames
字段中,我指定了VK_EXT_validation_features
和VK_EXT_debug_utils
等。
当我运行我的应用程序时,我得到以下日志
VUID_Undefined(ERROR / SPEC): msgNum: 2044605652 - Validation Error: [ VUID_Undefined ] Object 0: VK_NULL_HANDLE, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x79de34d4 | vkCreateDebugUtilsMessengerEXT: value of pCreateInfo->pNext must be NULL. This error is based on the Valid Usage documentation for version 182 of the Vulkan header. It is possible that you are using a struct from a private extension or an extension that was added to a later version of the Vulkan header, in which case the use of pCreateInfo->pNext is undefined and may not work correctly with validation enabled
Objects: 1
[0] 0, type: 3, name: NULL
[Debug][Error][Validation]"Validation Error: [ VUID-VkShaderModuleCreateInfo-pCode-04147 ] Object 0: handle = 0x5651b647e828, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x3d492883 | vkCreateShaderModule(): The SPIR-V Extension (SPV_KHR_non_semantic_info) was declared, but none of the requirements were met to use it. The Vulkan spec states: If pCode declares any of the SPIR-V extensions listed in the SPIR-V Environment appendix, one of the corresponding requirements must be satisfied (https://vulkan.lunarg.com/doc/view/1.2.182.0/linux/1.2-extensions/vkspec.html#VUID-VkShaderModuleCreateInfo-pCode-04147)"
我还能做什么?又是什么
必须满足相应的要求之一。
卑劣?我遗漏了什么吗?
编辑:
正如卡尔·舒尔茨( Karl )所建议的,有必要将VK_KHR_shader_non_semantic_info
添加到info.ppEnabledExtensionNames
中。
另外,请确保使用VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT
在VkDebugUtilsMessengerCreateInfoEXT::messageSeverity
中设置日志级别为INFO。默认情况下,debugPrintfEXT
产生的所有输出都有信息级别。
你也可以看到
Printf message was truncated, likely due to a buffer size that was too small for the message
如果你产生太多的线程,每个打印自己的长日志。
https://stackoverflow.com/questions/68575596
复制相似问题