Last nzsl version update

This commit is contained in:
SirLynix
2022-06-07 20:18:16 +02:00
parent 510ef8c41e
commit c7b6d83bbc
16 changed files with 38 additions and 20 deletions

View File

@@ -67,7 +67,7 @@ namespace Nz
if (!m_program.GetLinkStatus(&errLog))
throw std::runtime_error("failed to link program: " + errLog);
m_flipYUniformLocation = m_program.GetUniformLocation(nzsl::GlslWriter::GetFlipYUniformName());
m_flipYUniformLocation = m_program.GetUniformLocation(nzsl::GlslWriter::GetFlipYUniformName().data());
if (m_flipYUniformLocation != -1)
m_program.Uniform(m_flipYUniformLocation, 1.f);
}

View File

@@ -5,8 +5,8 @@
#include <Nazara/OpenGLRenderer/OpenGLShaderModule.hpp>
#include <Nazara/Core/MemoryView.hpp>
#include <Nazara/OpenGLRenderer/Utils.hpp>
#include <NZSL/ShaderLangLexer.hpp>
#include <NZSL/ShaderLangParser.hpp>
#include <NZSL/Lexer.hpp>
#include <NZSL/Parser.hpp>
#include <NZSL/Ast/AstSerializer.hpp>
#include <stdexcept>
#include <Nazara/OpenGLRenderer/Debug.hpp>
@@ -117,8 +117,17 @@ namespace Nz
shader.SetSource(arg.sourceCode.data(), GLint(arg.sourceCode.size()));
else if constexpr (std::is_same_v<T, ShaderStatement>)
{
std::string code = writer.Generate(shaderEntry.stage, *arg.ast, bindingMapping, m_states);
shader.SetSource(code.data(), GLint(code.size()));
nzsl::GlslWriter::Output output = writer.Generate(shaderEntry.stage, *arg.ast, bindingMapping, m_states);
shader.SetSource(output.code.data(), GLint(output.code.size()));
for (const auto& [name, bindingPoint] : output.explicitUniformBlockBinding)
{
GLuint blockIndex = program.GetUniformBlockIndex(name);
if (blockIndex == GL_INVALID_INDEX)
continue;
program.UniformBlockBinding(blockIndex, bindingPoint);
}
}
else
static_assert(AlwaysFalse<T>::value, "non-exhaustive visitor");