Shader/SpirvWriter: Split section to another class + improve variadic parameters support
This commit is contained in:
@@ -20,6 +20,8 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class SpirvSection;
|
||||
|
||||
class NAZARA_SHADER_API SpirvWriter : public ShaderAstVisitor, public ShaderVarVisitor
|
||||
{
|
||||
public:
|
||||
@@ -42,33 +44,6 @@ namespace Nz
|
||||
|
||||
private:
|
||||
struct ExtVar;
|
||||
struct Opcode;
|
||||
struct Raw;
|
||||
struct WordCount;
|
||||
|
||||
struct Section
|
||||
{
|
||||
inline std::size_t Append(const char* str);
|
||||
inline std::size_t Append(const std::string_view& str);
|
||||
inline std::size_t Append(const std::string& str);
|
||||
inline std::size_t Append(UInt32 value);
|
||||
std::size_t Append(const Opcode& opcode, const WordCount& wordCount);
|
||||
std::size_t Append(const Raw& raw);
|
||||
inline std::size_t Append(std::initializer_list<UInt32> codepoints);
|
||||
template<typename... Args> std::size_t Append(Opcode opcode, const Args&... args);
|
||||
template<typename T> std::size_t Append(T value);
|
||||
|
||||
inline unsigned int CountWord(const char* str);
|
||||
inline unsigned int CountWord(const std::string_view& str);
|
||||
inline unsigned int CountWord(const std::string& str);
|
||||
unsigned int CountWord(const Raw& raw);
|
||||
template<typename T> unsigned int CountWord(const T& value);
|
||||
template<typename T1, typename T2, typename... Args> unsigned int CountWord(const T1& value, const T2& value2, const Args&... rest);
|
||||
|
||||
inline std::size_t GetOutputOffset() const;
|
||||
|
||||
std::vector<UInt32> data;
|
||||
};
|
||||
|
||||
UInt32 AllocateResultId();
|
||||
|
||||
@@ -111,7 +86,7 @@ namespace Nz
|
||||
void Visit(ShaderNodes::ParameterVariable& var) override;
|
||||
void Visit(ShaderNodes::UniformVariable& var) override;
|
||||
|
||||
static void MergeBlocks(std::vector<UInt32>& output, const Section& from);
|
||||
static void MergeBlocks(std::vector<UInt32>& output, const SpirvSection& from);
|
||||
|
||||
struct Context
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user