MayaFlux 0.5.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 161 of file SDFMeshProcessor.cpp.

164{
165 if (!m_dirty)
166 return false;
167
168 if (m_owns_buffers)
170
171 std::memset(m_counter_buf->get_mapped_ptr(), 0, sizeof(uint32_t));
172
173 const glm::vec3 extent = m_bounds_max - m_bounds_min;
174 const McPC pc {
175 .bounds_min = m_bounds_min,
176 .iso_level = m_iso_level,
177 .step = {
178 extent.x / static_cast<float>(m_res_x),
179 extent.y / static_cast<float>(m_res_y),
180 extent.z / static_cast<float>(m_res_z),
181 },
182 .res_x = m_res_x,
183 .res_y = m_res_y,
184 .res_z = m_res_z,
185 ._pad = 0,
186 .palette = {
187 glm::vec4(m_palette[0], 1.0F),
188 glm::vec4(m_palette[1], 1.0F),
189 glm::vec4(m_palette[2], 1.0F),
190 },
191 };
193
194 const uint32_t groups = (voxel_count() + 63U) / 64U;
195 set_manual_dispatch(groups, 1, 1);
196
197 return true;
198}
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
std::array< glm::vec3, 3 > m_palette
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_palette, 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: