Just correctness. We don't exceed this on any known hardware, but its better to check. If we do, we simply fall back to regular descriptors.
Unified · Split
| @@ -148,9 +148,13 @@ int ff_vk_load_props(FFVulkanContext *s) · 147 unmodified lines | ||
| 148 | 148 | .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPTICAL_FLOW_PROPERTIES_NV, |
| 149 | 149 | .pNext = &s->hprops, |
| 150 | 150 | }; |
| 151 | + s->push_desc_props = (VkPhysicalDevicePushDescriptorPropertiesKHR) { | |
| 152 | + .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES, | |
| 153 | + .pNext = &s->optical_flow_props, | |
| 154 | + }; | |
| 151 | 155 | s->coop_matrix_props = (VkPhysicalDeviceCooperativeMatrixPropertiesKHR) { |
| 152 | 156 | .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_PROPERTIES_KHR, |
| 153 | − .pNext = &s->optical_flow_props, | |
| 157 | + .pNext = &s->push_desc_props, | |
| 154 | 158 | }; |
| 155 | 159 | s->subgroup_props = (VkPhysicalDeviceSubgroupSizeControlProperties) { |
| 156 | 160 | .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES, |
| @@ -2250,15 +2254,16 @@ static int init_descriptors(FFVulkanContext *s, FFVulkanShader *shd) · 2093 unmodified lines | ||
| 2250 | 2254 | |
| 2251 | 2255 | if (!(s->extensions & FF_VK_EXT_DESCRIPTOR_BUFFER)) { |
| 2252 | 2256 | int has_singular = 0; |
| 2257 | + int max_descriptors = 0; | |
| 2253 | 2258 | for (int i = 0; i < shd->nb_descriptor_sets; i++) { |
| 2254 | − if (shd->desc_set[i].singular) { | |
| 2259 | + max_descriptors = FFMAX(max_descriptors, shd->desc_set[i].nb_bindings); | |
| 2260 | + if (shd->desc_set[i].singular) | |
| 2255 | 2261 | has_singular = 1; |
| 2256 | − break; | |
| 2257 | − } | |
| 2258 | 2262 | } |
| 2259 | 2263 | shd->use_push = (s->extensions & FF_VK_EXT_PUSH_DESCRIPTOR) && |
| 2264 | + (max_descriptors <= s->push_desc_props.maxPushDescriptors) && | |
| 2260 | 2265 | (shd->nb_descriptor_sets == 1) && |
| 2261 | − !has_singular; | |
| 2266 | + (has_singular == 0); | |
| 2262 | 2267 | } |
| 2263 | 2268 | |
| 2264 | 2269 | for (int i = 0; i < shd->nb_descriptor_sets; i++) { |
| @@ -285,6 +285,7 @@ typedef struct FFVulkanContext { · 284 unmodified lines | ||
| 285 | 285 | VkPhysicalDeviceDescriptorBufferPropertiesEXT desc_buf_props; |
| 286 | 286 | VkPhysicalDeviceSubgroupSizeControlProperties subgroup_props; |
| 287 | 287 | VkPhysicalDeviceCooperativeMatrixPropertiesKHR coop_matrix_props; |
| 288 | + VkPhysicalDevicePushDescriptorPropertiesKHR push_desc_props; | |
| 288 | 289 | VkPhysicalDeviceOpticalFlowPropertiesNV optical_flow_props; |
| 289 | 290 | VkQueueFamilyQueryResultStatusPropertiesKHR *query_props; |
| 290 | 291 | VkQueueFamilyVideoPropertiesKHR *video_props; |