Write a named field of the attached buffer.
72{
73 auto payload = std::make_shared<Kakshya::DataVariant>(std::move(data));
75 const auto bytes = Kakshya::convert_variant<uint8_t>(*
payload);
76 const size_t size = bytes.size_bytes();
77
78 if (const auto volume = std::dynamic_pointer_cast<VolumeGridBuffer>(vk);
79 volume && volume->has_field(
name)) {
80 if (
size != volume->get_field_bytes(
name)) {
82 "DataWriteProcessor write_field '{}' needs exactly {} bytes",
name, volume->get_field_bytes(
name));
83 return;
84 }
85 volume->seed_raw(
name, bytes.data(),
size);
86 return;
87 }
88
89 if (
const auto network = std::dynamic_pointer_cast<NetworkGeometryBuffer>(vk);
93 "DataWriteProcessor write_field '{}' needs exactly {} bytes",
name,
network->get_state_bytes(
name));
94 return;
95 }
97 if (!slot.mapped_ptr) {
98 ensure_staging(self.m_write_staging,
size);
99 }
101 return;
102 }
103
105 "DataWriteProcessor write_field found no field named '{}' on the attached buffer",
name);
106 });
107}
#define MF_RT_ERROR(comp, ctx,...)
Core::GlobalNetworkConfig network
void enqueue_write(WriteFn fn)
void upload_back_buffer(const VKBufferResources::GenerationSlot &slot, const void *data, size_t size, std::shared_ptr< VKBuffer > &staging)
Upload host memory into a raw back_buffers slot.
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.