VisuTwin Canvas
C++ 3D Engine — Metal Backend
Loading...
Searching...
No Matches
metalShader.h
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 19.10.2025.
5//
6#pragma once
7
8#include <unordered_map>
9#include <Metal/Metal.hpp>
10#include <Foundation/NSBundle.hpp>
11
13
14namespace visutwin::canvas
15{
20 class MetalShader : public Shader
21 {
22 public:
23 MetalShader(GraphicsDevice* graphicsDevice, const ShaderDefinition& definition, std::string sourceCode = "");
24 ~MetalShader() override;
25
26 MTL::Library* getLibrary(MTL::Device* device, const NS::Bundle* bundle, NS::Error** error);
27
28 private:
29 std::string _sourceCode;
30 std::unordered_map<MTL::Device*, MTL::Library*> _libraries;
31 };
32}
Abstract GPU interface for resource creation, state management, and draw submission.
MTL::Library * getLibrary(MTL::Device *device, const NS::Bundle *bundle, NS::Error **error)
MetalShader(GraphicsDevice *graphicsDevice, const ShaderDefinition &definition, std::string sourceCode="")
GraphicsDevice * graphicsDevice() const
Definition shader.h:39
Shader(GraphicsDevice *graphicsDevice, const ShaderDefinition &definition)
Definition shader.cpp:17