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

◆ get_value_impl()

void MayaFlux::Kakshya::TextureContainer::get_value_impl ( const std::vector< uint64_t > &  coords,
void *  out,
const std::type_info &  type 
) const
overrideprotectedvirtual

Type-erased single-element read.

Implementations copy the native element at coords into out if type matches their native type, otherwise no-op. out points to a caller-owned buffer of exactly sizeof(native type) bytes.

Implements MayaFlux::Kakshya::NDDataContainer.

Definition at line 916 of file TextureContainer.cpp.

920{
921 if (coords.empty() || m_data.empty())
922 return;
923
924 const size_t layer = (m_data.size() > 1) ? static_cast<size_t>(coords[0]) : 0;
925 if (layer >= m_data.size() || coords.size() < (m_data.size() > 1 ? 4U : 3U))
926 return;
927
928 const size_t co = (m_data.size() > 1) ? 1 : 0;
929 const size_t idx = (coords[co] * m_width + coords[co + 1]) * m_channels + coords[co + 2];
930
931 seqlock_read_void(m_slot_locks[layer], 8, [&] {
932 std::visit([&](const auto& vec) {
933 using T = typename std::decay_t<decltype(vec)>::value_type;
934 if (type != typeid(T) || idx >= vec.size())
935 return;
936 *static_cast<T*>(out) = vec[idx];
937 },
938 m_data[layer]);
939 });
940}
vk::PhysicalDeviceType type
Definition VKDevice.cpp:146
bool seqlock_read_void(const Seqlock &lock, uint32_t max_attempts, Fn &&fn)
Invoke a void read functor under a Seqlock with a bounded retry count.
Definition SeqLock.hpp:222

References type.