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

◆ on_before_execute()

bool MayaFlux::Buffers::VertexFieldProcessor::on_before_execute ( Portal::Graphics::CommandBufferID  cmd_id,
const std::shared_ptr< VKBuffer > &  buffer 
)
overrideprotectedvirtual

Rebuild on a stale revision, resolve the range, write push constants.

Returns
False to suppress the dispatch when the range is empty or the operator no longer produces a spec.

Reimplemented from MayaFlux::Buffers::ShaderProcessor.

Definition at line 181 of file VertexFieldProcessor.cpp.

184{
185 if (!buffer)
186 return false;
187
188 if (!sync_revision())
189 return false;
190
191 const uint32_t capacity = buffer_capacity(buffer);
192 if (capacity == 0)
193 return false;
194
195 if (m_range_set) {
196 if (m_explicit_first >= capacity) {
198 "VertexFieldProcessor: range starts at {} but the buffer holds {} "
199 "records. Dispatch suppressed.",
200 m_explicit_first, capacity);
201 return false;
202 }
203
206 } else {
208 m_params.vertex_count = capacity;
209 }
210
211 if (m_params.vertex_count == 0)
212 return false;
213
215 m_params.transform = geometry_transform(buffer);
216
218 "VertexFieldProcessor dispatch: [{}, {}) of {} records, stride {} words, t={:.3f}",
221 capacity,
223 m_params.time);
224
225 if (m_operator->uses_params()) {
226 const glm::vec4& params = m_operator->get_params();
227 set_push_constant_data(ParamsBlock { m_params, { params.x, params.y, params.z, params.w } });
228 } else {
230 }
231 return true;
232}
#define MF_RT_ERROR(comp, ctx,...)
#define MF_RT_TRACE(comp, ctx,...)
std::shared_ptr< NetworkGeometryBuffer > buffer
void set_push_constant_data(const T &data)
Update push constant data (type-safe)
uint32_t buffer_capacity(const std::shared_ptr< VKBuffer > &buffer) const
Records the buffer can hold at the operator's stride.
std::shared_ptr< Nodes::Network::GpuFieldOperator > m_operator
bool sync_revision()
Recompile and rebuild the pipeline when the operator has changed.
float elapsed() const
Seconds since construction, the value bound to the time parameter.
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.

References buffer, buffer_capacity(), MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, elapsed(), MayaFlux::Buffers::VertexFieldProcessor::RangeParams::first_vertex, m_explicit_count, m_explicit_first, m_operator, m_params, m_range_set, MF_RT_ERROR, MF_RT_TRACE, MayaFlux::Buffers::ShaderProcessor::set_push_constant_data(), MayaFlux::Buffers::VertexFieldProcessor::RangeParams::stride_words, sync_revision(), MayaFlux::Buffers::VertexFieldProcessor::RangeParams::time, MayaFlux::Buffers::VertexFieldProcessor::RangeParams::transform, and MayaFlux::Buffers::VertexFieldProcessor::RangeParams::vertex_count.

+ Here is the call graph for this function: