25{
28 "Cannot create pipeline without shader");
29 return;
30 }
31
33
34 std::map<std::pair<uint32_t, uint32_t>, Portal::Graphics::DescriptorBindingInfo> unified_bindings;
35
36 const auto& descriptor_bindings = buffer->get_pipeline_context().descriptor_buffer_bindings;
37 for (const auto& binding : descriptor_bindings) {
38 unified_bindings[{ binding.set, binding.binding }] = binding;
39 }
40
41 for (
const auto& [name, binding] :
m_config.bindings) {
42 auto key = std::make_pair(binding.set, binding.binding);
43 if (unified_bindings.find(key) == unified_bindings.end()) {
44 unified_bindings[key] = Portal::Graphics::DescriptorBindingInfo {
45 .set = binding.set,
46 .binding = binding.binding,
47 .type = binding.type,
48 .buffer_info = {},
49 .name = name
50 };
51 }
52 }
53
54 std::map<uint32_t, std::vector<Portal::Graphics::DescriptorBindingInfo>> bindings_by_set;
55 for (const auto& [key, binding] : unified_bindings) {
56 bindings_by_set[binding.set].push_back(binding);
57 }
58
59 std::vector<std::vector<Portal::Graphics::DescriptorBindingInfo>> descriptor_sets;
60
61 descriptor_sets.reserve(bindings_by_set.size());
62 for (const auto& [set_index, set_bindings] : bindings_by_set) {
63 descriptor_sets.push_back(set_bindings);
64 }
65
68 descriptor_sets,
70
73 "Failed to create compute pipeline");
74 return;
75 }
76
78
80 "Compute pipeline created (ID: {}, {} descriptor sets, {} bytes push constants)",
82}
#define MF_INFO(comp, ctx,...)
#define MF_ERROR(comp, ctx,...)
Portal::Graphics::ComputePipelineID m_pipeline_id
Portal::Graphics::ShaderID m_shader_id
size_t resolve_push_constant_size(const std::shared_ptr< VKBuffer > &buffer) const
Byte width of this processor's push constant block, extended to cover any fragment staged on the buff...
virtual void on_pipeline_created(Portal::Graphics::ComputePipelineID pipeline_id)
Called after pipeline is created.
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.
constexpr ShaderID INVALID_SHADER
constexpr ComputePipelineID INVALID_COMPUTE_PIPELINE
MAYAFLUX_API ComputePress & get_compute_press()
size_t push_constant_size