CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
UniformPacker.hpp
Go to the documentation of this file.
1//
2// CeresEngine - A game development framework
3//
4// Created by Rogiel Sulzbach.
5// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6//
7
8#pragma once
9
10#include "Visitor.hpp"
11
13
15
17
19
23 public:
25//NOTE: workaround bug in Clang and GCC where the default constructor struggles with default arguments of braced initializers
26#if defined __clang__ || defined __GNUC__
27 inline CbufferAttributes() {}
28 CbufferAttributes(const CbufferAttributes&) = default;
29 CbufferAttributes& operator=(const CbufferAttributes&) = default;
30#endif
31
32 // Zero-based binding slot, where a negative number indicates to ignore this value.
34
35 // Name of the uniform buffer object.
36 String name = "xsp_cbuffer";
37 };
38
39 private:
41
44
45 public:
46 // Converts the program by moving all global uniform declarations into a single uniform buffer.
48
49 private:
52
54 };
55
56} // namespace CeresEngine::ShaderCompiler
Uniform packer is not a visitor in the conventional sense.
Definition UniformPacker.hpp:22
CbufferAttributes mCbufferAttribs
Definition UniformPacker.hpp:40
UniformBufferDeclarationPtr mUniformBufferDeclaration
Definition UniformPacker.hpp:42
bool canConvertUniformWithTypeDenoter(const TypeDenoter &typeDen) const
void appendUniform(const VarDeclarationStatementPtr &varDeclarationStatement)
void convert(Program &program, const CbufferAttributes &cbufferAttribs={}, bool onlyReachableStatements=true)
BasicDeclarationStatementPtr mDeclarationStatement
Definition UniformPacker.hpp:43
Definition AST.hpp:33
SPtr< VarDeclarationStatement > VarDeclarationStatementPtr
Definition Visitor.hpp:49
SPtr< UniformBufferDeclaration > UniformBufferDeclarationPtr
Definition Visitor.hpp:45
SPtr< BasicDeclarationStatement > BasicDeclarationStatementPtr
Definition Visitor.hpp:51
std::int32_t Int32
Definition DataTypes.hpp:21
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
Definition TypeDenoter.hpp:82