1// Copyright 2021-2022 The Khronos Group Inc. 2// 3// SPDX-License-Identifier: CC-BY-4.0 4 5= VK_EXT_extended_dynamic_state3 6:toc: left 7:refpage: https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/ 8:sectnums: 9 10This document details the motivation behind another extended dynamic state extension, which follows VK_EXT_extended_dynamic_state and VK_EXT_extended_dynamic_state2. 11 12== Problem Statement 13 14Since the release of VK_EXT_extended_dynamic_state and VK_EXT_extended_dynamic_state2 in Vulkan 1.3, which made 15more pipeline state dynamic, there is still some remaining pipeline state that cannot be changed dynamically. 16Dynamic state helps applications reduce the number of pipelines they need to create and bind. 17It was also noted that several extensions that add pipeline state lack dynamic state equivalents. 18 19Reducing the amount of state required to build a pipeline can also help applications build pipelines ahead of time 20and avoid hitching since that state might not be known until right before the draw command is recorded. By making it 21dynamic there is less state that applications need to hash and cache for on-demand pipeline creation. 22 23These additional dynamic states can also help pare down the pipeline state to help other extensions build on this 24and potentially remove the need to create and bind linked monolithic pipeline objects at all. 25 26 27== Solution Space 28 29This proposal adds more dynamic state that hardware vendors can optionally implement, with enough in common 30between most vendors to be useful for applications. 31This extension also sets a baseline for a potential roadmap for future hardware to handle all dynamic state efficiently. 32 33Some of the dynamic state added by this proposal may not have immediate benefits for applications 34since the state could be constant throughout the application, but it is added anyway to 35capture as much pipeline state as possible and lay a foundation for potentially doing away with linked 36monolithic pipeline objects. 37 38Adding more and more dynamic state by itself is not the solution to all pipeline problems, and this extension 39does not attempt go beyond adding dynamic state to address those other problems. 40 41 42== Proposal 43 44IHVs should only implement support for the dynamic state below if it is efficient on their 45platform. Feature bits are provided for all state so IHVs can implement any subset of 46VK_EXT_extended_dynamic_state3. 47 48=== New Dynamic State 49 50This adds the following dynamic state: 51 52VK_DYNAMIC_STATE_TESSELLATION_DOMAIN_ORIGIN_EXT:: 53 VkPipelineTessellationDomainOriginStateCreateInfo::domainOrigin 54 * Assuming VkPhysicalDeviceFeatures::tessellationShader is enabled 55 * Requires VK_KHR_maintenance2 56 57VK_DYNAMIC_STATE_DEPTH_CLAMP_ENABLE_EXT:: 58 VkPipelineRasterizationStateCreateInfo::depthClampEnable 59 * Assuming VkPhysicalDeviceFeatures::depthClamp is enabled 60 61VK_DYNAMIC_STATE_POLYGON_MODE_EXT:: 62 VkPipelineRasterizationStateCreateInfo::polygonMode 63 * Assuming VkPhysicalDeviceFeatures::fillModeNonSolid is enabled 64 65VK_DYNAMIC_STATE_RASTERIZATION_SAMPLES_EXT:: 66 VkPipelineMultisampleStateCreateInfo::rasterizationSamples 67 * There are restrictions on what values this can be set to 68 based on the variableMultisampleRate feature, the render pass 69 instance attachments, and the extensions 70 VK_NV_framebuffer_mixed_samples and VK_AMD_mixed_attachment_samples. 71 72VK_DYNAMIC_STATE_SAMPLE_MASK_EXT:: 73 VkPipelineMultisampleStateCreateInfo::pSampleMask 74 75VK_DYNAMIC_STATE_ALPHA_TO_COVERAGE_ENABLE_EXT:: 76 VkPipelineMultisampleStateCreateInfo::alphaToCoverageEnable 77 78VK_DYNAMIC_STATE_ALPHA_TO_ONE_ENABLE_EXT:: 79 VkPipelineMultisampleStateCreateInfo::alphaToOneEnable 80 * Assuming VkPhysicalDeviceFeatures::alphaToOne is enabled 81 82VK_DYNAMIC_STATE_LOGIC_OP_ENABLE_EXT:: 83 VkPipelineColorBlendStateCreateInfo::logicOpEnable 84 * Assuming VkPhysicalDeviceFeatures::logicOp is enabled 85 86VK_DYNAMIC_STATE_COLOR_BLEND_ENABLE_EXT:: 87 Per-attachment: 88 - VkPipelineColorBlendAttachmentState::blendEnable 89 90VK_DYNAMIC_STATE_COLOR_BLEND_EQUATION_EXT:: 91 Per-attachment: 92 - VkPipelineColorBlendAttachmentState::srcColorBlendFactor 93 - VkPipelineColorBlendAttachmentState::dstColorBlendFactor 94 - VkPipelineColorBlendAttachmentState::colorBlendOp 95 - VkPipelineColorBlendAttachmentState::srcAlphaBlendFactor 96 - VkPipelineColorBlendAttachmentState::dstAlphaBlendFactor 97 - VkPipelineColorBlendAttachmentState::alphaBlendOp 98 99VK_DYNAMIC_STATE_COLOR_WRITE_MASK_EXT:: 100 Per-attachment: 101 - VkPipelineColorBlendAttachmentState::colorWriteMask 102 103VK_DYNAMIC_STATE_RASTERIZATION_STREAM_EXT:: 104 VkPipelineRasterizationStateStreamCreateInfoEXT::rasterizationStream 105 * Assuming VkPhysicalDeviceTransformFeedbackFeaturesEXT::geometryStreams is enabled 106 * Requires VK_EXT_transform_feedback 107 108VK_DYNAMIC_STATE_CONSERVATIVE_RASTERIZATION_MODE_EXT:: 109 VkPipelineRasterizationConservativeStateCreateInfoEXT::conservativeRasterizationMode 110 * Assuming VK_EXT_conservative_rasterization is enabled 111 ** Also depends on VkPhysicalDeviceConservativeRasterizationPropertiesEXT::primitiveUnderestimation 112 * Requires VK_EXT_conservative_rasterization 113 114VK_DYNAMIC_STATE_EXTRA_PRIMITIVE_OVERESTIMATION_SIZE_EXT:: 115 VkPipelineRasterizationConservativeStateCreateInfoEXT::extraPrimitiveOverestimationSize 116 * Assuming VK_EXT_conservative_rasterization is enabled 117 * Requires VK_EXT_conservative_rasterization 118 119VK_DYNAMIC_STATE_DEPTH_CLIP_ENABLE_EXT:: 120 VkPipelineRasterizationDepthClipStateCreateInfoEXT::depthClipEnable 121 * Assuming VkPhysicalDeviceDepthClipEnableFeaturesEXT::depthClipEnable is enabled 122 * Requires VK_EXT_depth_clip_enable 123 124VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_ENABLE_EXT:: 125 VkPipelineSampleLocationsStateCreateInfoEXT::sampleLocationsEnable 126 * Assuming VK_EXT_sample_locations is enabled 127 * Requires VK_EXT_sample_locations 128 129VK_DYNAMIC_STATE_COLOR_BLEND_ADVANCED_EXT:: 130 Per-attachment: 131 - VkPipelineColorBlendAttachmentState::colorBlendOp 132 - VkPipelineColorBlendAdvancedStateCreateInfoEXT::srcPremultiplied 133 - VkPipelineColorBlendAdvancedStateCreateInfoEXT::dstPremultiplied 134 - VkPipelineColorBlendAdvancedStateCreateInfoEXT::blendOverlap 135 * Requires VK_EXT_blend_operation_advanced 136 137VK_DYNAMIC_STATE_PROVOKING_VERTEX_MODE_EXT:: 138 VkPipelineRasterizationProvokingVertexStateCreateInfoEXT::provokingVertexMode 139 * Assuming VkPhysicalDeviceProvokingVertexFeaturesEXT::provokingVertexLast is enabled 140 * Requires VK_EXT_provoking_vertex 141 142VK_DYNAMIC_STATE_LINE_RASTERIZATION_MODE_EXT:: 143 VkPipelineRasterizationLineStateCreateInfoEXT::lineRasterizationMode 144 * Assuming VK_EXT_line_rasterization is enabled 145 * Requires VK_EXT_line_rasterization 146 147VK_DYNAMIC_STATE_LINE_STIPPLE_ENABLE_EXT:: 148 VkPipelineRasterizationLineStateCreateInfoEXT::stippledLineEnable 149 * Assuming VK_EXT_line_rasterization is enabled 150 * Requires VK_EXT_line_rasterization 151 152VK_DYNAMIC_STATE_DEPTH_CLIP_NEGATIVE_ONE_TO_ONE_EXT:: 153 VkPipelineViewportDepthClipControlCreateInfoEXT::negativeOneToOne 154 * Assuming VkPhysicalDeviceDepthClipControlFeaturesEXT::depthClipControl is enabled 155 * Requires VK_EXT_depth_clip_control 156 157VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_ENABLE_NV:: 158 VkPipelineViewportWScalingStateCreateInfoNV::viewportWScalingEnable 159 * Assuming VK_NV_clip_space_w_scaling is enabled 160 * Requires VK_NV_clip_space_w_scaling 161 162VK_DYNAMIC_STATE_VIEWPORT_SWIZZLE_NV:: 163 VkPipelineViewportSwizzleStateCreateInfoNV::pViewportSwizzles 164 * Assuming VK_NV_viewport_swizzle is enabled 165 * Requires VK_NV_viewport_swizzle 166 167VK_DYNAMIC_STATE_COVERAGE_TO_COLOR_ENABLE_NV:: 168 VkPipelineCoverageToColorStateCreateInfoNV::coverageToColorEnable 169 * Assuming VK_NV_fragment_coverage_to_color is enabled 170 * Requires VK_NV_fragment_coverage_to_color 171 172VK_DYNAMIC_STATE_COVERAGE_TO_COLOR_LOCATION_NV:: 173 VkPipelineCoverageToColorStateCreateInfoNV::coverageToColorLocation 174 * Assuming VK_NV_fragment_coverage_to_color is enabled 175 * Requires VK_NV_fragment_coverage_to_color 176 177VK_DYNAMIC_STATE_COVERAGE_MODULATION_MODE_NV:: 178 VkPipelineCoverageModulationStateCreateInfoNV::coverageModulationMode 179 * Assuming VK_NV_framebuffer_mixed_samples is enabled 180 * Requires VK_NV_framebuffer_mixed_samples 181 182VK_DYNAMIC_STATE_COVERAGE_MODULATION_TABLE_ENABLE_NV:: 183 VkPipelineCoverageModulationStateCreateInfoNV::coverageModulationTableEnable 184 * Assuming VK_NV_framebuffer_mixed_samples is enabled 185 * Requires VK_NV_framebuffer_mixed_samples 186 187VK_DYNAMIC_STATE_COVERAGE_MODULATION_TABLE_NV:: 188 VkPipelineCoverageModulationStateCreateInfoNV::pCoverageModulationTable 189 * Assuming VK_NV_framebuffer_mixed_samples is enabled 190 * Requires VK_NV_framebuffer_mixed_samples 191 192VK_DYNAMIC_STATE_COVERAGE_REDUCTION_MODE_NV:: 193 VkPipelineCoverageReductionStateCreateInfoNV::coverageReductionMode 194 * Assuming VkPhysicalDeviceCoverageReductionModeFeaturesNV::coverageReductionMode is enabled 195 * Requires VK_NV_coverage_reduction_mode 196 197VK_DYNAMIC_STATE_REPRESENTATIVE_FRAGMENT_TEST_ENABLE_NV:: 198 VkPipelineRepresentativeFragmentTestStateCreateInfoNV::representativeFragmentTestEnable 199 * Assuming VkPhysicalDeviceRepresentativeFragmentTestFeaturesNV::representativeFragmentTest is enabled 200 * Requires VK_NV_representative_fragment_test 201 202VK_DYNAMIC_STATE_SHADING_RATE_IMAGE_ENABLE_NV:: 203 VkPipelineViewportShadingRateImageStateCreateInfoNV::shadingRateImageEnable 204 * Assuming VkPhysicalDeviceShadingRateImageFeaturesNV::shadingRateImage is enabled 205 * Requires VK_NV_shading_rate_image 206 207 208=== New Properties 209 210VkPhysicalDeviceExtendedDynamicState3PropertiesEXT::dynamicPrimitiveTopologyUnrestricted:: 211 Indicates that VkPipelineInputAssemblyStateCreateInfo::topology is ignored when 212 VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT is enabled, and the application can set any 213 primitive topology in any primitive topology class with vkCmdSetPrimitiveTopology. 214