Minor fixes

This commit is contained in:
Jérôme Leclercq 2021-04-17 18:11:47 +02:00
parent 2238bbfa0c
commit 044195b209
5 changed files with 13 additions and 4 deletions

View File

@ -36,6 +36,7 @@
#include <Nazara/OpenGLRenderer/OpenGLCommandBufferBuilder.hpp>
#include <Nazara/OpenGLRenderer/OpenGLCommandPool.hpp>
#include <Nazara/OpenGLRenderer/OpenGLDevice.hpp>
#include <Nazara/OpenGLRenderer/OpenGLFboFramebuffer.hpp>
#include <Nazara/OpenGLRenderer/OpenGLFramebuffer.hpp>
#include <Nazara/OpenGLRenderer/OpenGLRenderer.hpp>
#include <Nazara/OpenGLRenderer/OpenGLRenderImage.hpp>

View File

@ -123,9 +123,7 @@ namespace Nz
if (!shader.Create(device, ToOpenGL(shaderStage)))
throw std::runtime_error("failed to create shader"); //< TODO: Handle error message
ShaderAst::AstCloner cloner; //< FIXME: Required because writer may update AST
ShaderAst::StatementPtr clonedAst = cloner.Clone(shaderAst);
std::string code = writer.Generate(shaderStage, clonedAst, states);
std::string code = writer.Generate(shaderStage, shaderAst, states);
shader.SetSource(code.data(), code.size());
shader.Compile();

View File

@ -734,6 +734,11 @@ namespace Nz
LeaveScope();
}
void GlslWriter::Visit(ShaderAst::DeclareOptionStatement& node)
{
/* nothing to do */
}
void GlslWriter::Visit(ShaderAst::DeclareStructStatement& node)
{
assert(node.structIndex);

View File

@ -600,6 +600,11 @@ namespace Nz
m_instructions.Append(SpirvOp::OpFunctionEnd);
}
void SpirvAstVisitor::Visit(ShaderAst::DeclareOptionStatement& node)
{
/* nothing to do */
}
void SpirvAstVisitor::Visit(ShaderAst::DeclareStructStatement& node)
{
assert(node.structIndex);

View File

@ -76,7 +76,7 @@ SCENARIO("Shader generation", "[Shader]")
external->externalVars.push_back({
std::nullopt,
"ubo",
Nz::ShaderAst::IdentifierType{ "outerStruct" }
Nz::ShaderAst::UniformType{ Nz::ShaderAst::IdentifierType{ "outerStruct" } }
});
statements.push_back(std::move(external));