// Copyright (C) 2020 Jérôme Leclercq // This file is part of the "Nazara Engine - Renderer module" // For conditions of distribution and use, see copyright notice in Config.hpp #include #include #include namespace Nz { template void GlslWriter::Append(const T& param) { NazaraAssert(m_currentState, "This function should only be called while processing an AST"); m_currentState->stream << param; } template void GlslWriter::DeclareVariables(const std::vector& variables, const std::string& keyword, const std::string& section) { if (!variables.empty()) { if (!section.empty()) AppendCommentSection(section); for (const auto& var : variables) { if constexpr (std::is_same_v) { if (var.locationIndex) { Append("layout(location = "); Append(*var.locationIndex); Append(") "); } } else if constexpr (std::is_same_v) { if (var.bindingIndex) { Append("layout(binding = "); Append(*var.bindingIndex); Append(") "); } } if (!keyword.empty()) { Append(keyword); Append(" "); } Append(var.type); Append(" "); Append(var.name); AppendLine(";"); } AppendLine(); } } } #include