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.

Reimplemented in MayaFlux::Buffers::VertexFieldProcessor.

Definition at line 142 of file ComputeProcessor.cpp.

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