cae  0.0.0
Cross-API graphics engine
Loading...
Searching...
No Matches
IShaderIR.hpp
Go to the documentation of this file.
1///
2/// @file IShaderIR.hpp
3/// @brief This file contains the ShaderIR interface
4/// @namespace cae
5///
6
7#pragma once
8
10
11#include <span>
12#include <stdexcept>
13
14namespace cae
15{
16
17 ///
18 /// @interface IShaderIR
19 /// @brief Interface for shaders IR
20 /// @namespace cae
21 ///
22 class IShaderIR : public utl::IPlugin
23 {
24
25 public:
26 ~IShaderIR() override = default;
27
28 ///
29 /// @return The IR type this processor handles
30 /// @brief Get the IR type this processor handles
31 ///
32 virtual ShaderSourceType irType() const = 0;
33
34 ///
35 /// @brief Transform or validate a shader IR module
36 /// @param module The input IR module
37 /// @return Transformed IR module ready for the backend
38 ///
39 virtual ShaderIRModule process(const ShaderIRModule &module) = 0;
40
41 ///
42 /// @brief Optional: optimize a batch of IR modules
43 ///
44 virtual void optimize(std::span<ShaderIRModule> modules) { /* default: no-op */ }
45
46 ///
47 /// @brief Optional: cross-compile from one IR to another (SPIR-V -> MSL, etc.)
48 ///
50 {
51 throw std::runtime_error("Cross-compilation not implemented");
52 }
53
54 }; // interface IShaderIR
55
56} // namespace cae
This file contains the ShaderFrontend interface.
Interface for shaders IR.
Definition IShaderIR.hpp:23
virtual ShaderIRModule crossCompile(const ShaderIRModule &module, ShaderSourceType targetType)
Optional: cross-compile from one IR to another (SPIR-V -> MSL, etc.)
Definition IShaderIR.hpp:49
virtual ShaderSourceType irType() const =0
Get the IR type this processor handles.
~IShaderIR() override=default
virtual ShaderIRModule process(const ShaderIRModule &module)=0
Transform or validate a shader IR module.
virtual void optimize(std::span< ShaderIRModule > modules)
Optional: optimize a batch of IR modules.
Definition IShaderIR.hpp:44
Interface for plugins.
Definition IPlugin.hpp:46
Struct for shader intermediate representation module.