Skip to content

Commit

Permalink
Update comments and explicitly request required extensions/GPU featur…
Browse files Browse the repository at this point in the history
…es for debugPrintfEXT

(cherry picked from commit 3365c7d974ae1cb7222cf35fdbe82accfa3fd926)
  • Loading branch information
SRSaunders committed Oct 25, 2024
1 parent 61c2d81 commit 7de0de5
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions samples/extensions/shader_debugprintf/shader_debugprintf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ ShaderDebugPrintf::ShaderDebugPrintf()
title = "Shader debugprintf";

add_device_extension(VK_KHR_SHADER_NON_SEMANTIC_INFO_EXTENSION_NAME);
add_device_extension(VK_KHR_TIMELINE_SEMAPHORE_EXTENSION_NAME);
}

ShaderDebugPrintf::~ShaderDebugPrintf()
Expand All @@ -68,6 +69,14 @@ ShaderDebugPrintf::~ShaderDebugPrintf()

void ShaderDebugPrintf::request_gpu_features(vkb::PhysicalDevice &gpu)
{
// debugPrintfEXT requires fragmentStoresAndAtomics, vertexPipelineStoresAndAtomics, and shaderInt64
gpu.get_mutable_requested_features().fragmentStoresAndAtomics = VK_TRUE;
gpu.get_mutable_requested_features().vertexPipelineStoresAndAtomics = VK_TRUE;
gpu.get_mutable_requested_features().shaderInt64 = VK_TRUE;

// debugPrintfEXT also requires the timelineSemaphore feature in the timelineSemaphore features struct
REQUEST_REQUIRED_FEATURE(gpu, VkPhysicalDeviceTimelineSemaphoreFeatures, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES, timelineSemaphore);

// Enable anisotropic filtering if supported
if (gpu.get_features().samplerAnisotropy)
{
Expand Down Expand Up @@ -467,8 +476,10 @@ std::unique_ptr<vkb::Instance> ShaderDebugPrintf::create_instance(bool headless)
return VulkanSample::create_instance(headless);
}

// Run remainder of this custom create_instance() (without layer settings support) and return
// As a fallack, run remainder of this custom create_instance() override (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);
Expand All @@ -492,7 +503,7 @@ 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
// Enable VK_EXT_validation_features 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
Expand Down

0 comments on commit 7de0de5

Please sign in to comment.