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

◆ on_before_execute()

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

Called before each process callback.

Parameters
cmdCommand buffer
bufferCurrently processing buffer
Returns
True to proceed with execution, false to skip

Override to update push constants or dynamic descriptors.

Reimplemented from MayaFlux::Buffers::ShaderProcessor.

Definition at line 157 of file SDFMeshProcessor.cpp.

160{
161 if (!m_dirty)
162 return false;
163
164 if (m_owns_buffers)
166
167 std::memset(m_counter_buf->get_mapped_ptr(), 0, sizeof(uint32_t));
168
169 const glm::vec3 extent = m_bounds_max - m_bounds_min;
170 const McPC pc {
171 .bounds_min = m_bounds_min,
172 .iso_level = m_iso_level,
173 .step = {
174 extent.x / static_cast<float>(m_res_x),
175 extent.y / static_cast<float>(m_res_y),
176 extent.z / static_cast<float>(m_res_z),
177 },
178 .res_x = m_res_x,
179 .res_y = m_res_y,
180 .res_z = m_res_z,
181 };
183
184 const uint32_t groups = (voxel_count() + 63U) / 64U;
185 set_manual_dispatch(groups, 1, 1);
186
187 return true;
188}
void set_manual_dispatch(uint32_t x, uint32_t y=1, uint32_t z=1)
Set manual dispatch group counts.
bool m_owns_buffers
false in GPU-field mode; buffers owned by SdfPrepProcessor.
std::shared_ptr< VKBuffer > m_counter_buf
uint32_t voxel_count() const noexcept
void set_push_constant_data(const T &data)
Update push constant data (type-safe)

References MayaFlux::Buffers::SDFMeshProcessor::McPC::bounds_min, evaluate_grid(), m_bounds_max, m_bounds_min, m_counter_buf, m_dirty, m_iso_level, m_owns_buffers, m_res_x, m_res_y, m_res_z, MayaFlux::Buffers::ComputeProcessor::set_manual_dispatch(), MayaFlux::Buffers::ShaderProcessor::set_push_constant_data(), and voxel_count().

+ Here is the call graph for this function: