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

◆ set_value_impl()

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

Type-erased single-element write.

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

Implements MayaFlux::Kakshya::NDDataContainer.

Definition at line 942 of file TextureContainer.cpp.

946{
947 if (coords.empty() || m_data.empty())
948 return;
949
950 const size_t layer = (m_data.size() > 1) ? static_cast<size_t>(coords[0]) : 0;
951 if (layer >= m_data.size() || coords.size() < (m_data.size() > 1 ? 4U : 3U))
952 return;
953
954 const size_t co = (m_data.size() > 1) ? 1 : 0;
955 const size_t idx = (coords[co] * m_width + coords[co + 1]) * m_channels + coords[co + 2];
956
957 Memory::SeqlockWriteGuard g(m_slot_locks[layer]);
958 std::visit([&](auto& vec) {
959 using T = typename std::decay_t<decltype(vec)>::value_type;
960 if (type != typeid(T) || idx >= vec.size())
961 return;
962 vec[idx] = *static_cast<const T*>(in);
963 },
964 m_data[layer]);
965}
vk::PhysicalDeviceType type
Definition VKDevice.cpp:146

References type.