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
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 },
939 });
940}
vk::PhysicalDeviceType type
Memory::SeqlockArray m_slot_locks
std::vector< DataVariant > m_data
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.
References type.