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

◆ dispatch_1d()

void MayaFlux::Core::VKComputePipeline::dispatch_1d ( vk::CommandBuffer  cmd,
uint32_t  element_count,
uint32_t  local_size_x 
) const

Dispatch compute workgroups with automatic calculation.

Parameters
cmdCommand buffer
element_countTotal number of elements to process
local_size_xWorkgroup size (from shader local_size_x)

Convenience function that calculates workgroup count automatically. Rounds up to ensure all elements are processed.

Example: // Shader: layout(local_size_x = 256) in; pipeline.dispatch_1d(cmd, 1'000'000, 256); // Internally: dispatch(cmd, ceil(1M / 256), 1, 1)

Definition at line 283 of file VKComputePipeline.cpp.

287{
288 if (local_size_x == 0) {
290 "Invalid workgroup size: {}", local_size_x);
291 return;
292 }
293
294 uint32_t workgroups = calculate_workgroups(element_count, local_size_x);
295 dispatch(cmd, workgroups, 1, 1);
296}
#define MF_ERROR(comp, ctx,...)
static uint32_t calculate_workgroups(uint32_t element_count, uint32_t workgroup_size)
Calculate number of workgroups needed.
void dispatch(vk::CommandBuffer cmd, uint32_t group_count_x, uint32_t group_count_y, uint32_t group_count_z) const
Dispatch compute workgroups.
@ GraphicsBackend
Graphics/visual rendering backend (Vulkan, OpenGL)
@ Core
Core engine, backend, subsystems.

References calculate_workgroups(), MayaFlux::Journal::Core, dispatch(), MayaFlux::Journal::GraphicsBackend, and MF_ERROR.

+ Here is the call graph for this function: