Skip to content

Add a new sample VK_KHR_device_address_commands. #1547

Open
gpx1000 wants to merge 6 commits into
KhronosGroup:mainfrom
gpx1000:device-address-commands
Open

Add a new sample VK_KHR_device_address_commands. #1547
gpx1000 wants to merge 6 commits into
KhronosGroup:mainfrom
gpx1000:device-address-commands

Conversation

@gpx1000

@gpx1000 gpx1000 commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

This requires updating Vulkan.

Tested in Ubuntu Linux on NVIDIA.

Description

Please include a summary of the change, new sample or fixed issue. Please also include relevant motivation and context.
Please read the contribution guidelines

Fixes #

General Checklist:

Please ensure the following points are checked:

  • My code follows the coding style
  • [ X I have reviewed file licenses
  • I have commented any added functions (in line with Doxygen)
  • I have commented any code that could be hard to understand
  • My changes do not add any new compiler warnings
  • My changes do not add any new validation layer errors or warnings
  • I have used existing framework/helper functions where possible
  • My changes do not add any regressions
  • I have tested every sample to ensure everything runs correctly
  • This PR describes the scope and expected impact of the changes I am making

Note: The Samples CI runs a number of checks including:

  • I have updated the header Copyright to reflect the current year (CI build will fail if Copyright is out of date)
  • My changes build on Windows, Linux, macOS and Android. Otherwise I have documented any exceptions

If this PR contains framework changes:

  • [ X I did a full batch run using the batch command line argument to make sure all samples still work properly

Sample Checklist

If your PR contains a new or modified sample, these further checks must be carried out in addition to the General Checklist:

  • I have tested the sample on at least one compliant Vulkan implementation
  • If the sample is vendor-specific, I have tagged it appropriately
  • I have stated on what implementation the sample has been tested so that others can test on different implementations and platforms
  • Any dependent assets have been merged and published in downstream modules
  • For new samples, I have added a paragraph with a summary to the appropriate chapter in the readme of the folder that the sample belongs to e.g. api samples readme
  • For new samples, I have added a tutorial README.md file to guide users through what they need to know to implement code using this feature. For example, see conditional_rendering
  • For new samples, I have added a link to the Antora navigation so that the sample will be listed at the Vulkan documentation site

@gary-sweet

Copy link
Copy Markdown
Contributor

This seems to run just fine for me, but I do get one validation error:

[error] 555635515 - VUID-VkDeviceCreateInfo-pNext-02830: vkCreateDevice(): pCreateInfo->pNext chain includes a VkPhysicalDeviceVulkan12Features structure, then it must not include a VkPhysicalDeviceHostQueryResetFeatures structure. The features in VkPhysicalDeviceHostQueryResetFeatures were promoted in Vulkan 1.2 and is also found in VkPhysicalDeviceVulkan12Features. To prevent one feature setting something to VK_TRUE and the other to VK_FALSE, only one struct containing the feature is allowed.
pNext chain: VkDeviceCreateInfo::pNext -> [VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO] -> [VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO] -> [VkPhysicalDeviceSynchronization2Features] -> [VkPhysicalDeviceDeviceAddressCommandsFeaturesKHR] -> [VkPhysicalDeviceVulkan12Features] -> [VkPhysicalDeviceHostQueryResetFeatures] -> [VkPhysicalDevicePerformanceQueryFeaturesKHR].
The Vulkan spec states: If the pNext chain includes a VkPhysicalDeviceVulkan12Features structure, then it must not include a VkPhysicalDevice8BitStorageFeatures, VkPhysicalDeviceShaderAtomicInt64Features, VkPhysicalDeviceShaderFloat16Int8Features, VkPhysicalDeviceDescriptorIndexingFeatures, VkPhysicalDeviceScalarBlockLayoutFeatures, VkPhysicalDeviceImagelessFramebufferFeatures, VkPhysicalDeviceUniformBufferStandardLayoutFeatures, VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures, VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures, VkPhysicalDeviceHostQueryResetFeatures, VkPhysicalDeviceTimelineSemaphoreFeatures, VkPhysicalDeviceBufferDeviceAddressFeatures, or VkPhysicalDeviceVulkanMemoryModelFeatures structure (https://docs.vulkan.org/spec/latest/chapters/devsandqueues.html#VUID-VkDeviceCreateInfo-pNext-02830)

gary-sweet
gary-sweet previously approved these changes Jun 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new Vulkan-Samples extension sample showcasing VK_KHR_device_address_commands, demonstrating a GPU-driven rendering path that records bind/fill/update/draw operations using device addresses (instead of VkBuffer handles), along with accompanying documentation and build/docs integration.

Changes:

  • Added a new device_address_commands extension sample implementation (C++), including runtime loading of VK_KHR_device_address_commands entry points and address-range barriers.
  • Added GLSL + Slang shader implementations for compute-driven animation/culling and indirect drawing.
  • Integrated the sample into the extensions README, Antora navigation, and the sample build order list.

Reviewed changes

Copilot reviewed 16 out of 22 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
samples/extensions/device_address_commands/device_address_commands.cpp New sample implementation using address-based fill/update/bind/draw + memory-range barriers
samples/extensions/device_address_commands/device_address_commands.h Sample interface + shared constants and push-constant struct definitions
samples/extensions/device_address_commands/CMakeLists.txt Build integration for the new sample and shader compilation inputs
shaders/device_address_commands/glsl/update_objects.comp Compute shader (GLSL) that animates objects, culls, and emits indirect commands
shaders/device_address_commands/glsl/render.vert Vertex shader (GLSL) reading camera/transforms via buffer references in push constants
shaders/device_address_commands/glsl/render.frag Fragment shader (GLSL) outputting per-instance color
shaders/device_address_commands/slang/update_objects.comp.slang Compute shader (Slang) equivalent using pointer-based access
shaders/device_address_commands/slang/render.vert.slang Vertex shader (Slang) equivalent using pointer-based access
shaders/device_address_commands/slang/render.frag.slang Fragment shader (Slang) equivalent
samples/extensions/device_address_commands/README.adoc New tutorial-style documentation for the sample and extension concepts
samples/extensions/README.adoc Adds the new sample to the Extensions samples README list
samples/CMakeLists.txt Adds the sample to the global sample ordering list
antora/modules/ROOT/nav.adoc Adds the new sample docs page to the Antora navigation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread samples/extensions/device_address_commands/device_address_commands.cpp Outdated
Comment thread samples/extensions/device_address_commands/device_address_commands.h Outdated
Comment thread samples/extensions/device_address_commands/README.adoc Outdated
Comment thread samples/extensions/device_address_commands/README.adoc Outdated
Comment thread shaders/device_address_commands/slang/update_objects.comp.slang
Comment thread shaders/device_address_commands/slang/update_objects.comp.slang Outdated
Comment thread shaders/device_address_commands/glsl/update_objects.comp

@SaschaWillems SaschaWillems left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sample is working for me on WIn11 and an nv RTX 4070.

I noticed a few naming/styling related thing in code that should be improved. But nothing functional.

Comment thread samples/extensions/device_address_commands/device_address_commands.cpp Outdated
Comment thread samples/extensions/device_address_commands/device_address_commands.h Outdated
Comment thread samples/extensions/device_address_commands/device_address_commands.cpp Outdated
Comment thread samples/extensions/device_address_commands/device_address_commands.cpp Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants