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

◆ SDFFieldProcessor() [2/2]

MayaFlux::Buffers::SDFFieldProcessor::SDFFieldProcessor ( std::shared_ptr< VKBuffer >  grid_buf,
const Kinesis::FieldSource &  field,
const glm::vec3 &  bounds_min,
const glm::vec3 &  bounds_max,
uint32_t  res_x,
uint32_t  res_y,
uint32_t  res_z 
)

Evaluate an authored field function instead of a shader file.

The shader is generated from field: its function is emitted as written and a kernel body calls it at every grid corner. Time and the parameter block reach it through set_time() and set_params(), so animating a field recompiles nothing.

Parameters
grid_bufHOST_STORAGE buffer sized to (res_x+1)*(res_y+1)*(res_z+1) floats.
fieldParsed field function, from MF_FIELD, MF_FIELD_T or MF_FIELD_P.
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 109 of file SDFFieldProcessor.cpp.

117 : ComputeProcessor(field_spec(field))
118 , m_from_field(true)
119 , m_grid_buf(std::move(grid_buf))
120 , m_res_x(std::max(res_x, 1U))
121 , m_res_y(std::max(res_y, 1U))
122 , m_res_z(std::max(res_z, 1U))
123{
127 set_bounds(bounds_min, bounds_max);
128
129 m_config.bindings["sdf_grid"] = ShaderBinding(0, 0, vk::DescriptorType::eStorageBuffer);
130
132 const uint32_t corners = (m_res_x + 1) * (m_res_y + 1) * (m_res_z + 1);
133 set_manual_dispatch((corners + 63U) / 64U, 1, 1);
134}
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
void set_bounds(const glm::vec3 &bounds_min, const glm::vec3 &bounds_max)
Replace the evaluation volume.
std::unordered_map< std::string, ShaderBinding > bindings

References MayaFlux::Buffers::ShaderConfig::bindings, MayaFlux::Buffers::ShaderProcessor::m_config, m_field_pc, m_res_x, m_res_y, m_res_z, MayaFlux::Buffers::ShaderDispatchConfig::MANUAL, max, MayaFlux::Buffers::SDFFieldProcessor::FieldPC::res_x, MayaFlux::Buffers::SDFFieldProcessor::FieldPC::res_y, MayaFlux::Buffers::SDFFieldProcessor::FieldPC::res_z, set_bounds(), MayaFlux::Buffers::ComputeProcessor::set_dispatch_mode(), and MayaFlux::Buffers::ComputeProcessor::set_manual_dispatch().

+ Here is the call graph for this function: