MayaFlux 1.0.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 233 of file VKComputePipeline.cpp.

239{
240 if (!m_layout) {
242 "Cannot push constants without pipeline layout");
243 return;
244 }
245
246 if (!data) {
248 "Cannot push null data");
249 return;
250 }
251
252 if (size == 0) {
254 "Pushing zero-sized constant data");
255 return;
256 }
257
258 cmd.pushConstants(m_layout, stage_flags, offset, size, data);
259}
#define MF_ERROR(comp, ctx,...)
#define MF_WARN(comp, ctx,...)
vk::CommandBuffer cmd
uint64_t offset
Definition Composite.cpp:10
bool size
@ GraphicsBackend
Graphics/visual rendering backend (Vulkan, OpenGL)
@ Core
Core engine, backend, subsystems.

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