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

◆ SDFFieldProcessor()

MayaFlux::Buffers::SDFFieldProcessor::SDFFieldProcessor ( std::shared_ptr< VKBuffer grid_buf,
const glm::vec3 &  bounds_min,
const glm::vec3 &  bounds_max,
uint32_t  res_x,
uint32_t  res_y,
uint32_t  res_z,
std::string  shader = "sdf_field_gyroid.comp" 
)
Parameters
grid_bufHOST_STORAGE buffer sized to (res_x+1)*(res_y+1)*(res_z+1) floats. Owned and zeroed each frame by SDFPrepProcessor.
bounds_minWorld-space minimum corner.
bounds_maxWorld-space maximum corner.
res_xCell count along X.
res_yCell count along Y.
res_zCell count along Z.

Definition at line 7 of file SDFFieldProcessor.cpp.

15 : ComputeProcessor(shader, 64)
16 , m_grid_buf(std::move(grid_buf))
17 , m_res_x(std::max(res_x, 1U))
18 , m_res_y(std::max(res_y, 1U))
19 , m_res_z(std::max(res_z, 1U))
20{
21 m_pc.bounds_min = bounds_min;
25
26 const glm::vec3 extent = bounds_max - bounds_min;
27 m_pc.step = {
28 extent.x / static_cast<float>(m_res_x),
29 extent.y / static_cast<float>(m_res_y),
30 extent.z / static_cast<float>(m_res_z),
31 };
32
33 m_config.push_constant_size = sizeof(PC);
34 m_config.bindings["sdf_grid"] = ShaderBinding(0, 0, vk::DescriptorType::eStorageBuffer);
35
37 const uint32_t corners = (m_res_x + 1) * (m_res_y + 1) * (m_res_z + 1);
38 set_manual_dispatch((corners + 63U) / 64U, 1, 1);
39}
ComputeProcessor(const std::string &shader_path, uint32_t workgroup_x=256)
Construct processor with shader path.
void set_dispatch_mode(ShaderDispatchConfig::DispatchMode mode)
Set dispatch mode.
void set_manual_dispatch(uint32_t x, uint32_t y=1, uint32_t z=1)
Set manual dispatch group counts.
std::shared_ptr< VKBuffer > m_grid_buf
std::unordered_map< std::string, ShaderBinding > bindings

References MayaFlux::Buffers::ShaderConfig::bindings, MayaFlux::Buffers::SDFFieldProcessor::PC::bounds_min, MayaFlux::Buffers::ShaderProcessor::m_config, m_pc, m_res_x, m_res_y, m_res_z, MayaFlux::Buffers::ShaderDispatchConfig::MANUAL, MayaFlux::Buffers::ShaderConfig::push_constant_size, MayaFlux::Buffers::SDFFieldProcessor::PC::res_x, MayaFlux::Buffers::SDFFieldProcessor::PC::res_y, MayaFlux::Buffers::SDFFieldProcessor::PC::res_z, MayaFlux::Buffers::ComputeProcessor::set_dispatch_mode(), MayaFlux::Buffers::ComputeProcessor::set_manual_dispatch(), and MayaFlux::Buffers::SDFFieldProcessor::PC::step.

+ Here is the call graph for this function: