Repository navigation
Refactor chaining of DeviceCreateInfo - #1588
asuessenbach wants to merge 8 commits into
Conversation
6cdbddf to
251d24c
Compare
|
Apple builds are failing because several |
| ApiVulkanSample::submit_frame(); | ||
| } | ||
|
|
||
| void BufferDeviceAddress::extend_device_create_info(vkb::StructureChainBuilderC<VkDeviceCreateInfo> &scb) |
There was a problem hiding this comment.
This reads much harder then the old code :/
E.g. why is that assert(create_info) needed now?
There was a problem hiding this comment.
E.g. why is that assert(create_info) needed now?
I think I don't get what you're asking for...
Before I use a pointer, I tend to check its validity. If it's allowed to be a nullptr, I'm using a runtime-check. Otherwise, when a nullptr would be a hint for a programming error, I'm using an assert.
This reads much harder then the old code :/
That may be true. But I think this way is safer.
Previously, the structure chain was controlled by vkb::core::PhysicalDevice just to create the vkb::core::Device. Now this chain is built as needed, making its handling more localized. And there’s now exactly one place in the code where you can extend it. This way, there’s no room for ambiguity.
And as a side effect—but this is exactly why I initiated this PR—vkb::core::PhysicalDevice is now a bit less complex.
2b3d208 to
6fd5496
Compare
|
A few words to justify this PR a bit more... Before this PR
I would say that the reusability of this construct is fairly low. With this PR
I think, the code is not harder to read than before, just different. However, the potential for reuse is significantly higher. |
There was a problem hiding this comment.
🟡 Changes recommended
Portability compilation failures, invalid or missing device-feature setup, and optional-feature fallback regressions block approval.
8 open issues
Request device fault feature alongside the extension · New Initialize fragment density map feature structure type · New Only enable dynamic FDM when fragment density map is supported · New Remove unrelated feature requests from ray-query device setup · New Only enable swapchain maintenance1 when supported · New Preserve optional address-binding reporting behavior · New Conditionally enable optional shader float16 support · New Use portability extension name instead of version constant · New
What changed in this PR
This PR moves device feature-chain construction into StructureChainBuilder, aligning device creation with the framework’s instance-creation pattern.
Changes:
- Adds an
extend_device_create_infohook and migrates sample feature enablement to it. - Removes feature-chain storage from
PhysicalDeviceand introduces chain-based feature helpers. - Renames supported-feature accessors and updates C and Vulkan-Hpp callers.
| File | Description |
|---|---|
| samples/tooling/profiles/profiles.cpp | Uses the builder for profile-based device creation. |
| samples/performance/texture_compression_comparison/texture_compression_comparison.cpp | Updates supported-feature queries. |
| samples/performance/texture_compression_basisu/texture_compression_basisu.cpp | Updates supported-feature queries. |
| samples/performance/multithreading_render_passes/multithreading_render_passes.h | Declares the portability feature hook. |
| samples/performance/multithreading_render_passes/multithreading_render_passes.cpp | Migrates portability feature enablement. |
| samples/performance/multi_draw_indirect/multi_draw_indirect.h | Declares the device-chain hook. |
| samples/performance/multi_draw_indirect/multi_draw_indirect.cpp | Migrates buffer-address feature enablement. |
| samples/performance/image_compression_control/image_compression_control.h | Replaces the feature-request override. |
| samples/performance/image_compression_control/image_compression_control.cpp | Chains enabled compression-extension features. |
| samples/performance/hpp_texture_compression_comparison/hpp_texture_compression_comparison.cpp | Updates supported-feature queries. |
| samples/performance/constant_data/constant_data.cpp | Updates supported-feature queries. |
| samples/performance/async_compute/async_compute.h | Declares the portability feature hook. |
| samples/performance/async_compute/async_compute.cpp | Migrates portability feature enablement. |
| samples/performance/16bit_storage_input_output/16bit_storage_input_output.h | Replaces the feature-request override. |
| samples/performance/16bit_storage_input_output/16bit_storage_input_output.cpp | Chains 16-bit storage features. |
| samples/performance/16bit_arithmetic/16bit_arithmetic.h | Replaces the feature-request override. |
| samples/performance/16bit_arithmetic/16bit_arithmetic.cpp | Migrates storage and arithmetic features. |
| samples/general/mobile_nerf/mobile_nerf.h | Replaces the feature-request override. |
| samples/general/mobile_nerf/mobile_nerf.cpp | Chains descriptor-indexing features. |
| samples/general/mobile_nerf_rayquery/mobile_nerf_rayquery.h | Replaces the feature-request override. |
| samples/general/mobile_nerf_rayquery/mobile_nerf_rayquery.cpp | Migrates ray-query and descriptor features. |
| samples/extensions/vertex_dynamic_state/vertex_dynamic_state.h | Declares the device-chain hook. |
| samples/extensions/vertex_dynamic_state/vertex_dynamic_state.cpp | Chains dynamic vertex-input features. |
| samples/extensions/timeline_semaphore/timeline_semaphore.h | Replaces the feature-request override. |
| samples/extensions/timeline_semaphore/timeline_semaphore.cpp | Chains timeline-semaphore features. |
| samples/extensions/tensor_and_data_graph/tensor_image_aliasing/tensor_image_aliasing.h | Declares the device-chain hook. |
| samples/extensions/tensor_and_data_graph/tensor_image_aliasing/tensor_image_aliasing.cpp | Migrates tensor and graph features. |
| samples/extensions/tensor_and_data_graph/simple_tensor_and_data_graph/simple_tensor_and_data_graph.h | Declares the device-chain hook. |
| samples/extensions/tensor_and_data_graph/simple_tensor_and_data_graph/simple_tensor_and_data_graph.cpp | Chains tensor, graph, and compression features. |
| samples/extensions/tensor_and_data_graph/postprocessing_with_vgf/postprocessing_with_vgf.h | Declares the device-chain hook. |
| samples/extensions/tensor_and_data_graph/postprocessing_with_vgf/postprocessing_with_vgf.cpp | Migrates tensor and graph features. |
| samples/extensions/tensor_and_data_graph/graph_constants/graph_constants.h | Declares the device-chain hook. |
| samples/extensions/tensor_and_data_graph/graph_constants/graph_constants.cpp | Migrates tensor and graph features. |
| samples/extensions/tensor_and_data_graph/compute_shaders_with_tensors/compute_shaders_with_tensors.h | Declares the device-chain hook. |
| samples/extensions/tensor_and_data_graph/compute_shaders_with_tensors/compute_shaders_with_tensors.cpp | Migrates tensor and graph features. |
| samples/extensions/synchronization_2/synchronization_2.h | Declares the device-chain hook. |
| samples/extensions/synchronization_2/synchronization_2.cpp | Chains synchronization2 features. |
| samples/extensions/sparse_image/sparse_image.cpp | Updates supported-feature queries. |
| samples/extensions/shader_relaxed_extended_instruction/shader_relaxed_extended_instruction.h | Replaces the feature-request override. |
| samples/extensions/shader_relaxed_extended_instruction/shader_relaxed_extended_instruction.cpp | Migrates shader feature enablement. |
| samples/extensions/shader_quad_control/shader_quad_control.h | Replaces the feature-request override. |
| samples/extensions/shader_quad_control/shader_quad_control.cpp | Chains shader quad-control features. |
| samples/extensions/shader_object/shader_object.h | Declares the device-chain hook. |
| samples/extensions/shader_object/shader_object.cpp | Migrates shader-object and rendering features. |
| samples/extensions/shader_debugprintf/shader_debugprintf.cpp | Updates supported-feature queries. |
| samples/extensions/ray_tracing_reflection/ray_tracing_reflection.h | Declares the device-chain hook. |
| samples/extensions/ray_tracing_reflection/ray_tracing_reflection.cpp | Migrates ray-tracing feature enablement. |
| samples/extensions/ray_tracing_position_fetch/ray_tracing_position_fetch.h | Declares the device-chain hook. |
| samples/extensions/ray_tracing_position_fetch/ray_tracing_position_fetch.cpp | Migrates ray-tracing and position-fetch features. |
| samples/extensions/ray_tracing_invocation_reorder/ray_tracing_invocation_reorder.h | Declares the device-chain hook. |
| samples/extensions/ray_tracing_invocation_reorder/ray_tracing_invocation_reorder.cpp | Migrates ray-tracing features and extension selection. |
| samples/extensions/ray_tracing_extended/ray_tracing_extended.h | Declares the device-chain hook. |
| samples/extensions/ray_tracing_extended/ray_tracing_extended.cpp | Migrates ray-tracing and indexing features. |
| samples/extensions/ray_tracing_basic/ray_tracing_basic.h | Declares the device-chain hook. |
| samples/extensions/ray_tracing_basic/ray_tracing_basic.cpp | Migrates ray-tracing feature enablement. |
| samples/extensions/ray_queries/ray_queries.h | Replaces the feature-request override. |
| samples/extensions/ray_queries/ray_queries.cpp | Moves feature setup into the device chain. |
| samples/extensions/rasterization_order_attachment_access/rasterization_order_attachment_access.h | Replaces the feature-request override. |
| samples/extensions/rasterization_order_attachment_access/rasterization_order_attachment_access.cpp | Migrates rendering features and optional attachment access. |
| samples/extensions/push_descriptors/push_descriptors.cpp | Updates supported-feature queries. |
| samples/extensions/portability/portability.cpp | Updates supported-feature queries. |
| samples/extensions/pipeline_binary/pipeline_binary.h | Replaces the feature-request override. |
| samples/extensions/pipeline_binary/pipeline_binary.cpp | Chains pipeline-binary features. |
| samples/extensions/patch_control_points/patch_control_points.h | Declares the device-chain hook. |
| samples/extensions/patch_control_points/patch_control_points.cpp | Migrates extended dynamic-state features. |
| samples/extensions/mesh_shading/mesh_shading.h | Replaces the feature-request override. |
| samples/extensions/mesh_shading/mesh_shading.cpp | Chains mesh-shader features. |
| samples/extensions/mesh_shader_culling/mesh_shader_culling.h | Declares the device-chain hook. |
| samples/extensions/mesh_shader_culling/mesh_shader_culling.cpp | Migrates mesh features and updates capability queries. |
| samples/extensions/memory_budget/memory_budget.cpp | Updates supported-feature queries. |
| samples/extensions/logic_op_dynamic_state/logic_op_dynamic_state.h | Declares the device-chain hook. |
| samples/extensions/logic_op_dynamic_state/logic_op_dynamic_state.cpp | Migrates dynamic-state and topology features. |
| samples/extensions/hpp_push_descriptors/hpp_push_descriptors.cpp | Updates supported-feature queries. |
| samples/extensions/hpp_mesh_shading/hpp_mesh_shading.h | Declares the Vulkan-Hpp device-chain hook. |
| samples/extensions/hpp_mesh_shading/hpp_mesh_shading.cpp | Chains Vulkan-Hpp mesh-shader features. |
| samples/extensions/host_image_copy/host_image_copy.h | Declares the device-chain hook. |
| samples/extensions/host_image_copy/host_image_copy.cpp | Migrates host-image-copy feature enablement. |
| samples/extensions/gshader_to_mshader/gshader_to_mshader.h | Declares the device-chain hook. |
| samples/extensions/gshader_to_mshader/gshader_to_mshader.cpp | Chains mesh-shader features. |
| samples/extensions/graphics_pipeline_library/graphics_pipeline_library.h | Replaces the feature-request override. |
| samples/extensions/graphics_pipeline_library/graphics_pipeline_library.cpp | Chains graphics-pipeline-library features. |
| samples/extensions/fragment_shading_rate/fragment_shading_rate.h | Declares the device-chain hook. |
| samples/extensions/fragment_shading_rate/fragment_shading_rate.cpp | Chains attachment shading-rate features. |
| samples/extensions/fragment_shading_rate_dynamic/fragment_shading_rate_dynamic.h | Declares the device-chain hook. |
| samples/extensions/fragment_shading_rate_dynamic/fragment_shading_rate_dynamic.cpp | Chains attachment and pipeline shading-rate features. |
| samples/extensions/fragment_shader_barycentric/fragment_shader_barycentric.h | Declares the device-chain hook. |
| samples/extensions/fragment_shader_barycentric/fragment_shader_barycentric.cpp | Migrates barycentric feature enablement. |
| samples/extensions/fragment_density_map/fragment_density_map.h | Declares the device-chain hook. |
| samples/extensions/fragment_density_map/fragment_density_map.cpp | Builds an explicit density-map feature structure. |
| samples/extensions/extended_dynamic_state2/extended_dynamic_state2.h | Declares the device-chain hook. |
| samples/extensions/extended_dynamic_state2/extended_dynamic_state2.cpp | Migrates dynamic-state and topology features. |
| samples/extensions/dynamic_rendering/dynamic_rendering.h | Declares the device-chain hook. |
| samples/extensions/dynamic_rendering/dynamic_rendering.cpp | Migrates conditional dynamic-rendering enablement. |
| samples/extensions/dynamic_rendering_local_read/dynamic_rendering_local_read.h | Declares the device-chain hook. |
| samples/extensions/dynamic_rendering_local_read/dynamic_rendering_local_read.cpp | Migrates rendering, local-read, and synchronization features. |
| samples/extensions/dynamic_primitive_clipping/dynamic_primitive_clipping.h | Declares the device-chain hook. |
| samples/extensions/dynamic_primitive_clipping/dynamic_primitive_clipping.cpp | Migrates dynamic depth-clipping features. |
| samples/extensions/dynamic_multisample_rasterization/dynamic_multisample_rasterization.h | Replaces the feature-request override. |
| samples/extensions/dynamic_multisample_rasterization/dynamic_multisample_rasterization.cpp | Migrates multisample and rendering features. |
| samples/extensions/dynamic_line_rasterization/dynamic_line_rasterization.h | Declares the device-chain hook. |
| samples/extensions/dynamic_line_rasterization/dynamic_line_rasterization.cpp | Migrates line-rasterization and dynamic-state features. |
| samples/extensions/dynamic_blending/dynamic_blending.h | Replaces the feature-request override. |
| samples/extensions/dynamic_blending/dynamic_blending.cpp | Migrates required and optional blending features. |
| samples/extensions/device_fault/device_fault.h | Replaces the feature-request override. |
| samples/extensions/device_fault/device_fault.cpp | Moves fault-related setup into the device chain. |
| samples/extensions/descriptor_indexing/descriptor_indexing.h | Declares the device-chain hook. |
| samples/extensions/descriptor_indexing/descriptor_indexing.cpp | Migrates descriptor-indexing features. |
| samples/extensions/descriptor_heap/descriptor_heap.h | Declares the device-chain hook. |
| samples/extensions/descriptor_heap/descriptor_heap.cpp | Migrates descriptor-heap and supporting features. |
| samples/extensions/descriptor_buffer_basic/descriptor_buffer_basic.h | Declares the device-chain hook. |
| samples/extensions/descriptor_buffer_basic/descriptor_buffer_basic.cpp | Migrates descriptor-buffer and address features. |
| samples/extensions/debug_utils/debug_utils.cpp | Updates supported-feature queries. |
| samples/extensions/conservative_rasterization/conservative_rasterization.cpp | Updates supported-feature queries. |
| samples/extensions/conditional_rendering/conditional_rendering.h | Replaces the feature-request override. |
| samples/extensions/conditional_rendering/conditional_rendering.cpp | Chains conditional-rendering features. |
| samples/extensions/compute_shader_derivatives/compute_shader_derivatives.h | Declares the device-chain hook. |
| samples/extensions/compute_shader_derivatives/compute_shader_derivatives.cpp | Migrates optional derivative-group features. |
| samples/extensions/color_write_enable/color_write_enable.h | Declares the device-chain hook. |
| samples/extensions/color_write_enable/color_write_enable.cpp | Migrates color-write feature enablement. |
| samples/extensions/calibrated_timestamps/calibrated_timestamps.h | Declares the device-chain hook. |
| samples/extensions/calibrated_timestamps/calibrated_timestamps.cpp | Chains synchronization2 features. |
| samples/extensions/buffer_device_address/buffer_device_address.h | Replaces the feature-request override. |
| samples/extensions/buffer_device_address/buffer_device_address.cpp | Chains buffer-device-address features. |
| samples/api/timestamp_queries/timestamp_queries.cpp | Updates supported-feature queries. |
| samples/api/texture_mipmap_generation/texture_mipmap_generation.cpp | Updates supported-feature queries. |
| samples/api/texture_loading/texture_loading.cpp | Updates supported-feature queries. |
| samples/api/terrain_tessellation/terrain_tessellation.cpp | Updates supported-feature queries. |
| samples/api/swapchain_recreation/swapchain_recreation.h | Replaces the feature-request override. |
| samples/api/swapchain_recreation/swapchain_recreation.cpp | Migrates optional swapchain-maintenance features. |
| samples/api/swapchain_present_timing/swapchain_present_timing.h | Replaces the feature-request override. |
| samples/api/swapchain_present_timing/swapchain_present_timing.cpp | Migrates presentation-timing and rendering features. |
| samples/api/separate_image_sampler/separate_image_sampler.cpp | Updates supported-feature queries. |
| samples/api/oit_linked_lists/oit_linked_lists.h | Declares the device-chain hook. |
| samples/api/oit_linked_lists/oit_linked_lists.cpp | Chains synchronization2 features. |
| samples/api/oit_depth_peeling/oit_depth_peeling.cpp | Updates supported-feature queries. |
| samples/api/instancing/instancing.cpp | Updates supported-feature queries. |
| samples/api/hpp_timestamp_queries/hpp_timestamp_queries.cpp | Updates supported-feature queries. |
| samples/api/hpp_texture_mipmap_generation/hpp_texture_mipmap_generation.cpp | Updates supported-feature queries. |
| samples/api/hpp_texture_loading/hpp_texture_loading.cpp | Updates supported-feature queries. |
| samples/api/hpp_terrain_tessellation/hpp_terrain_tessellation.cpp | Updates supported-feature queries. |
| samples/api/hpp_separate_image_sampler/hpp_separate_image_sampler.cpp | Updates supported-feature queries. |
| samples/api/hpp_oit_linked_lists/hpp_oit_linked_lists.h | Declares the Vulkan-Hpp device-chain hook. |
| samples/api/hpp_oit_linked_lists/hpp_oit_linked_lists.cpp | Chains Vulkan-Hpp synchronization2 features. |
| samples/api/hpp_oit_depth_peeling/hpp_oit_depth_peeling.cpp | Updates supported-feature queries. |
| samples/api/hpp_instancing/hpp_instancing.cpp | Updates supported-feature queries. |
| samples/api/hpp_hdr/hpp_hdr.cpp | Updates supported-feature queries. |
| samples/api/hpp_compute_nbody/hpp_compute_nbody.cpp | Updates supported-feature queries. |
| samples/api/hdr/hdr.cpp | Updates supported-feature queries. |
| samples/api/compute_nbody/compute_nbody.cpp | Updates supported-feature queries. |
| framework/vulkan_sample.h | Adds device-chain hooks and physical-device accessors. |
| framework/structure_chain_builder.h | Adds feature-flag insertion and C-binding storage handling. |
| framework/hpp_api_vulkan_sample.cpp | Updates supported-feature queries. |
| framework/core/physical_device.h | Removes chain ownership and introduces enable helpers. |
| framework/core/device.h | Invokes the chain-extension callback before device creation. |
| framework/api_vulkan_sample.cpp | Updates supported-feature queries. |
Review effort: Balanced
cd78250 to
25a6656
Compare
| { | ||
| available_options.supports_fdm = true; | ||
|
|
||
| available_options.supports_dynamic_fdm &= static_cast<bool>(supported_extension_features.fragmentDensityMapDynamic); |
There was a problem hiding this comment.
The supports_dynamic_fdm was initialised to true and could be flipped to false here. Now it's initialised to false so this is always a no-op.
There was a problem hiding this comment.
You're right, with changing the initialization of supports_dynamic_fdm to false, this & was wrong.
Fixed.
7438972 to
7b0ce5f
Compare
|
Any advice how to handle the Antora build failure? |
|
Pull the latest from master; I believe they are fixed now. was a node version issue. |
c804b83 to
254633d
Compare
254633d to
dd15dfd
Compare
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>


Description
Analogous to the structure chain handling for instance creation on InstanceCreateInfo, this PR uses the StructureChainBuilder to chain the handling for device creation on DeviceCreateInfo, introducing a dedicated function where and when to do that:
vkb::VulkanSample::extend_device_create_infovkb::core::Deviceconstructorvkb::core::PhysicalDevice, as it's not used any more to gather and store that structure chainrequest_optional_featureandrequest_required_featureof thevkb::core::PhysicalDevicehave changed and renamed toenable_optional_featureandenable_required_feature, respectivelyREQUEST_OPTIONAL_FEATUREandREQUEST_REQUIRED_FEATUREare renamed toENABLE_OPTIONAL_FEATUREandENABLE_REQUIRED_FEATUREvkb::PhysicalDevice::get_featuresis renamed tovkb::PhysicalDevice::get_supported_features, being a better companion tovkb::PhysicalDevice::get_requested_featuresvkb::StructureChainBuilder::set_feature_flagis added that handles setting a specific flag in a specific class in the structure chain, potentially adding that struct if needed.Build tested on Win11 with VS2026. Run tested on Win11 with NVidia GPU.
General Checklist:
Please ensure the following points are checked:
Note: The Samples CI runs a number of checks including:
If this PR contains framework changes:
batchcommand line argument to make sure all samples still work properlySample Checklist
If your PR contains a new or modified sample, these further checks must be carried out in addition to the General Checklist: