MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ layout_fingerprint()

uint64_t MayaFlux::Buffers::ShaderProcessor::layout_fingerprint ( const std::shared_ptr< VKBuffer > &  buffer) const
private

Definition at line 704 of file ShaderProcessor.cpp.

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
723 uint64_t sum = 0;
724 for (const auto& [name, binding] : m_config.bindings) {
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
741 return mix(sum, resolve_push_constant_size(buffer));
742}
std::shared_ptr< NetworkGeometryBuffer > buffer
glm::vec3 value
vk::PhysicalDeviceType type
Definition VKDevice.cpp:126
std::string name
Definition VKDevice.cpp:123
size_t count
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.
Definition Analysis.cpp:469
std::unordered_map< std::string, ShaderBinding > bindings

References MayaFlux::Buffers::ShaderConfig::bindings, buffer, count, m_config, name, resolve_push_constant_size(), type, and value.

Referenced by note_created_layout(), and processing_function().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: