VisuTwin Canvas
C++ 3D Engine — Metal Backend
Loading...
Searching...
No Matches
metalPipeline.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2025-2026 Arnis Lektauers
3//
4// Created by Arnis Lektauers on 05.11.2025.
5//
6#include "metalPipeline.h"
7
8#include <spdlog/spdlog.h>
9
11
12namespace visutwin::canvas
13{
14 static int _layoutId = 0;
15
16 metal::PipelineLayout* MetalPipeline::getPipelineLayout(const std::vector<std::shared_ptr<MetalBindGroupFormat>>& bindGroupFormats) {
17 // Collect bind group layouts from formats
18 std::vector<metal::BindGroupLayout*> bindGroupLayouts;
19 bindGroupLayouts.reserve(bindGroupFormats.size());
20
21 for (const auto& format : bindGroupFormats) {
22 if (format) {
23 bindGroupLayouts.push_back(std::static_pointer_cast<MetalBindGroupFormat>(format)->bindGroupLayout());
24 }
25 }
26
27 metal::PipelineLayoutDesc desc { bindGroupLayouts };
28
29 _layoutId++;
30
31 auto pipelineLayout = new metal::PipelineLayout(desc);
32 pipelineLayout->setDebugLabel(_layoutId, "PipelineLayout-" + std::to_string(_layoutId));
33
34 spdlog::trace("Alloc MetalPipeline: Id " + std::to_string(_layoutId));
35
36 return pipelineLayout;
37 }
38}
metal::PipelineLayout * getPipelineLayout(const std::vector< std::shared_ptr< MetalBindGroupFormat > > &bindGroupFormats)