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

shader_debugprintf: support new VVL-DEBUG-PRINTF message and fix VVL version check for API selection #1187

Merged
merged 18 commits into from
Feb 25, 2025
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
8c00ce4
shader_debugprintf: support new VVL-DEBUG-PRINTF message and fix VVL …
SRSaunders Oct 9, 2024
0dc4963
Incorporate review feedback: update comments and simpify code
SRSaunders Oct 22, 2024
4f53d15
Add VK_EXT_validation_features and move VK_EXT_layer_settings extensi…
SRSaunders Oct 23, 2024
5fca9a6
Fix VK_EXT_layer_settings string comparison in [HPP]Instance::[HPP]In…
SRSaunders Oct 23, 2024
badd409
When VK_EXT_layer_settings extension is available don't enable it dur…
SRSaunders Oct 24, 2024
918cef1
Check for VK_EXT_layer_settings available vs. enabled in [HPP]Instanc…
SRSaunders Oct 24, 2024
61c2d81
Use vk::ExtensionProperties vs. VkExtensionProperties in HPPInstance:…
SRSaunders Oct 24, 2024
e23c4e5
Update comments and explicitly request required GPU features for debu…
SRSaunders Oct 25, 2024
bf7c37d
Check for defined layer settings before chaining-in layerSettingsCrea…
SRSaunders Oct 30, 2024
7484c6b
Check VVL instance extensions for VK_EXT_layer_settings and use #defi…
SRSaunders Oct 30, 2024
6b7f548
Merge branch 'main' into debugprintf-2
SRSaunders Nov 18, 2024
6b9329a
Merge branch 'KhronosGroup:main' into debugprintf-2
SRSaunders Nov 18, 2024
37d3dc6
Check for required GPU features otherwise throw exception with error …
SRSaunders Feb 7, 2025
cbe92fc
Update copyright year for all affected files
SRSaunders Feb 7, 2025
2969e5b
Merge branch 'main'
SRSaunders Feb 25, 2025
fc26c16
Review: Remove shaderInt64 feature request, Use %v3f shader print format
SRSaunders Feb 25, 2025
00d0408
Fix copyright dates in updated shaders
SRSaunders Feb 25, 2025
839291f
Update hwcpipe submodule to match main branch
SRSaunders Feb 25, 2025
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
Prev Previous commit
Next Next commit
Add VK_EXT_validation_features and move VK_EXT_layer_settings extensi…
…ons to ShaderDebugPrintf::create_instance()
SRSaunders committed Oct 23, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 4f53d1538db2b0abff42ea9fa703393ae3a9acb4
37 changes: 19 additions & 18 deletions samples/extensions/shader_debugprintf/shader_debugprintf.cpp
Original file line number Diff line number Diff line change
@@ -44,21 +44,6 @@ ShaderDebugPrintf::ShaderDebugPrintf()
title = "Shader debugprintf";

add_device_extension(VK_KHR_SHADER_NON_SEMANTIC_INFO_EXTENSION_NAME);

// If layer settings available, use it to configure validation layer for debugPrintfEXT
add_instance_extension(VK_EXT_LAYER_SETTINGS_EXTENSION_NAME, /*optional*/ true);

VkLayerSettingEXT layerSetting;
layerSetting.pLayerName = "VK_LAYER_KHRONOS_validation";
layerSetting.pSettingName = "enables";
layerSetting.type = VK_LAYER_SETTING_TYPE_STRING_EXT;
layerSetting.valueCount = 1;

// Make this static so layer setting reference remains valid after leaving constructor scope
static const char *layerEnables = "VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT";
layerSetting.pValues = &layerEnables;

add_layer_setting(layerSetting);
}

ShaderDebugPrintf::~ShaderDebugPrintf()
@@ -465,14 +450,27 @@ std::unique_ptr<vkb::Instance> ShaderDebugPrintf::create_instance(bool headless)
{
set_api_version(debugprintf_api_version);

// Run standard create_instance() from framework (with set_api_version and layer settings support) and return
// Since layer settings extension is available, use it to configure validation layer for debugPrintfEXT
add_instance_extension(VK_EXT_LAYER_SETTINGS_EXTENSION_NAME, /*optional*/ false);

VkLayerSettingEXT layerSetting;
layerSetting.pLayerName = "VK_LAYER_KHRONOS_validation";
layerSetting.pSettingName = "enables";
layerSetting.type = VK_LAYER_SETTING_TYPE_STRING_EXT;
layerSetting.valueCount = 1;

// Make this static so layer setting reference remains valid after leaving constructor scope
static const char *layerEnables = "VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT";
layerSetting.pValues = &layerEnables;

add_layer_setting(layerSetting);

// Run standard create_instance() from framework with set_api_version(), add_instance_extension(), and add_layer_setting() support
return VulkanSample::create_instance(headless);
}

// Run remainder of this custom create_instance() (without layer settings support) and return
std::vector<const char *> enabled_extensions;
enabled_extensions.push_back(VK_KHR_SURFACE_EXTENSION_NAME);

for (const char *extension_name : window->get_required_surface_extensions())
{
enabled_extensions.push_back(extension_name);
@@ -496,6 +494,9 @@ std::unique_ptr<vkb::Instance> ShaderDebugPrintf::create_instance(bool headless)
app_info.pEngineName = "Vulkan Samples";
app_info.apiVersion = debugprintf_api_version;

// Legacy extension for configuring validation layer features using VkValidationFeaturesEXT
enabled_extensions.push_back(VK_EXT_VALIDATION_FEATURES_EXTENSION_NAME);

// Shader printf is a feature of the validation layers that needs to be enabled
std::vector<VkValidationFeatureEnableEXT> validation_feature_enables = {VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT};