VisuTwin Canvas
C++ 3D Engine — Metal Backend
Loading...
Searching...
No Matches
shader.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 14.09.2025.
5//
6
7#include "shader.h"
8
9#include <assert.h>
10
11#include "graphicsDevice.h"
12
13namespace visutwin::canvas
14{
15 int Shader::_nextId = 0;
16
18 _device(graphicsDevice), _id(_nextId++), _definition(definition)
19 {
20
21 }
22
23 void Shader::processDefinition()
24 {
25
26 }
27
28 void Shader::processVertexFragmentShaders()
29 {
30 assert(!_definition.vshader.empty() && "No vertex shader has been specified when creating a shader.");
31 assert(!_definition.fshader.empty() && "No fragment shader has been specified when creating a shader.");
32 }
33
34 void Shader::validatePlatformSupport() const
35 {
36
37 }
38
39 std::shared_ptr<Shader> createShader(GraphicsDevice* graphicsDevice, const ShaderDefinition& definition,
40 const std::string& sourceCode)
41 {
42 return graphicsDevice->createShader(definition, sourceCode);
43 }
44}
Abstract GPU interface for resource creation, state management, and draw submission.
virtual std::shared_ptr< Shader > createShader(const ShaderDefinition &definition, const std::string &sourceCode="")
GraphicsDevice * graphicsDevice() const
Definition shader.h:39
Shader(GraphicsDevice *graphicsDevice, const ShaderDefinition &definition)
Definition shader.cpp:17
std::shared_ptr< Shader > createShader(GraphicsDevice *graphicsDevice, const ShaderDefinition &definition, const std::string &sourceCode)
Definition shader.cpp:39