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

◆ prepare_channel()

template<ComputeData InputType = Eigen::MatrixXd, ComputeData OutputType = std::vector<std::vector<double>>>
ChannelCall MayaFlux::Yantra::IntervalExtractor< InputType, OutputType >::prepare_channel ( size_t channel,
std::span< const double > scores,
bool resident,
uint32_t resident_count,
bool flush )
inlineprivate

Makes a column's buffers, uploads its scores and state, and counts the call.

Every column is prepared before any scan is recorded, so a gate column's scores exist when the scans that read them are recorded.

Definition at line 713 of file IntervalExtractor.hpp.

714 {
715 const auto n = resident ? resident_count : static_cast<uint32_t>(scores.size());
716 if (n == 0 && !flush) {
717 return {};
718 }
719
722 const size_t scores_binding = binding_of(channel, Scores);
723 const size_t runs_binding = binding_of(channel, Runs);
724 const size_t report_binding = binding_of(channel, Report);
725 const size_t state_binding = binding_of(channel, State);
726
728 m_context->ensure_shared_buffer(0, runs_binding, interval_scan_runs_words(n), word);
729 m_context->ensure_shared_buffer(0, report_binding, interval_scan_report_words, word);
731
732 if (!m_started[channel]) {
734 m_context->upload_shared_raw(0, state_binding, reinterpret_cast<const uint8_t*>(zeros.data()), zeros.size() * sizeof(uint32_t));
735 m_started[channel] = true;
736 }
737 if (!resident && n > 0) {
738 const std::vector<float> floats(scores.begin(), scores.end());
739 m_context->upload_shared_raw(0, scores_binding, reinterpret_cast<const uint8_t*>(floats.data()), floats.size() * sizeof(float));
740 }
741 const uint32_t none = 0;
742 m_context->upload_shared_raw(0, report_binding, reinterpret_cast<const uint8_t*>(&none), sizeof(none));
743
744 const uint32_t first = m_seen[channel];
745 if (flush) {
746 m_seen[channel] = 0;
747 m_started[channel] = false;
748 } else {
749 m_seen[channel] = first + n;
750 }
751 return { .ran = true, .capacity = n + 4, .first = first, .count = n };
752 }
std::unique_ptr< ShaderExecutionContext<> > m_context
static size_t binding_of(size_t channel, Slot slot)
Finds where each score sequence is engaged, on the GPU, as a stream.
constexpr size_t interval_scan_runs_words(size_t n) noexcept
Words the run list needs for n scores: a start and an end for each run that can close,...
enum MayaFlux::Portal::Graphics::GpuBufferBinding::ElementType FLOAT32

Referenced by MayaFlux::Yantra::IntervalExtractor< Eigen::MatrixXd, std::vector< std::vector< double > > >::record_all(), and MayaFlux::Yantra::IntervalExtractor< Eigen::MatrixXd, std::vector< std::vector< double > > >::record_resident().

Here is the caller graph for this function: