705{
706 const auto mix = [](uint64_t seed, uint64_t
value) {
707 return seed ^ (
value + 0x9e3779b97f4a7c15ULL + (seed << 6) + (seed >> 2));
708 };
709 const auto slot = [&mix](uint32_t set, uint32_t binding, vk::DescriptorType
type, uint32_t
count) {
710 uint64_t hash = mix(0, set);
711 hash = mix(hash, binding);
712 hash = mix(hash,
static_cast<uint64_t
>(
type));
713 return mix(hash,
count);
714 };
715
716 const auto& staged =
buffer->get_pipeline_context().descriptor_buffer_bindings;
717 const auto find_staged = [&staged](uint32_t set, uint32_t binding) {
718 return std::ranges::find_if(staged, [set, binding](const auto& entry) {
719 return entry.set == set && entry.binding == binding;
720 });
721 };
722
725 const auto override_it = find_staged(binding.set, binding.binding);
726 sum += override_it != staged.end()
727 ? slot(binding.set, binding.binding, override_it->type, override_it->count)
728 : slot(binding.set, binding.binding, binding.
type, binding.
count);
729 }
730
731 for (auto it = staged.begin(); it != staged.end(); ++it) {
732 const bool configured = std::ranges::any_of(
m_config.
bindings, [it](
const auto& pair) {
733 return pair.second.set == it->set && pair.second.binding == it->binding;
734 });
735 const bool repeated = find_staged(it->set, it->binding) != it;
736 if (!configured && !repeated) {
737 sum += slot(it->set, it->binding, it->type, it->count);
738 }
739 }
740
742}
std::shared_ptr< NetworkGeometryBuffer > buffer
vk::PhysicalDeviceType type
size_t resolve_push_constant_size(const std::shared_ptr< VKBuffer > &buffer) const
Byte width of this processor's push constant block, extended to cover any fragment staged on the buff...
std::vector< double > sum(std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size)
Sum per window.
std::unordered_map< std::string, ShaderBinding > bindings