Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable debugPrintf example on macOS using validation layer #1124

Merged
merged 1 commit into from
May 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions examples/debugprintf/debugprintf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ class VulkanExample : public VulkanExampleBase

// Using printf requires the non semantic info extension to be enabled
enabledDeviceExtensions.push_back(VK_KHR_SHADER_NON_SEMANTIC_INFO_EXTENSION_NAME);

#if (defined(VK_USE_PLATFORM_MACOS_MVK) || defined(VK_USE_PLATFORM_METAL_EXT)) && defined(VK_EXAMPLE_XCODE_GENERATED)
// SRS - Force validation on since debugPrintfEXT provided by VK_LAYER_KHRONOS_validation on macOS
settings.validation = true;
setenv("VK_LAYER_ENABLES", "VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT", 1);

// SRS - RenderDoc not available on macOS so redirect debugPrintfEXT output to stdout
setenv("VK_KHRONOS_VALIDATION_PRINTF_TO_STDOUT", "1", 1);
#endif
}

~VulkanExample()
Expand Down
Loading