MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / mergeUpdateForTable

Method mergeUpdateForTable

modules/engine/graphics/src/common/cgpux.cpp:298–322  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

296}
297
298void CGPUXMergedBindTable::mergeUpdateForTable(const CGPUXBindTableId* bind_tables, uint32_t count, uint32_t tbl_idx) SKR_NOEXCEPT
299{
300 SkrZoneScopedN("CGPUXMergedBindTable::UpdateDescriptors");
301
302 auto to_update = merged[tbl_idx];
303 // TODO: refactor & remove this vector
304 cgpu::Vector<CGPUDescriptorData> datas;
305 // foreach table location to update values
306 for (uint32_t i = 0; i < count; i++)
307 {
308 for (uint32_t j = 0; j < bind_tables[i]->names_count; j++)
309 {
310 const auto& location = bind_tables[i]->name_locations[j];
311 if (location.tbl_idx == tbl_idx)
312 {
313 SkrZoneScopedN("CGPUXMergedBindTable::UpdateDescriptor");
314 // batch update for better performance
315 datas.add(location.value.data);
316 }
317 }
318 }
319 // this update is kinda dangerous during draw-call because update-after-bind may happen
320 // TODO: give some runtime warning
321 cgpu_update_descriptor_set(to_update, datas.data(), (uint32_t)datas.size());
322}
323
324void CGPUXMergedBindTable::Bind(CGPURenderPassEncoderId encoder) const SKR_NOEXCEPT
325{

Callers

nothing calls this directly

Calls 4

addMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected