/* * Copyright (c) 2022, Stephan Unverwerth * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include namespace GPU::IR { enum class Opcode { Move, }; enum class StorageLocation { Constant, Uniform, Input, Output, Temporary, }; enum class StorageType { Float, Vector2, Vector3, Vector4, Matrix3x3, Matrix4x4, }; struct StorageReference final { StorageLocation location; size_t index; }; struct Instruction final { Opcode operation; Vector arguments; StorageReference result; }; struct Constant final { StorageType type; union { float float_values[16]; }; }; struct Uniform final { String name; StorageType type; }; struct Input final { String name; StorageType type; }; struct Output final { String name; StorageType type; }; struct Temporary final { StorageType type; }; struct Shader final { Vector constants; Vector uniforms; Vector inputs; Vector outputs; Vector temporaries; Vector instructions; }; }