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

◆ write_grid_extent_constants()

void MayaFlux::Buffers::RelaxationStepProcessor::write_grid_extent_constants ( )
private

Size the push constant block to at least GridExtent and write the attached grid's dimensions into its leading 8 bytes.

Called from on_attach. A ShaderSpec-constructed processor keeps the size spec.push_constant_bytes gave it. Bytes past sizeof(GridExtent) are rule constants, written by RelaxationGridBuffer from GridConfig::Stage::constants, or per cycle by ShaderProcessor::feed at an explicit offset. set_push_constant_data_raw is unsuitable: it writes from offset 0 and resizes the block to the size passed.

Definition at line 73 of file RelaxationStepProcessor.cpp.

74{
75 if (m_config.push_constant_size < sizeof(GridExtent)) {
76 set_push_constant_size(sizeof(GridExtent));
77 }
78
79 auto& data = get_push_constant_data();
80 if (data.size() < m_config.push_constant_size) {
81 data.resize(m_config.push_constant_size);
82 }
83
84 const GridExtent extent {
85 .width = m_grid->get_grid_width(),
86 .height = m_grid->get_grid_height()
87 };
88 std::memcpy(data.data(), &extent, sizeof(GridExtent));
89}
std::shared_ptr< RelaxationGridBuffer > m_grid
The attached RelaxationGridBuffer, cached for descriptor writes and snapshot reads.
const std::vector< uint8_t > & get_push_constant_data() const
Get current push constant data.
void set_push_constant_size()
Set push constant size from type.

References MayaFlux::Buffers::ShaderProcessor::get_push_constant_data(), MayaFlux::Buffers::ShaderProcessor::m_config, m_grid, MayaFlux::Buffers::ShaderConfig::push_constant_size, MayaFlux::Buffers::ShaderProcessor::set_push_constant_size(), and MayaFlux::Buffers::RelaxationStepProcessor::GridExtent::width.

Referenced by on_attach().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: