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

◆ push_constants()

void MayaFlux::Core::VKComputePipeline::push_constants ( vk::CommandBuffer  cmd,
vk::ShaderStageFlags  stage_flags,
uint32_t  offset,
uint32_t  size,
const void *  data 
) const

Update push constants.

Parameters
cmdCommand buffer
stage_flagsShader stages that will access this data
offsetOffset in push constant block (bytes)
sizeSize of data (bytes)
dataPointer to data to copy

Updates push constant data that will be visible to the shader. More efficient than descriptor sets for small, frequently-changing data.

Example: struct Params { float scale; uint32_t iterations; }; Params params = {2.0f, 100}; pipeline.push_constants(cmd, vk::ShaderStageFlagBits::eCompute, 0, sizeof(params), &params);

Definition at line 229 of file VKComputePipeline.cpp.

235{
236 if (!m_layout) {
238 "Cannot push constants without pipeline layout");
239 return;
240 }
241
242 if (!data) {
244 "Cannot push null data");
245 return;
246 }
247
248 if (size == 0) {
250 "Pushing zero-sized constant data");
251 return;
252 }
253
254 cmd.pushConstants(m_layout, stage_flags, offset, size, data);
255}
#define MF_ERROR(comp, ctx,...)
#define MF_WARN(comp, ctx,...)
@ GraphicsBackend
Graphics/visual rendering backend (Vulkan, OpenGL)
@ Core
Core engine, backend, subsystems.

References MayaFlux::Journal::Core, MayaFlux::Journal::GraphicsBackend, m_layout, MF_ERROR, and MF_WARN.