MayaFlux 0.2.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 145 of file ComputeProcessor.cpp.

146{
147 using DispatchMode = ShaderDispatchConfig::DispatchMode;
148
149 switch (m_dispatch_config.mode) {
150 case DispatchMode::MANUAL:
152
153 case DispatchMode::ELEMENT_COUNT: {
154 uint64_t element_count = 0;
155 const auto& dimensions = buffer->get_dimensions();
156
157 if (!dimensions.empty()) {
158 element_count = dimensions[0].size;
159 } else {
160 element_count = buffer->get_size_bytes() / sizeof(float);
161 }
162
163 auto groups_x = static_cast<uint32_t>(
165 return { groups_x, 1, 1 };
166 }
167
168 case DispatchMode::BUFFER_SIZE: {
169 uint64_t size_bytes = buffer->get_size_bytes();
170 auto groups_x = static_cast<uint32_t>(
172 return { groups_x, 1, 1 };
173 }
174
175 case DispatchMode::CUSTOM:
178 }
179 return { 1, 1, 1 };
180
181 default:
182 return { 1, 1, 1 };
183 }
184}
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: