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

◆ bind_descriptor() [1/2]

void MayaFlux::Buffers::FormaBindingsProcessor::bind_descriptor ( const std::string &  name,
std::function< float()>  reader,
const std::string &  descriptor_name,
uint32_t  binding_index,
uint32_t  set,
Portal::Graphics::DescriptorRole  role = Portal::Graphics::DescriptorRole::UNIFORM 
)

Bind a type-erased reader to a descriptor binding.

Used by Bridge for the same reason as the push constant raw overload.

Parameters
nameLogical binding name.
readerCallable returning the current float value each tick.
descriptor_nameDescriptor name in the shader config.
binding_indexVulkan binding index within the descriptor set.
setDescriptor set index.
roleUNIFORM for UBO, STORAGE for SSBO.

Definition at line 38 of file FormaBindingsProcessor.cpp.

45{
46 if (!reader) {
48 "FormaBindingsProcessor::bind_descriptor: null reader for '{}'", name);
49 return;
50 }
51
52 auto& b = m_bindings[name];
54 b.reader = std::move(reader);
55 b.pc.reset();
56
57 auto gpu_buf = make_descriptor_buffer(role);
58
59 b.desc = DescriptorTarget {
60 .descriptor_name = descriptor_name,
61 .set_index = set,
62 .binding_index = binding_index,
63 .role = role,
64 .gpu_buffer = gpu_buf,
65 .buffer_size = sizeof(float),
66 };
67
68 bind_buffer(descriptor_name, gpu_buf);
70}
#define MF_ERROR(comp, ctx,...)
size_t b
static std::shared_ptr< VKBuffer > make_descriptor_buffer(Portal::Graphics::DescriptorRole role)
std::unordered_map< std::string, Binding > m_bindings
void bind_buffer(const std::string &descriptor_name, const std::shared_ptr< VKBuffer > &buffer)
Bind a VKBuffer to a named shader descriptor.
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.

References b, MayaFlux::Buffers::ShaderProcessor::bind_buffer(), MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, DESCRIPTOR, MayaFlux::Buffers::FormaBindingsProcessor::DescriptorTarget::descriptor_name, m_bindings, MayaFlux::Buffers::ShaderProcessor::m_needs_descriptor_rebuild, make_descriptor_buffer(), and MF_ERROR.

+ Here is the call graph for this function: