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

@@ -11,7 +11,7 @@
#include <Nazara/Utility/BufferMapper.hpp>
#include <Nazara/Utility/MaterialData.hpp>
#include <NZSL/FieldOffsets.hpp>
#include <NZSL/ShaderLangParser.hpp>
#include <NZSL/Parser.hpp>
#include <cassert>
#include <Nazara/Graphics/Debug.hpp>

View File

@@ -4,7 +4,7 @@
#include <Nazara/Graphics/DepthMaterial.hpp>
#include <NZSL/FieldOffsets.hpp>
#include <NZSL/ShaderLangParser.hpp>
#include <NZSL/Parser.hpp>
#include <Nazara/Graphics/Debug.hpp>
namespace Nz

View File

@@ -10,7 +10,7 @@
#include <Nazara/Utility/BufferMapper.hpp>
#include <Nazara/Utility/MaterialData.hpp>
#include <NZSL/FieldOffsets.hpp>
#include <NZSL/ShaderLangParser.hpp>
#include <NZSL/Parser.hpp>
#include <cassert>
#include <filesystem>
#include <Nazara/Graphics/Debug.hpp>

View File

@@ -19,7 +19,7 @@ namespace Nz
{
}
UberShader::UberShader(nzsl::ShaderStageTypeFlags shaderStages, nzsl::ShaderModuleResolver& moduleResolver, std::string moduleName) :
UberShader::UberShader(nzsl::ShaderStageTypeFlags shaderStages, nzsl::ModuleResolver& moduleResolver, std::string moduleName) :
m_shaderStages(shaderStages)
{
m_shaderModule = moduleResolver.Resolve(moduleName);
@@ -27,7 +27,7 @@ namespace Nz
m_shaderModule = Validate(*m_shaderModule, &m_optionIndexByName);
m_onShaderModuleUpdated.Connect(moduleResolver.OnModuleUpdated, [this, name = std::move(moduleName)](nzsl::ShaderModuleResolver* resolver, const std::string& updatedModuleName)
m_onShaderModuleUpdated.Connect(moduleResolver.OnModuleUpdated, [this, name = std::move(moduleName)](nzsl::ModuleResolver* resolver, const std::string& updatedModuleName)
{
if (updatedModuleName != name)
return;

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");

View File

@@ -3,8 +3,8 @@
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/VulkanRenderer/VulkanShaderModule.hpp>
#include <NZSL/ShaderLangLexer.hpp>
#include <NZSL/ShaderLangParser.hpp>
#include <NZSL/Lexer.hpp>
#include <NZSL/Parser.hpp>
#include <NZSL/SpirvDecoder.hpp>
#include <NZSL/SpirvWriter.hpp>
#include <NZSL/Ast/AstSerializer.hpp>