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

◆ calculate_dispatch_size()

std::array< uint32_t, 3 > MayaFlux::Buffers::ComputeProcessor::calculate_dispatch_size ( const std::shared_ptr< VKBuffer > &  buffer)
protectedvirtual

Calculate dispatch size from buffer.

Parameters
bufferBuffer to process
Returns
{group_count_x, group_count_y, group_count_z}

Override for custom dispatch calculation logic. Default implementation uses m_config.dispatch settings.

Definition at line 144 of file ComputeProcessor.cpp.

145{
146 using DispatchMode = ShaderDispatchConfig::DispatchMode;
147
148 switch (m_dispatch_config.mode) {
149 case DispatchMode::MANUAL:
151
152 case DispatchMode::ELEMENT_COUNT: {
153 uint64_t element_count = 0;
154 const auto& dimensions = buffer->get_dimensions();
155
156 if (!dimensions.empty()) {
157 element_count = dimensions[0].size;
158 } else {
159 element_count = buffer->get_size_bytes() / sizeof(float);
160 }
161
162 auto groups_x = static_cast<uint32_t>(
164 return { groups_x, 1, 1 };
165 }
166
167 case DispatchMode::BUFFER_SIZE: {
168 uint64_t size_bytes = buffer->get_size_bytes();
169 auto groups_x = static_cast<uint32_t>(
171 return { groups_x, 1, 1 };
172 }
173
174 case DispatchMode::CUSTOM:
177 }
178 return { 1, 1, 1 };
179
180 default:
181 return { 1, 1, 1 };
182 }
183}
enum MayaFlux::Buffers::ShaderDispatchConfig::DispatchMode mode
std::function< std::array< uint32_t, 3 >(const std::shared_ptr< VKBuffer > &)> custom_calculator
uint32_t workgroup_x
Workgroup size X (should match shader)

References MayaFlux::Buffers::ShaderDispatchConfig::custom_calculator, MayaFlux::Buffers::ShaderDispatchConfig::group_count_x, MayaFlux::Buffers::ShaderDispatchConfig::group_count_y, MayaFlux::Buffers::ShaderDispatchConfig::group_count_z, m_dispatch_config, MayaFlux::Buffers::ShaderDispatchConfig::mode, and MayaFlux::Buffers::ShaderDispatchConfig::workgroup_x.

Referenced by execute_shader().

+ Here is the caller graph for this function: