| 296 | } |
| 297 | |
| 298 | void 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 | |
| 324 | void CGPUXMergedBindTable::Bind(CGPURenderPassEncoderId encoder) const SKR_NOEXCEPT |
| 325 | { |
nothing calls this directly
no test coverage detected