MayaFlux 1.0.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< DataVariant >.

Definition at line 1117 of file TextureContainer.cpp.

1121{
1122 if (coords.empty() || m_data.empty())
1123 return;
1124
1125 const size_t layer = (m_data.size() > 1) ? static_cast<size_t>(coords[0]) : 0;
1126 if (layer >= m_data.size() || coords.size() < (m_data.size() > 1 ? 4U : 3U))
1127 return;
1128
1129 ensure_cpu(static_cast<uint32_t>(layer));
1130
1131 const size_t co = (m_data.size() > 1) ? 1 : 0;
1132 const size_t idx = (coords[co] * m_width + coords[co + 1]) * m_channels + coords[co + 2];
1133
1134 Memory::SeqlockWriteGuard g(m_slot_locks[layer]);
1135 std::visit([&](auto& vec) {
1136 using T = typename std::decay_t<decltype(vec)>::value_type;
1137 if (type != typeid(T) || idx >= vec.size())
1138 return;
1139 vec[idx] = *static_cast<const T*>(in);
1140 },
1141 m_data[layer]);
1142}
std::vector< glm::ivec3 > coords
Definition VDBWriter.cpp:25
vk::PhysicalDeviceType type
Definition VKDevice.cpp:126
void ensure_cpu(uint32_t layer) const
Download a GPU-held layer into m_data before a CPU read.

References coords, ensure_cpu(), m_channels, m_data, m_slot_locks, m_width, and type.

+ Here is the call graph for this function: