Calculate dispatch size from buffer.
- Parameters
-
- 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 148 of file ComputeProcessor.cpp.
149{
151
153 case DispatchMode::MANUAL:
155
156 case DispatchMode::ELEMENT_COUNT: {
157 uint64_t element_count = 0;
158 const auto& dimensions =
buffer->get_dimensions();
159
160 if (!dimensions.empty()) {
161 element_count = dimensions[0].size;
162 } else {
163 element_count =
buffer->get_size_bytes() /
sizeof(float);
164 }
165
166 auto groups_x = static_cast<uint32_t>(
168 return { groups_x, 1, 1 };
169 }
170
171 case DispatchMode::BUFFER_SIZE: {
172 uint64_t size_bytes =
buffer->get_size_bytes();
173 auto groups_x = static_cast<uint32_t>(
175 return { groups_x, 1, 1 };
176 }
177
178 case DispatchMode::CUSTOM:
181 }
182 return { 1, 1, 1 };
183
184 default:
185 return { 1, 1, 1 };
186 }
187}
std::shared_ptr< NetworkGeometryBuffer > buffer
ShaderDispatchConfig m_dispatch_config
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 buffer, 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().