Reputation: 2649
I can't get debugPrintfEXT
to work. I don't see what I'm missing.
Steps I've takens:
VK_EXT_debug_utils
; Verified using Nvidia Nsight.#extension GL_EXT_debug_printf : enable
to vertex shader.debugPrintfEXT("Foo")
in vertex shader.Code:
vk::InstanceCreateInfo createInfo;
std::vector valFeaturesEnabled = {vk::ValidationFeatureEnableEXT::eDebugPrintf};
vk::ValidationFeaturesEXT valFeatures;
valFeatures.enabledValidationFeatureCount = (uint32_t) valFeaturesEnabled.size();
valFeatures.pEnabledValidationFeatures = valFeaturesEnabled.data();
createInfo.setPNext(&valFeatures);
Details:
Upvotes: 2
Views: 1817
Reputation: 1556
What you're doing should work.
I've gotten it to work by making some small changes to the "hello triangle" sample in Khronos Vulkan-Samples.
Force usage of the validation layer for both Debug and Release builds by building with the CMake option -DVKB_VALIDATION_LAYERS=ON
or by adding a define at the top of hello_triangle.cpp
. Since the project activates the validation layer in a Debug build, you can skip this step if you stick with a Debug build.
#define VKB_VALIDATION_LAYERS
Add the VK_DEBUG_REPORT_INFORMATION_BIT_EXT
flag to debug_report_create_info.flags
. The documentation for this requirement isn't clear but is going to be fixed shortly. You were already doing this.
Add the following code just before the call to vkCreateInstance
. It is essentially the same as the code you pasted.
VkValidationFeatureEnableEXT enabled[] = {VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT};
VkValidationFeaturesEXT features{VK_STRUCTURE_TYPE_VALIDATION_FEATURES_EXT};
features.disabledValidationFeatureCount = 0;
features.enabledValidationFeatureCount = 1;
features.pDisabledValidationFeatures = nullptr;
features.pEnabledValidationFeatures = enabled;
features.pNext = instance_info.pNext;
instance_info.pNext = &features;
And make the same changes to the vertex shader that you did.
If you can get it working with this sample, perhaps you will see what you're doing differently in your application.
Upvotes: 2