Split shader generation to a new module

This commit is contained in:
Jérôme Leclercq 2020-08-11 00:00:36 +02:00
parent 0313f2d0a6
commit 837a6585a1
86 changed files with 564 additions and 312 deletions

View File

@ -2,12 +2,9 @@ MODULE.Name = "Renderer"
MODULE.ClientOnly = true
MODULE.Defines = {
"NAZARA_RENDERER_OPENGL"
}
MODULE.Libraries = {
"NazaraCore",
"NazaraShader",
"NazaraUtility",
"NazaraPlatform"
}
@ -22,14 +19,3 @@ MODULE.OsFiles.Posix = {
"../src/Nazara/Renderer/GLX/**.cpp"
}
MODULE.OsLibraries.Windows = {
"gdi32",
"opengl32",
"winmm"
}
MODULE.OsLibraries.Posix = {
"GL",
"X11"
}

View File

@ -0,0 +1,6 @@
MODULE.Name = "Shader"
MODULE.Libraries = {
"NazaraCore",
"NazaraUtility"
}

View File

@ -28,7 +28,7 @@ TOOL.Files = {
TOOL.Libraries = {
"NazaraCore",
"NazaraRenderer",
"NazaraShader",
"NazaraUtility",
"Qt5Cored",
"Qt5Guid",

View File

@ -1,7 +1,5 @@
#include <Nazara/Utility.hpp>
#include <Nazara/Renderer.hpp>
#include <Nazara/Renderer/ShaderAstCloner.hpp>
#include <Nazara/Renderer/SpirvWriter.hpp>
#include <array>
#include <iostream>

View File

@ -50,4 +50,4 @@
#define NAZARA_OPENGLRENDERER_API
#endif
#endif // NAZARA_CONFIG_MODULENAME_HPP
#endif // NAZARA_CONFIG_OPENGLRENDERER_HPP

View File

@ -4,8 +4,8 @@
#pragma once
#ifndef NAZARA_CONFIG_CHECK_OPENGLE_HPP
#define NAZARA_CONFIG_CHECK_OPENGLE_HPP
#ifndef NAZARA_CONFIG_CHECK_OPENGLRENDERER_HPP
#define NAZARA_CONFIG_CHECK_OPENGLRENDERER_HPP
/// Ce fichier sert à vérifier la valeur des constantes du fichier Config.hpp
@ -15,8 +15,8 @@
// On force la valeur de MANAGE_MEMORY en mode debug
#if defined(NAZARA_DEBUG) && !NAZARA_OPENGLRENDERER_MANAGE_MEMORY
#undef NAZARA_MODULENAME_MANAGE_MEMORY
#define NAZARA_MODULENAME_MANAGE_MEMORY 0
#undef NAZARA_OPENGLRENDERER_MANAGE_MEMORY
#define NAZARA_OPENGLRENDERER_MANAGE_MEMORY 0
#endif
#endif // NAZARA_CONFIG_CHECK_OPENGLRENDERER_HPP

View File

@ -3,6 +3,6 @@
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/OpenGLRenderer/Config.hpp>
#if NAZARA_MODULENAME_MANAGE_MEMORY
#if NAZARA_OPENGLRENDERER_MANAGE_MEMORY
#include <Nazara/Core/Debug/NewRedefinition.hpp>
#endif

View File

@ -3,7 +3,7 @@
// For conditions of distribution and use, see copyright notice in Config.hpp
// On suppose que Debug.hpp a déjà été inclus, tout comme Config.hpp
#if NAZARA_MODULENAME_MANAGE_MEMORY
#if NAZARA_OPENGLRENDERER_MANAGE_MEMORY
#undef delete
#undef new
#endif

View File

@ -1,4 +1,4 @@
// Copyright (C) 2015 Jérôme Leclercq
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - OpenGL Renderer"
// For conditions of distribution and use, see copyright notice in Config.hpp

View File

@ -1,4 +1,4 @@
// Copyright (C) 2015 Jérôme Leclercq
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - OpenGL Renderer"
// For conditions of distribution and use, see copyright notice in Config.hpp

View File

@ -1,4 +1,4 @@
// Copyright (C) 2015 Jérôme Leclercq
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - OpenGL Renderer"
// For conditions of distribution and use, see copyright notice in Config.hpp

View File

@ -1,4 +1,4 @@
// Copyright (C) 2015 Jérôme Leclercq
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - OpenGL Renderer"
// For conditions of distribution and use, see copyright notice in Config.hpp

View File

@ -1,4 +1,4 @@
// Copyright (C) 2015 Jérôme Leclercq
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - OpenGL Renderer"
// For conditions of distribution and use, see copyright notice in Config.hpp

View File

@ -1,4 +1,4 @@
// Copyright (C) 2015 Jérôme Leclercq
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - OpenGL Renderer"
// For conditions of distribution and use, see copyright notice in Config.hpp

View File

@ -36,7 +36,6 @@
#include <Nazara/Renderer/DebugDrawer.hpp>
#include <Nazara/Renderer/Enums.hpp>
#include <Nazara/Renderer/Framebuffer.hpp>
#include <Nazara/Renderer/GlslWriter.hpp>
#include <Nazara/Renderer/RenderBuffer.hpp>
#include <Nazara/Renderer/RenderBufferView.hpp>
#include <Nazara/Renderer/RenderDevice.hpp>
@ -52,22 +51,8 @@
#include <Nazara/Renderer/RenderWindow.hpp>
#include <Nazara/Renderer/RenderWindowImpl.hpp>
#include <Nazara/Renderer/RenderWindowParameters.hpp>
#include <Nazara/Renderer/ShaderAst.hpp>
#include <Nazara/Renderer/ShaderAstCloner.hpp>
#include <Nazara/Renderer/ShaderAstRecursiveVisitor.hpp>
#include <Nazara/Renderer/ShaderAstSerializer.hpp>
#include <Nazara/Renderer/ShaderAstValidator.hpp>
#include <Nazara/Renderer/ShaderAstVisitor.hpp>
#include <Nazara/Renderer/ShaderBinding.hpp>
#include <Nazara/Renderer/ShaderBuilder.hpp>
#include <Nazara/Renderer/ShaderEnums.hpp>
#include <Nazara/Renderer/ShaderExpressionType.hpp>
#include <Nazara/Renderer/ShaderNodes.hpp>
#include <Nazara/Renderer/ShaderStageImpl.hpp>
#include <Nazara/Renderer/ShaderVariables.hpp>
#include <Nazara/Renderer/ShaderVarVisitor.hpp>
#include <Nazara/Renderer/ShaderWriter.hpp>
#include <Nazara/Renderer/SpirvWriter.hpp>
#include <Nazara/Renderer/Texture.hpp>
#include <Nazara/Renderer/TextureSampler.hpp>
#include <Nazara/Renderer/UploadPool.hpp>

View File

@ -53,24 +53,6 @@ namespace Nz
SpirV
};
enum class ShaderStageType
{
Fragment,
Vertex,
Max = Vertex
};
template<>
struct EnumAsFlags<ShaderStageType>
{
static constexpr ShaderStageType max = ShaderStageType::Max;
};
using ShaderStageTypeFlags = Flags<ShaderStageType>;
constexpr ShaderStageTypeFlags ShaderStageType_All = ShaderStageType::Fragment | ShaderStageType::Vertex;
enum class QueueType
{
Compute,

View File

@ -10,6 +10,7 @@
#include <Nazara/Core/MovablePtr.hpp>
#include <Nazara/Renderer/Enums.hpp>
#include <Nazara/Renderer/ShaderBinding.hpp>
#include <Nazara/Utility/Enums.hpp>
#include <memory>
#include <string>
#include <vector>

View File

@ -1,12 +0,0 @@
// 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 <Nazara/Renderer/ShaderAstCloner.hpp>
#include <Nazara/Renderer/Debug.hpp>
namespace Nz
{
}
#include <Nazara/Renderer/DebugOff.hpp>

View File

@ -1,12 +0,0 @@
// 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 <Nazara/Renderer/ShaderAstRecursiveVisitor.hpp>
#include <Nazara/Renderer/Debug.hpp>
namespace Nz
{
}
#include <Nazara/Renderer/DebugOff.hpp>

50
include/Nazara/Shader.hpp Normal file
View File

@ -0,0 +1,50 @@
// This file was automatically generated
/*
Nazara Engine - Module name
Copyright (C) 2020 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#pragma once
#ifndef NAZARA_GLOBAL_SHADER_HPP
#define NAZARA_GLOBAL_SHADER_HPP
#include <Nazara/Shader/Config.hpp>
#include <Nazara/Shader/GlslWriter.hpp>
#include <Nazara/Shader/Shader.hpp>
#include <Nazara/Shader/ShaderAst.hpp>
#include <Nazara/Shader/ShaderAstCloner.hpp>
#include <Nazara/Shader/ShaderAstRecursiveVisitor.hpp>
#include <Nazara/Shader/ShaderAstSerializer.hpp>
#include <Nazara/Shader/ShaderAstValidator.hpp>
#include <Nazara/Shader/ShaderAstVisitor.hpp>
#include <Nazara/Shader/ShaderBuilder.hpp>
#include <Nazara/Shader/ShaderEnums.hpp>
#include <Nazara/Shader/ShaderExpressionType.hpp>
#include <Nazara/Shader/ShaderNodes.hpp>
#include <Nazara/Shader/ShaderVariables.hpp>
#include <Nazara/Shader/ShaderVarVisitor.hpp>
#include <Nazara/Shader/ShaderWriter.hpp>
#include <Nazara/Shader/SpirvWriter.hpp>
#endif // NAZARA_GLOBAL_SHADER_HPP

View File

@ -0,0 +1,53 @@
/*
Nazara Engine - Shader generator
Copyright (C) 2020 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#pragma once
#ifndef NAZARA_CONFIG_SHADER_HPP
#define NAZARA_CONFIG_SHADER_HPP
/// Each modification of a parameter needs a recompilation of the module
// Use the MemoryManager to manage dynamic allocations (can detect memory leak but allocations/frees are slower)
#define NAZARA_SHADER_MANAGE_MEMORY 0
// Activate the security tests based on the code (Advised for development)
#define NAZARA_SHADER_SAFE 1
/// Each modification of a parameter following implies a modification (often minor) of the code
/// Checking the values and types of certain constants
#include <Nazara/Shader/ConfigCheck.hpp>
#if !defined(NAZARA_STATIC)
#ifdef NAZARA_SHADER_BUILD
#define NAZARA_SHADER_API NAZARA_EXPORT
#else
#define NAZARA_SHADER_API NAZARA_IMPORT
#endif
#else
#define NAZARA_SHADER_API
#endif
#endif // NAZARA_CONFIG_SHADER_HPP

View File

@ -0,0 +1,22 @@
// Copyright (C) YEAR AUTHORS
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_CONFIG_CHECK_SHADER_HPP
#define NAZARA_CONFIG_CHECK_SHADER_HPP
/// This file is used to check the constant values defined in Config.hpp
#include <type_traits>
#define CheckType(name, type, err) static_assert(std::is_ ##type <decltype(name)>::value, #type err)
#define CheckTypeAndVal(name, type, op, val, err) static_assert(std::is_ ##type <decltype(name)>::value && name op val, #type err)
// We force the value of MANAGE_MEMORY in debug
#if defined(NAZARA_DEBUG) && !NAZARA_SHADER_MANAGE_MEMORY
#undef NAZARA_SHADER_MANAGE_MEMORY
#define NAZARA_SHADER_MANAGE_MEMORY 0
#endif
#endif // NAZARA_CONFIG_CHECK_SHADER_HPP

View File

@ -0,0 +1,8 @@
// Copyright (C) YEAR AUTHORS
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Shader/Config.hpp>
#if NAZARA_SHADER_MANAGE_MEMORY
#include <Nazara/Core/Debug/NewRedefinition.hpp>
#endif

View File

@ -0,0 +1,9 @@
// Copyright (C) YEAR AUTHORS
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
// We suppose that Debug.hpp is already included, same goes for Config.hpp
#if NAZARA_SHADER_MANAGE_MEMORY
#undef delete
#undef new
#endif

View File

@ -8,11 +8,11 @@
#define NAZARA_GLSLWRITER_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Renderer/Config.hpp>
#include <Nazara/Renderer/ShaderAst.hpp>
#include <Nazara/Renderer/ShaderVarVisitor.hpp>
#include <Nazara/Renderer/ShaderAstVisitor.hpp>
#include <Nazara/Renderer/ShaderWriter.hpp>
#include <Nazara/Shader/Config.hpp>
#include <Nazara/Shader/ShaderAst.hpp>
#include <Nazara/Shader/ShaderVarVisitor.hpp>
#include <Nazara/Shader/ShaderAstVisitor.hpp>
#include <Nazara/Shader/ShaderWriter.hpp>
#include <set>
#include <sstream>
#include <string>
@ -20,7 +20,7 @@
namespace Nz
{
class NAZARA_RENDERER_API GlslWriter : public ShaderWriter, public ShaderVarVisitor, public ShaderAstVisitor
class NAZARA_SHADER_API GlslWriter : public ShaderWriter, public ShaderVarVisitor, public ShaderAstVisitor
{
public:
struct Environment;
@ -104,6 +104,6 @@ namespace Nz
};
}
#include <Nazara/Renderer/GlslWriter.inl>
#include <Nazara/Shader/GlslWriter.inl>
#endif // NAZARA_GLSLWRITER_HPP

View File

@ -1,10 +1,10 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Renderer module"
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Renderer/GlslWriter.hpp>
#include <Nazara/Shader/GlslWriter.hpp>
#include <type_traits>
#include <Nazara/Renderer/Debug.hpp>
#include <Nazara/Shader/Debug.hpp>
namespace Nz
{
@ -129,4 +129,4 @@ namespace Nz
}
}
#include <Nazara/Renderer/DebugOff.hpp>
#include <Nazara/Shader/DebugOff.hpp>

View File

@ -0,0 +1,33 @@
// Copyright (C) YEAR AUTHORS
// This file is part of the "Nazara Engine - Module name"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_SHADER_HPP
#define NAZARA_SHADER_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Core/Initializer.hpp>
#include <Nazara/Shader/Config.hpp>
namespace Nz
{
class NAZARA_SHADER_API Shader
{
public:
Shader() = delete;
~Shader() = delete;
static bool Initialize();
static bool IsInitialized();
static void Uninitialize();
private:
static unsigned int s_moduleReferenceCounter;
};
}
#endif // NAZARA_SHADER_HPP

View File

@ -8,16 +8,16 @@
#define NAZARA_SHADER_AST_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Renderer/Enums.hpp>
#include <Nazara/Renderer/ShaderExpressionType.hpp>
#include <Nazara/Renderer/ShaderNodes.hpp>
#include <Nazara/Shader/ShaderExpressionType.hpp>
#include <Nazara/Shader/ShaderNodes.hpp>
#include <Nazara/Utility/Enums.hpp>
#include <optional>
#include <unordered_map>
#include <vector>
namespace Nz
{
class NAZARA_RENDERER_API ShaderAst
class NAZARA_SHADER_API ShaderAst
{
public:
struct Function;
@ -110,6 +110,6 @@ namespace Nz
};
}
#include <Nazara/Renderer/ShaderAst.inl>
#include <Nazara/Shader/ShaderAst.inl>
#endif // NAZARA_SHADER_AST_HPP

View File

@ -1,9 +1,9 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Renderer module"
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Renderer/ShaderAst.hpp>
#include <Nazara/Renderer/Debug.hpp>
#include <Nazara/Shader/ShaderAst.hpp>
#include <Nazara/Shader/Debug.hpp>
namespace Nz
{
@ -98,4 +98,4 @@ namespace Nz
}
}
#include <Nazara/Renderer/DebugOff.hpp>
#include <Nazara/Shader/DebugOff.hpp>

View File

@ -1,5 +1,5 @@
// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Engine - Renderer module"
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
@ -8,14 +8,14 @@
#define NAZARA_SHADERASTCLONER_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Renderer/Config.hpp>
#include <Nazara/Renderer/ShaderAstVisitor.hpp>
#include <Nazara/Renderer/ShaderVarVisitor.hpp>
#include <Nazara/Shader/Config.hpp>
#include <Nazara/Shader/ShaderAstVisitor.hpp>
#include <Nazara/Shader/ShaderVarVisitor.hpp>
#include <vector>
namespace Nz
{
class NAZARA_RENDERER_API ShaderAstCloner : public ShaderAstVisitor, public ShaderVarVisitor
class NAZARA_SHADER_API ShaderAstCloner : public ShaderAstVisitor, public ShaderVarVisitor
{
public:
ShaderAstCloner() = default;
@ -69,6 +69,6 @@ namespace Nz
};
}
#include <Nazara/Renderer/ShaderAstCloner.inl>
#include <Nazara/Shader/ShaderAstCloner.inl>
#endif

View File

@ -0,0 +1,12 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Shader/ShaderAstCloner.hpp>
#include <Nazara/Shader/Debug.hpp>
namespace Nz
{
}
#include <Nazara/Shader/DebugOff.hpp>

View File

@ -1,5 +1,5 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Renderer module"
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
@ -8,12 +8,12 @@
#define NAZARA_SHADER_RECURSIVE_VISITOR_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Renderer/Config.hpp>
#include <Nazara/Renderer/ShaderAstVisitor.hpp>
#include <Nazara/Shader/Config.hpp>
#include <Nazara/Shader/ShaderAstVisitor.hpp>
namespace Nz
{
class NAZARA_RENDERER_API ShaderAstRecursiveVisitor : public ShaderAstVisitor
class NAZARA_SHADER_API ShaderAstRecursiveVisitor : public ShaderAstVisitor
{
public:
ShaderAstRecursiveVisitor() = default;
@ -37,6 +37,6 @@ namespace Nz
};
}
#include <Nazara/Renderer/ShaderAstRecursiveVisitor.inl>
#include <Nazara/Shader/ShaderAstRecursiveVisitor.inl>
#endif

View File

@ -0,0 +1,12 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Shader/ShaderAstRecursiveVisitor.hpp>
#include <Nazara/Shader/Debug.hpp>
namespace Nz
{
}
#include <Nazara/Shader/DebugOff.hpp>

View File

@ -1,5 +1,5 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Renderer module"
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
@ -10,14 +10,14 @@
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Core/ByteArray.hpp>
#include <Nazara/Core/ByteStream.hpp>
#include <Nazara/Renderer/Config.hpp>
#include <Nazara/Renderer/ShaderAst.hpp>
#include <Nazara/Renderer/ShaderNodes.hpp>
#include <Nazara/Renderer/ShaderVariables.hpp>
#include <Nazara/Shader/Config.hpp>
#include <Nazara/Shader/ShaderAst.hpp>
#include <Nazara/Shader/ShaderNodes.hpp>
#include <Nazara/Shader/ShaderVariables.hpp>
namespace Nz
{
class NAZARA_RENDERER_API ShaderAstSerializerBase
class NAZARA_SHADER_API ShaderAstSerializerBase
{
public:
ShaderAstSerializerBase() = default;
@ -73,7 +73,7 @@ namespace Nz
template<typename T> void Variable(std::shared_ptr<T>& var);
};
class NAZARA_RENDERER_API ShaderAstSerializer final : public ShaderAstSerializerBase
class NAZARA_SHADER_API ShaderAstSerializer final : public ShaderAstSerializerBase
{
public:
inline ShaderAstSerializer(ByteStream& stream);
@ -104,7 +104,7 @@ namespace Nz
ByteStream& m_stream;
};
class NAZARA_RENDERER_API ShaderAstUnserializer final : public ShaderAstSerializerBase
class NAZARA_SHADER_API ShaderAstUnserializer final : public ShaderAstSerializerBase
{
public:
ShaderAstUnserializer(ByteStream& stream);
@ -134,10 +134,10 @@ namespace Nz
ByteStream& m_stream;
};
NAZARA_RENDERER_API ByteArray SerializeShader(const ShaderAst& shader);
NAZARA_RENDERER_API ShaderAst UnserializeShader(ByteStream& stream);
NAZARA_SHADER_API ByteArray SerializeShader(const ShaderAst& shader);
NAZARA_SHADER_API ShaderAst UnserializeShader(ByteStream& stream);
}
#include <Nazara/Renderer/ShaderAstSerializer.inl>
#include <Nazara/Shader/ShaderAstSerializer.inl>
#endif

View File

@ -1,9 +1,9 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Renderer module"
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Renderer/ShaderAstSerializer.hpp>
#include <Nazara/Renderer/Debug.hpp>
#include <Nazara/Shader/ShaderAstSerializer.hpp>
#include <Nazara/Shader/Debug.hpp>
namespace Nz
{
@ -124,4 +124,4 @@ namespace Nz
}
}
#include <Nazara/Renderer/DebugOff.hpp>
#include <Nazara/Shader/DebugOff.hpp>

View File

@ -1,5 +1,5 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Renderer module"
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
@ -10,14 +10,14 @@
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Core/ByteArray.hpp>
#include <Nazara/Core/ByteStream.hpp>
#include <Nazara/Renderer/Config.hpp>
#include <Nazara/Renderer/ShaderAst.hpp>
#include <Nazara/Renderer/ShaderAstRecursiveVisitor.hpp>
#include <Nazara/Renderer/ShaderVarVisitor.hpp>
#include <Nazara/Shader/Config.hpp>
#include <Nazara/Shader/ShaderAst.hpp>
#include <Nazara/Shader/ShaderAstRecursiveVisitor.hpp>
#include <Nazara/Shader/ShaderVarVisitor.hpp>
namespace Nz
{
class NAZARA_RENDERER_API ShaderAstValidator : public ShaderAstRecursiveVisitor, public ShaderVarVisitor
class NAZARA_SHADER_API ShaderAstValidator : public ShaderAstRecursiveVisitor, public ShaderVarVisitor
{
public:
inline ShaderAstValidator(const ShaderAst& shader);
@ -62,9 +62,9 @@ namespace Nz
Context* m_context;
};
NAZARA_RENDERER_API bool ValidateShader(const ShaderAst& shader, std::string* error = nullptr);
NAZARA_SHADER_API bool ValidateShader(const ShaderAst& shader, std::string* error = nullptr);
}
#include <Nazara/Renderer/ShaderAstValidator.inl>
#include <Nazara/Shader/ShaderAstValidator.inl>
#endif

View File

@ -1,9 +1,9 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Renderer module"
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Renderer/ShaderAstValidator.hpp>
#include <Nazara/Renderer/Debug.hpp>
#include <Nazara/Shader/ShaderAstValidator.hpp>
#include <Nazara/Shader/Debug.hpp>
namespace Nz
{
@ -13,4 +13,4 @@ namespace Nz
}
}
#include <Nazara/Renderer/DebugOff.hpp>
#include <Nazara/Shader/DebugOff.hpp>

View File

@ -1,5 +1,5 @@
// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Engine - Renderer module"
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
@ -8,14 +8,14 @@
#define NAZARA_SHADERVISITOR_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Renderer/Config.hpp>
#include <Nazara/Renderer/ShaderNodes.hpp>
#include <Nazara/Shader/Config.hpp>
#include <Nazara/Shader/ShaderNodes.hpp>
#include <string>
#include <unordered_set>
namespace Nz
{
class NAZARA_RENDERER_API ShaderAstVisitor
class NAZARA_SHADER_API ShaderAstVisitor
{
public:
ShaderAstVisitor() = default;

View File

@ -1,5 +1,5 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Renderer module"
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
@ -8,7 +8,7 @@
#define NAZARA_SHADER_BUILDER_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Renderer/ShaderNodes.hpp>
#include <Nazara/Shader/ShaderNodes.hpp>
#include <memory>
namespace Nz::ShaderBuilder
@ -71,6 +71,6 @@ namespace Nz::ShaderBuilder
template<ShaderNodes::BasicType Type, typename... Args> std::shared_ptr<ShaderNodes::Cast> Cast(Args&&... args);
}
#include <Nazara/Renderer/ShaderBuilder.inl>
#include <Nazara/Shader/ShaderBuilder.inl>
#endif // NAZARA_SHADER_BUILDER_HPP

View File

@ -1,9 +1,9 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Renderer module"
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Renderer/ShaderBuilder.hpp>
#include <Nazara/Renderer/Debug.hpp>
#include <Nazara/Shader/ShaderBuilder.hpp>
#include <Nazara/Shader/Debug.hpp>
namespace Nz::ShaderBuilder
{
@ -49,4 +49,4 @@ namespace Nz::ShaderBuilder
}
}
#include <Nazara/Renderer/DebugOff.hpp>
#include <Nazara/Shader/DebugOff.hpp>

View File

@ -1,5 +1,5 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Renderer module"
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once

View File

@ -1,5 +1,5 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Renderer module"
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
@ -8,7 +8,7 @@
#define NAZARA_SHADER_EXPRESSIONTYPE_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Renderer/ShaderEnums.hpp>
#include <Nazara/Shader/ShaderEnums.hpp>
#include <string>
#include <variant>

View File

@ -1,5 +1,5 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Renderer module"
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
@ -11,10 +11,10 @@
#include <Nazara/Math/Vector2.hpp>
#include <Nazara/Math/Vector3.hpp>
#include <Nazara/Math/Vector4.hpp>
#include <Nazara/Renderer/Config.hpp>
#include <Nazara/Renderer/ShaderEnums.hpp>
#include <Nazara/Renderer/ShaderExpressionType.hpp>
#include <Nazara/Renderer/ShaderVariables.hpp>
#include <Nazara/Shader/Config.hpp>
#include <Nazara/Shader/ShaderEnums.hpp>
#include <Nazara/Shader/ShaderExpressionType.hpp>
#include <Nazara/Shader/ShaderVariables.hpp>
#include <array>
#include <optional>
#include <string>
@ -29,7 +29,7 @@ namespace Nz
using NodePtr = std::shared_ptr<Node>;
class NAZARA_RENDERER_API Node
class NAZARA_SHADER_API Node
{
public:
virtual ~Node();
@ -54,7 +54,7 @@ namespace Nz
using ExpressionPtr = std::shared_ptr<Expression>;
class NAZARA_RENDERER_API Expression : public Node
class NAZARA_SHADER_API Expression : public Node
{
public:
inline Expression(NodeType type);
@ -67,13 +67,13 @@ namespace Nz
using StatementPtr = std::shared_ptr<Statement>;
class NAZARA_RENDERER_API Statement : public Node
class NAZARA_SHADER_API Statement : public Node
{
public:
inline Statement(NodeType type);
};
struct NAZARA_RENDERER_API ExpressionStatement : public Statement
struct NAZARA_SHADER_API ExpressionStatement : public Statement
{
inline ExpressionStatement();
@ -86,7 +86,7 @@ namespace Nz
//////////////////////////////////////////////////////////////////////////
struct NAZARA_RENDERER_API ConditionalStatement : public Statement
struct NAZARA_SHADER_API ConditionalStatement : public Statement
{
inline ConditionalStatement();
@ -98,7 +98,7 @@ namespace Nz
static inline std::shared_ptr<ConditionalStatement> Build(std::string condition, StatementPtr statementPtr);
};
struct NAZARA_RENDERER_API StatementBlock : public Statement
struct NAZARA_SHADER_API StatementBlock : public Statement
{
inline StatementBlock();
@ -110,7 +110,7 @@ namespace Nz
template<typename... Args> static std::shared_ptr<StatementBlock> Build(Args&&... args);
};
struct NAZARA_RENDERER_API DeclareVariable : public Statement
struct NAZARA_SHADER_API DeclareVariable : public Statement
{
inline DeclareVariable();
@ -122,7 +122,7 @@ namespace Nz
static inline std::shared_ptr<DeclareVariable> Build(VariablePtr variable, ExpressionPtr expression = nullptr);
};
struct NAZARA_RENDERER_API Identifier : public Expression
struct NAZARA_SHADER_API Identifier : public Expression
{
inline Identifier();
@ -135,7 +135,7 @@ namespace Nz
static inline std::shared_ptr<Identifier> Build(VariablePtr variable);
};
struct NAZARA_RENDERER_API AccessMember : public Expression
struct NAZARA_SHADER_API AccessMember : public Expression
{
inline AccessMember();
@ -152,7 +152,7 @@ namespace Nz
//////////////////////////////////////////////////////////////////////////
struct NAZARA_RENDERER_API AssignOp : public Expression
struct NAZARA_SHADER_API AssignOp : public Expression
{
inline AssignOp();
@ -166,7 +166,7 @@ namespace Nz
static inline std::shared_ptr<AssignOp> Build(AssignType op, ExpressionPtr left, ExpressionPtr right);
};
struct NAZARA_RENDERER_API BinaryOp : public Expression
struct NAZARA_SHADER_API BinaryOp : public Expression
{
inline BinaryOp();
@ -180,7 +180,7 @@ namespace Nz
static inline std::shared_ptr<BinaryOp> Build(BinaryType op, ExpressionPtr left, ExpressionPtr right);
};
struct NAZARA_RENDERER_API Branch : public Statement
struct NAZARA_SHADER_API Branch : public Statement
{
struct ConditionalStatement;
@ -201,7 +201,7 @@ namespace Nz
static inline std::shared_ptr<Branch> Build(std::vector<ConditionalStatement> statements, StatementPtr elseStatement = nullptr);
};
struct NAZARA_RENDERER_API Cast : public Expression
struct NAZARA_SHADER_API Cast : public Expression
{
inline Cast();
@ -215,7 +215,7 @@ namespace Nz
static inline std::shared_ptr<Cast> Build(BasicType castTo, ExpressionPtr* expressions, std::size_t expressionCount);
};
struct NAZARA_RENDERER_API Constant : public Expression
struct NAZARA_SHADER_API Constant : public Expression
{
inline Constant();
@ -239,7 +239,7 @@ namespace Nz
template<typename T> static std::shared_ptr<Constant> Build(const T& value);
};
struct NAZARA_RENDERER_API SwizzleOp : public Expression
struct NAZARA_SHADER_API SwizzleOp : public Expression
{
inline SwizzleOp();
@ -257,7 +257,7 @@ namespace Nz
//////////////////////////////////////////////////////////////////////////
struct NAZARA_RENDERER_API Sample2D : public Expression
struct NAZARA_SHADER_API Sample2D : public Expression
{
inline Sample2D();
@ -272,7 +272,7 @@ namespace Nz
//////////////////////////////////////////////////////////////////////////
struct NAZARA_RENDERER_API IntrinsicCall : public Expression
struct NAZARA_SHADER_API IntrinsicCall : public Expression
{
inline IntrinsicCall();
@ -287,6 +287,6 @@ namespace Nz
}
}
#include <Nazara/Renderer/ShaderNodes.inl>
#include <Nazara/Shader/ShaderNodes.inl>
#endif

View File

@ -1,9 +1,9 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Renderer module"
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Renderer/ShaderNodes.hpp>
#include <Nazara/Renderer/Debug.hpp>
#include <Nazara/Shader/ShaderNodes.hpp>
#include <Nazara/Shader/Debug.hpp>
namespace Nz::ShaderNodes
{
@ -335,4 +335,4 @@ namespace Nz::ShaderNodes
}
}
#include <Nazara/Renderer/DebugOff.hpp>
#include <Nazara/Shader/DebugOff.hpp>

View File

@ -1,5 +1,5 @@
// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Engine - Renderer module"
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
@ -8,12 +8,12 @@
#define NAZARA_SHADERVARVISITOR_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Renderer/Config.hpp>
#include <Nazara/Renderer/ShaderVariables.hpp>
#include <Nazara/Shader/Config.hpp>
#include <Nazara/Shader/ShaderVariables.hpp>
namespace Nz
{
class NAZARA_RENDERER_API ShaderVarVisitor
class NAZARA_SHADER_API ShaderVarVisitor
{
public:
ShaderVarVisitor() = default;

View File

@ -1,5 +1,5 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Renderer module"
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
@ -11,8 +11,8 @@
#include <Nazara/Math/Vector2.hpp>
#include <Nazara/Math/Vector3.hpp>
#include <Nazara/Math/Vector4.hpp>
#include <Nazara/Renderer/Config.hpp>
#include <Nazara/Renderer/ShaderExpressionType.hpp>
#include <Nazara/Shader/Config.hpp>
#include <Nazara/Shader/ShaderExpressionType.hpp>
#include <array>
#include <memory>
#include <optional>
@ -28,7 +28,7 @@ namespace Nz
using VariablePtr = std::shared_ptr<Variable>;
struct NAZARA_RENDERER_API Variable : std::enable_shared_from_this<Variable>
struct NAZARA_SHADER_API Variable : std::enable_shared_from_this<Variable>
{
virtual ~Variable();
@ -42,7 +42,7 @@ namespace Nz
using BuiltinVariablePtr = std::shared_ptr<BuiltinVariable>;
struct NAZARA_RENDERER_API BuiltinVariable : public Variable
struct NAZARA_SHADER_API BuiltinVariable : public Variable
{
BuiltinEntry entry;
@ -56,7 +56,7 @@ namespace Nz
using NamedVariablePtr = std::shared_ptr<NamedVariable>;
struct NAZARA_RENDERER_API NamedVariable : public Variable
struct NAZARA_SHADER_API NamedVariable : public Variable
{
std::string name;
};
@ -65,7 +65,7 @@ namespace Nz
using InputVariablePtr = std::shared_ptr<InputVariable>;
struct NAZARA_RENDERER_API InputVariable : public NamedVariable
struct NAZARA_SHADER_API InputVariable : public NamedVariable
{
VariableType GetType() const override;
void Visit(ShaderVarVisitor& visitor) override;
@ -77,7 +77,7 @@ namespace Nz
using LocalVariablePtr = std::shared_ptr<LocalVariable>;
struct NAZARA_RENDERER_API LocalVariable : public NamedVariable
struct NAZARA_SHADER_API LocalVariable : public NamedVariable
{
VariableType GetType() const override;
void Visit(ShaderVarVisitor& visitor) override;
@ -89,7 +89,7 @@ namespace Nz
using OutputVariablePtr = std::shared_ptr<OutputVariable>;
struct NAZARA_RENDERER_API OutputVariable : public NamedVariable
struct NAZARA_SHADER_API OutputVariable : public NamedVariable
{
VariableType GetType() const override;
void Visit(ShaderVarVisitor& visitor) override;
@ -101,7 +101,7 @@ namespace Nz
using ParameterVariablePtr = std::shared_ptr<ParameterVariable>;
struct NAZARA_RENDERER_API ParameterVariable : public NamedVariable
struct NAZARA_SHADER_API ParameterVariable : public NamedVariable
{
VariableType GetType() const override;
void Visit(ShaderVarVisitor& visitor) override;
@ -113,7 +113,7 @@ namespace Nz
using UniformVariablePtr = std::shared_ptr<UniformVariable>;
struct NAZARA_RENDERER_API UniformVariable : public NamedVariable
struct NAZARA_SHADER_API UniformVariable : public NamedVariable
{
VariableType GetType() const override;
void Visit(ShaderVarVisitor& visitor) override;
@ -123,6 +123,6 @@ namespace Nz
}
}
#include <Nazara/Renderer/ShaderVariables.inl>
#include <Nazara/Shader/ShaderVariables.inl>
#endif

View File

@ -1,9 +1,9 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Renderer module"
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Renderer/ShaderVariables.hpp>
#include <Nazara/Renderer/Debug.hpp>
#include <Nazara/Shader/ShaderVariables.hpp>
#include <Nazara/Shader/Debug.hpp>
namespace Nz::ShaderNodes
{
@ -62,4 +62,4 @@ namespace Nz::ShaderNodes
}
}
#include <Nazara/Renderer/DebugOff.hpp>
#include <Nazara/Shader/DebugOff.hpp>

View File

@ -1,5 +1,5 @@
// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Engine - Renderer module"
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
@ -8,14 +8,14 @@
#define NAZARA_SHADERWRITER_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Renderer/Config.hpp>
#include <Nazara/Shader/Config.hpp>
#include <string>
namespace Nz
{
class ShaderAst;
class NAZARA_RENDERER_API ShaderWriter
class NAZARA_SHADER_API ShaderWriter
{
public:
ShaderWriter() = default;

View File

@ -1,5 +1,5 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Renderer module"
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
@ -8,11 +8,11 @@
#define NAZARA_SPIRVWRITER_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Renderer/Config.hpp>
#include <Nazara/Renderer/ShaderAst.hpp>
#include <Nazara/Renderer/ShaderAstVisitor.hpp>
#include <Nazara/Renderer/ShaderVarVisitor.hpp>
#include <Nazara/Renderer/ShaderWriter.hpp>
#include <Nazara/Shader/Config.hpp>
#include <Nazara/Shader/ShaderAst.hpp>
#include <Nazara/Shader/ShaderAstVisitor.hpp>
#include <Nazara/Shader/ShaderVarVisitor.hpp>
#include <Nazara/Shader/ShaderWriter.hpp>
#include <Nazara/Utility/FieldOffsets.hpp>
#include <string>
#include <string_view>
@ -20,7 +20,7 @@
namespace Nz
{
class NAZARA_RENDERER_API SpirvWriter : public ShaderAstVisitor, public ShaderVarVisitor
class NAZARA_SHADER_API SpirvWriter : public ShaderAstVisitor, public ShaderVarVisitor
{
public:
struct Environment;
@ -127,6 +127,6 @@ namespace Nz
};
}
#include <Nazara/Renderer/SpirvWriter.inl>
#include <Nazara/Shader/SpirvWriter.inl>
#endif

View File

@ -1,11 +1,11 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Renderer module"
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Renderer/SpirvWriter.hpp>
#include <Nazara/Shader/SpirvWriter.hpp>
#include <cassert>
#include <type_traits>
#include <Nazara/Renderer/Debug.hpp>
#include <Nazara/Shader/Debug.hpp>
namespace Nz
{
@ -108,4 +108,4 @@ namespace Nz
}
}
#include <Nazara/Renderer/DebugOff.hpp>
#include <Nazara/Shader/DebugOff.hpp>

View File

@ -309,6 +309,24 @@ namespace Nz
SamplerWrap_Max = SamplerWrap_Repeat
};
enum class ShaderStageType
{
Fragment,
Vertex,
Max = Vertex
};
template<>
struct EnumAsFlags<ShaderStageType>
{
static constexpr ShaderStageType max = ShaderStageType::Max;
};
using ShaderStageTypeFlags = Flags<ShaderStageType>;
constexpr ShaderStageTypeFlags ShaderStageType_All = ShaderStageType::Fragment | ShaderStageType::Vertex;
enum StructFieldType
{
StructFieldType_Bool1,

View File

@ -1,11 +0,0 @@
// Copyright (C) 2015 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 <Nazara/Renderer/ShaderWriter.hpp>
#include <Nazara/Renderer/Debug.hpp>
namespace Nz
{
ShaderWriter::~ShaderWriter() = default;
}

View File

@ -0,0 +1,31 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Shader/Config.hpp>
#if NAZARA_SHADER_MANAGE_MEMORY
#include <Nazara/Core/MemoryManager.hpp>
#include <new> // Nécessaire ?
void* operator new(std::size_t size)
{
return Nz::MemoryManager::Allocate(size, false);
}
void* operator new[](std::size_t size)
{
return Nz::MemoryManager::Allocate(size, true);
}
void operator delete(void* pointer) noexcept
{
Nz::MemoryManager::Free(pointer, false);
}
void operator delete[](void* pointer) noexcept
{
Nz::MemoryManager::Free(pointer, true);
}
#endif // NAZARA_SHADER_MANAGE_MEMORY

View File

@ -1,15 +1,15 @@
// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Engine - Renderer module"
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Renderer/GlslWriter.hpp>
#include <Nazara/Shader/GlslWriter.hpp>
#include <Nazara/Core/Algorithm.hpp>
#include <Nazara/Core/CallOnExit.hpp>
#include <Nazara/Renderer/ShaderBuilder.hpp>
#include <Nazara/Renderer/ShaderAstCloner.hpp>
#include <Nazara/Renderer/ShaderAstValidator.hpp>
#include <Nazara/Shader/ShaderBuilder.hpp>
#include <Nazara/Shader/ShaderAstCloner.hpp>
#include <Nazara/Shader/ShaderAstValidator.hpp>
#include <stdexcept>
#include <Nazara/Renderer/Debug.hpp>
#include <Nazara/Shader/Debug.hpp>
namespace Nz
{

View File

@ -0,0 +1,70 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Shader/Shader.hpp>
#include <Nazara/Core/CallOnExit.hpp>
#include <Nazara/Core/Core.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Core/Log.hpp>
#include <Nazara/Shader/Config.hpp>
#include <Nazara/Shader/Debug.hpp>
namespace Nz
{
bool Shader::Initialize()
{
if (s_moduleReferenceCounter > 0)
{
s_moduleReferenceCounter++;
return true; // Already initialized
}
// Initialize module dependencies
if (!Core::Initialize())
{
NazaraError("Failed to initialize shader module");
return false;
}
s_moduleReferenceCounter++;
CallOnExit onExit(Shader::Uninitialize);
// Initialize module here
onExit.Reset();
NazaraNotice("Initialized: Shader module");
return true;
}
bool Shader::IsInitialized()
{
return s_moduleReferenceCounter != 0;
}
void Shader::Uninitialize()
{
if (s_moduleReferenceCounter != 1)
{
// Either the module is not initialized, either it was initialized multiple times
if (s_moduleReferenceCounter > 1)
s_moduleReferenceCounter--;
return;
}
s_moduleReferenceCounter = 0;
// Uninitialize module here
NazaraNotice("Uninitialized: Shader module");
// Free module dependencies
Core::Uninitialize();
}
unsigned int Shader::s_moduleReferenceCounter = 0;
}

View File

@ -1,9 +1,9 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Renderer module"
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Renderer/ShaderAst.hpp>
#include <Nazara/Renderer/Debug.hpp>
#include <Nazara/Shader/ShaderAst.hpp>
#include <Nazara/Shader/Debug.hpp>
namespace Nz
{

View File

@ -1,10 +1,10 @@
// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Engine - Renderer module"
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Renderer/ShaderAstCloner.hpp>
#include <Nazara/Shader/ShaderAstCloner.hpp>
#include <stdexcept>
#include <Nazara/Renderer/Debug.hpp>
#include <Nazara/Shader/Debug.hpp>
namespace Nz
{

View File

@ -1,9 +1,9 @@
// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Engine - Renderer module"
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Renderer/ShaderAstRecursiveVisitor.hpp>
#include <Nazara/Renderer/Debug.hpp>
#include <Nazara/Shader/ShaderAstRecursiveVisitor.hpp>
#include <Nazara/Shader/Debug.hpp>
namespace Nz
{

View File

@ -1,11 +1,11 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Renderer module"
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Renderer/ShaderAstSerializer.hpp>
#include <Nazara/Renderer/ShaderVarVisitor.hpp>
#include <Nazara/Renderer/ShaderAstVisitor.hpp>
#include <Nazara/Renderer/Debug.hpp>
#include <Nazara/Shader/ShaderAstSerializer.hpp>
#include <Nazara/Shader/ShaderVarVisitor.hpp>
#include <Nazara/Shader/ShaderAstVisitor.hpp>
#include <Nazara/Shader/Debug.hpp>
namespace Nz
{

View File

@ -1,13 +1,13 @@
// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Engine - Renderer module"
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Renderer/ShaderAstValidator.hpp>
#include <Nazara/Shader/ShaderAstValidator.hpp>
#include <Nazara/Core/CallOnExit.hpp>
#include <Nazara/Renderer/ShaderAst.hpp>
#include <Nazara/Renderer/ShaderVariables.hpp>
#include <Nazara/Shader/ShaderAst.hpp>
#include <Nazara/Shader/ShaderVariables.hpp>
#include <vector>
#include <Nazara/Renderer/Debug.hpp>
#include <Nazara/Shader/Debug.hpp>
namespace Nz
{

View File

@ -1,9 +1,9 @@
// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Engine - Renderer module"
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Renderer/ShaderAstVisitor.hpp>
#include <Nazara/Renderer/Debug.hpp>
#include <Nazara/Shader/ShaderAstVisitor.hpp>
#include <Nazara/Shader/Debug.hpp>
namespace Nz
{

View File

@ -1,13 +1,13 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Renderer module"
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Renderer/ShaderNodes.hpp>
#include <Nazara/Shader/ShaderNodes.hpp>
#include <Nazara/Core/Algorithm.hpp>
#include <Nazara/Renderer/ShaderAstSerializer.hpp>
#include <Nazara/Renderer/ShaderAstVisitor.hpp>
#include <Nazara/Renderer/ShaderWriter.hpp>
#include <Nazara/Renderer/Debug.hpp>
#include <Nazara/Shader/ShaderAstSerializer.hpp>
#include <Nazara/Shader/ShaderAstVisitor.hpp>
#include <Nazara/Shader/ShaderWriter.hpp>
#include <Nazara/Shader/Debug.hpp>
namespace Nz::ShaderNodes
{
@ -61,7 +61,7 @@ namespace Nz::ShaderNodes
ExpressionCategory AccessMember::GetExpressionCategory() const
{
return ExpressionCategory::LValue;
return structExpr->GetExpressionCategory();
}
ShaderExpressionType AccessMember::GetExpressionType() const
@ -200,7 +200,7 @@ namespace Nz::ShaderNodes
ExpressionCategory SwizzleOp::GetExpressionCategory() const
{
return ExpressionCategory::LValue;
return expression->GetExpressionCategory();
}
ShaderExpressionType SwizzleOp::GetExpressionType() const

View File

@ -1,9 +1,9 @@
// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Engine - Renderer module"
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Renderer/ShaderVarVisitor.hpp>
#include <Nazara/Renderer/Debug.hpp>
#include <Nazara/Shader/ShaderVarVisitor.hpp>
#include <Nazara/Shader/Debug.hpp>
namespace Nz
{

View File

@ -1,10 +1,10 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Renderer module"
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Renderer/ShaderVariables.hpp>
#include <Nazara/Renderer/ShaderVarVisitor.hpp>
#include <Nazara/Renderer/Debug.hpp>
#include <Nazara/Shader/ShaderVariables.hpp>
#include <Nazara/Shader/ShaderVarVisitor.hpp>
#include <Nazara/Shader/Debug.hpp>
namespace Nz::ShaderNodes
{

View File

@ -0,0 +1,11 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Shader/ShaderWriter.hpp>
#include <Nazara/Shader/Debug.hpp>
namespace Nz
{
ShaderWriter::~ShaderWriter() = default;
}

View File

@ -1,13 +1,13 @@
// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Engine - Renderer module"
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Shader generator"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Renderer/SpirvWriter.hpp>
#include <Nazara/Shader/SpirvWriter.hpp>
#include <Nazara/Core/CallOnExit.hpp>
#include <Nazara/Core/Endianness.hpp>
#include <Nazara/Core/StackVector.hpp>
#include <Nazara/Renderer/ShaderAstCloner.hpp>
#include <Nazara/Renderer/ShaderAstValidator.hpp>
#include <Nazara/Shader/ShaderAstCloner.hpp>
#include <Nazara/Shader/ShaderAstValidator.hpp>
#include <tsl/ordered_map.h>
#include <tsl/ordered_set.h>
#include <SpirV/spirv.h>
@ -16,7 +16,7 @@
#include <stdexcept>
#include <type_traits>
#include <vector>
#include <Nazara/Renderer/Debug.hpp>
#include <Nazara/Shader/Debug.hpp>
namespace Nz
{

View File

@ -5,7 +5,7 @@
#include <ShaderNode/DataTypes/FloatData.hpp>
#include <ShaderNode/DataTypes/Matrix4Data.hpp>
#include <ShaderNode/DataTypes/VecData.hpp>
#include <Nazara/Renderer/ShaderBuilder.hpp>
#include <Nazara/Shader/ShaderBuilder.hpp>
#include <QtWidgets/QComboBox>
#include <QtWidgets/QFormLayout>
#include <iostream>

View File

@ -1,5 +1,5 @@
#include <ShaderNode/DataModels/Cast.hpp>
#include <Nazara/Renderer/ShaderBuilder.hpp>
#include <Nazara/Shader/ShaderBuilder.hpp>
#include <QtWidgets/QDoubleSpinBox>
#include <QtWidgets/QFormLayout>
#include <stdexcept>

View File

@ -1,6 +1,6 @@
#include <ShaderNode/DataModels/FloatValue.hpp>
#include <ShaderNode/DataTypes/FloatData.hpp>
#include <Nazara/Renderer/ShaderBuilder.hpp>
#include <Nazara/Shader/ShaderBuilder.hpp>
#include <cassert>
FloatValue::FloatValue(ShaderGraph& graph) :

View File

@ -4,7 +4,7 @@
#include <ShaderNode/DataTypes/FloatData.hpp>
#include <ShaderNode/DataTypes/Matrix4Data.hpp>
#include <ShaderNode/DataTypes/VecData.hpp>
#include <Nazara/Renderer/ShaderBuilder.hpp>
#include <Nazara/Shader/ShaderBuilder.hpp>
#include <QtWidgets/QFormLayout>
InputValue::InputValue(ShaderGraph& graph) :

View File

@ -1,5 +1,5 @@
#include <ShaderNode/DataModels/Mat4BinOp.hpp>
#include <Nazara/Renderer/ShaderBuilder.hpp>
#include <Nazara/Shader/ShaderBuilder.hpp>
template<Nz::ShaderNodes::BinaryType BinOp>
Mat4BinOp<BinOp>::Mat4BinOp(ShaderGraph& graph) :

View File

@ -1,5 +1,5 @@
#include <ShaderNode/DataModels/Mat4VecMul.hpp>
#include <Nazara/Renderer/ShaderNodes.hpp>
#include <Nazara/Shader/ShaderNodes.hpp>
Mat4VecMul::Mat4VecMul(ShaderGraph& graph) :
ShaderNode(graph)

View File

@ -1,5 +1,5 @@
#include <ShaderNode/DataModels/OutputValue.hpp>
#include <Nazara/Renderer/ShaderBuilder.hpp>
#include <Nazara/Shader/ShaderBuilder.hpp>
#include <ShaderNode/ShaderGraph.hpp>
#include <ShaderNode/DataTypes/BoolData.hpp>
#include <ShaderNode/DataTypes/FloatData.hpp>

View File

@ -1,5 +1,5 @@
#include <ShaderNode/DataModels/PositionOutputValue.hpp>
#include <Nazara/Renderer/ShaderBuilder.hpp>
#include <Nazara/Shader/ShaderBuilder.hpp>
#include <ShaderNode/ShaderGraph.hpp>
#include <ShaderNode/DataTypes/BoolData.hpp>
#include <ShaderNode/DataTypes/FloatData.hpp>

View File

@ -1,6 +1,6 @@
#include <ShaderNode/ShaderGraph.hpp>
#include <ShaderNode/DataModels/SampleTexture.hpp>
#include <Nazara/Renderer/ShaderBuilder.hpp>
#include <Nazara/Shader/ShaderBuilder.hpp>
SampleTexture::SampleTexture(ShaderGraph& graph) :
ShaderNode(graph)

View File

@ -4,7 +4,7 @@
#define NAZARA_SHADERNODES_SHADERNODE_HPP
#include <Nazara/Math/Vector2.hpp>
#include <Nazara/Renderer/ShaderNodes.hpp>
#include <Nazara/Shader/ShaderNodes.hpp>
#include <nodes/NodeDataModel>
#include <QtGui/QPixmap>
#include <optional>

View File

@ -2,7 +2,7 @@
#include <ShaderNode/ShaderGraph.hpp>
#include <ShaderNode/DataTypes/TextureData.hpp>
#include <ShaderNode/DataTypes/VecData.hpp>
#include <Nazara/Renderer/ShaderBuilder.hpp>
#include <Nazara/Shader/ShaderBuilder.hpp>
#include <QtWidgets/QFormLayout>
TextureValue::TextureValue(ShaderGraph& graph) :

View File

@ -1,5 +1,5 @@
#include <ShaderNode/DataModels/VecBinOp.hpp>
#include <Nazara/Renderer/ShaderBuilder.hpp>
#include <Nazara/Shader/ShaderBuilder.hpp>
template<Nz::ShaderNodes::BinaryType BinOp>
VecBinOp<BinOp>::VecBinOp(ShaderGraph& graph) :

View File

@ -1,5 +1,5 @@
#include <ShaderNode/DataModels/VecDot.hpp>
#include <Nazara/Renderer/ShaderNodes.hpp>
#include <Nazara/Shader/ShaderNodes.hpp>
VecDot::VecDot(ShaderGraph& graph) :
ShaderNode(graph)

View File

@ -1,5 +1,5 @@
#include <ShaderNode/DataModels/VecFloatMul.hpp>
#include <Nazara/Renderer/ShaderNodes.hpp>
#include <Nazara/Shader/ShaderNodes.hpp>
VecFloatMul::VecFloatMul(ShaderGraph& graph) :
ShaderNode(graph)

View File

@ -1,6 +1,6 @@
#include <ShaderNode/DataModels/VecValue.hpp>
#include <Nazara/Core/Algorithm.hpp>
#include <Nazara/Renderer/ShaderBuilder.hpp>
#include <Nazara/Shader/ShaderBuilder.hpp>
#include <ShaderNode/DataTypes/VecData.hpp>
#include <QtCore/QJsonArray>
#include <array>

View File

@ -3,7 +3,7 @@
#ifndef NAZARA_SHADERNODES_MATRIXDATA_HPP
#define NAZARA_SHADERNODES_MATRIXDATA_HPP
#include <Nazara/Renderer/ShaderNodes.hpp>
#include <Nazara/Shader/ShaderNodes.hpp>
#include <ShaderNode/Previews/PreviewValues.hpp>
#include <nodes/NodeData>

View File

@ -4,7 +4,7 @@
#define NAZARA_SHADERNODES_TEXTUREDATA_HPP
#include <ShaderNode/Previews/PreviewValues.hpp>
#include <Nazara/Renderer/ShaderNodes.hpp>
#include <Nazara/Shader/ShaderNodes.hpp>
#include <nodes/NodeData>
struct TextureData : public QtNodes::NodeData

View File

@ -3,7 +3,7 @@
#ifndef NAZARA_SHADERNODES_VECDATA_HPP
#define NAZARA_SHADERNODES_VECDATA_HPP
#include <Nazara/Renderer/ShaderNodes.hpp>
#include <Nazara/Shader/ShaderNodes.hpp>
#include <ShaderNode/Previews/PreviewValues.hpp>
#include <nodes/NodeData>

View File

@ -4,8 +4,8 @@
#define NAZARA_SHADERNODES_SHADERGRAPH_HPP
#include <Nazara/Core/Signal.hpp>
#include <Nazara/Renderer/Enums.hpp>
#include <Nazara/Renderer/ShaderNodes.hpp>
#include <Nazara/Utility/Enums.hpp>
#include <Nazara/Shader/ShaderNodes.hpp>
#include <nodes/FlowScene>
#include <ShaderNode/Enums.hpp>
#include <ShaderNode/Previews/PreviewModel.hpp>

View File

@ -1,7 +1,7 @@
#include <ShaderNode/Widgets/MainWindow.hpp>
#include <Nazara/Core/File.hpp>
#include <Nazara/Renderer/GlslWriter.hpp>
#include <Nazara/Renderer/ShaderAstSerializer.hpp>
#include <Nazara/Shader/GlslWriter.hpp>
#include <Nazara/Shader/ShaderAstSerializer.hpp>
#include <ShaderNode/ShaderGraph.hpp>
#include <ShaderNode/Widgets/BufferEditor.hpp>
#include <ShaderNode/Widgets/InputEditor.hpp>