MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Samples / flush_descriptor_state_impl

Method flush_descriptor_state_impl

framework/core/command_buffer.h:1312–1461  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1310 {
1311 update_descriptor_sets.emplace(descriptor_set_id);
1312 }
1313 }
1314 }
1315
1316 // Validate that the bound descriptor set layouts exist in the pipeline layout
1317 for (auto set_it = descriptor_set_layout_binding_state.begin(); set_it != descriptor_set_layout_binding_state.end();)
1318 {
1319 if (!pipeline_layout.has_descriptor_set_layout(set_it->first))
1320 {
1321 set_it = descriptor_set_layout_binding_state.erase(set_it);
1322 }
1323 else
1324 {
1325 ++set_it;
1326 }
1327 }
1328
1329 // Check if a descriptor set needs to be created
1330 if (resource_binding_state.is_dirty() || !update_descriptor_sets.empty())
1331 {
1332 resource_binding_state.clear_dirty();
1333
1334 // Iterate over all of the resource sets bound by the command buffer
1335 for (auto &resource_set_it : resource_binding_state.get_resource_sets())
1336 {
1337 uint32_t descriptor_set_id = resource_set_it.first;
1338 auto &resource_set = resource_set_it.second;
1339
1340 // Don't update resource set if it's not in the update list OR its state hasn't changed
1341 if (!resource_set.is_dirty() && (update_descriptor_sets.find(descriptor_set_id) == update_descriptor_sets.end()))
1342 {
1343 continue;
1344 }
1345
1346 // Clear dirty flag for resource set
1347 resource_binding_state.clear_dirty(descriptor_set_id);
1348
1349 // Skip resource set if a descriptor set layout doesn't exist for it
1350 if (!pipeline_layout.has_descriptor_set_layout(descriptor_set_id))
1351 {
1352 continue;
1353 }
1354
1355 auto &descriptor_set_layout = pipeline_layout.get_descriptor_set_layout(descriptor_set_id);
1356
1357 // Make descriptor set layout bound for current set
1358 descriptor_set_layout_binding_state[descriptor_set_id] = &descriptor_set_layout;
1359
1360 BindingMap<vk::DescriptorBufferInfo> buffer_infos;
1361 BindingMap<vk::DescriptorImageInfo> image_infos;
1362
1363 std::vector<uint32_t> dynamic_offsets;
1364
1365 // Iterate over all resource bindings
1366 for (auto &binding_it : resource_set.get_resource_bindings())
1367 {
1368 auto binding_index = binding_it.first;
1369 auto &binding_resources = binding_it.second;

Callers

nothing calls this directly

Calls 15

to_u32Function · 0.85
endMethod · 0.80
emptyMethod · 0.80
is_depth_formatFunction · 0.50
get_render_frameMethod · 0.45
get_handleMethod · 0.45
beginMethod · 0.45
is_dirtyMethod · 0.45

Tested by

no test coverage detected