MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
SDFPrepProcessor.cpp
Go to the documentation of this file.
2
5
6namespace MayaFlux::Buffers {
7
8SDFPrepProcessor::SDFPrepProcessor(uint32_t res_x, uint32_t res_y, uint32_t res_z)
9 : m_res_x(std::max(res_x, 1U))
10 , m_res_y(std::max(res_y, 1U))
11 , m_res_z(std::max(res_z, 1U))
12{
14}
15
16void SDFPrepProcessor::set_resolution(uint32_t res_x, uint32_t res_y, uint32_t res_z)
17{
18 m_res_x = std::max(res_x, 1U);
19 m_res_y = std::max(res_y, 1U);
20 m_res_z = std::max(res_z, 1U);
22}
23
24void SDFPrepProcessor::on_attach(const std::shared_ptr<Buffer>& buffer)
25{
26 ensure_initialized(std::dynamic_pointer_cast<VKBuffer>(buffer));
28}
29
30void SDFPrepProcessor::processing_function(const std::shared_ptr<Buffer>& /*buffer*/)
31{
33 return;
34
35 std::memset(m_grid_buf->get_mapped_ptr(), 0, corner_count() * sizeof(float));
36 std::memset(m_counter_buf->get_mapped_ptr(), 0, sizeof(uint32_t));
37}
38
40{
43
44 m_grid_buf = std::make_shared<VKBuffer>(
45 corner_count() * sizeof(float),
48 svc->initialize_buffer(m_grid_buf);
49
50 m_counter_buf = std::make_shared<VKBuffer>(
51 sizeof(uint32_t),
54 svc->initialize_buffer(m_counter_buf);
55}
56
57} // namespace MayaFlux::Buffers
void on_attach(const std::shared_ptr< Buffer > &buffer) override
Called when this processor is attached to a buffer.
uint32_t corner_count() const noexcept
SDFPrepProcessor(uint32_t res_x, uint32_t res_y, uint32_t res_z)
void set_resolution(uint32_t res_x, uint32_t res_y, uint32_t res_z)
Rebuild owned buffers to match a new resolution.
std::shared_ptr< VKBuffer > m_counter_buf
std::shared_ptr< VKBuffer > m_grid_buf
void processing_function(const std::shared_ptr< Buffer > &buffer) override
The core processing function that must be implemented by derived classes.
void ensure_initialized(const std::shared_ptr< VKBuffer > &buffer)
Definition VKBuffer.cpp:471
@ HOST_STORAGE
Host-visible storage buffer (eStorageBuffer + eHostVisible|eHostCoherent)
Interface * get_service()
Query for a backend service.
static BackendRegistry & instance()
Get the global registry instance.
@ GRAPHICS_BACKEND
Standard graphics processing backend configuration.
@ UNKNOWN
Unknown or undefined modality.
Backend buffer management service interface.