Split engine to packages NazaraUtils and NZSL (#375)

* Move code to NazaraUtils and NZSL packages

* Reorder includes

* Tests: Remove glslang and spirv-tools deps

* Tests: Remove glslang init

* Remove NazaraUtils tests and fix Vector4Test

* Fix Linux compilation

* Update msys2-build.yml

* Fix assimp package

* Update xmake.lua

* Update xmake.lua

* Fix shader compilation on MinGW

* Final fixes

* The final fix 2: the fix strikes back!

* Disable cache on CI

* The return of the fix™️
This commit is contained in:
Jérôme Leclercq
2022-05-25 19:36:10 +02:00
committed by GitHub
parent 3f8f1c4653
commit 03e2801dbe
483 changed files with 1139 additions and 59112 deletions

View File

@@ -8,10 +8,10 @@
#define NAZARA_OPENGLRENDERER_OPENGLCOMMANDPOOL_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Core/Bitset.hpp>
#include <Nazara/OpenGLRenderer/Config.hpp>
#include <Nazara/OpenGLRenderer/OpenGLCommandBuffer.hpp>
#include <Nazara/Renderer/CommandPool.hpp>
#include <Nazara/Utils/Bitset.hpp>
namespace Nz
{

View File

@@ -41,8 +41,8 @@ namespace Nz
std::shared_ptr<RenderPass> InstantiateRenderPass(std::vector<RenderPass::Attachment> attachments, std::vector<RenderPass::SubpassDescription> subpassDescriptions, std::vector<RenderPass::SubpassDependency> subpassDependencies) override;
std::shared_ptr<RenderPipeline> InstantiateRenderPipeline(RenderPipelineInfo pipelineInfo) override;
std::shared_ptr<RenderPipelineLayout> InstantiateRenderPipelineLayout(RenderPipelineLayoutInfo pipelineLayoutInfo) override;
std::shared_ptr<ShaderModule> InstantiateShaderModule(ShaderStageTypeFlags shaderStages, const ShaderAst::Module& shaderModule, const ShaderWriter::States& states) override;
std::shared_ptr<ShaderModule> InstantiateShaderModule(ShaderStageTypeFlags shaderStages, ShaderLanguage lang, const void* source, std::size_t sourceSize, const ShaderWriter::States& states) override;
std::shared_ptr<ShaderModule> InstantiateShaderModule(nzsl::ShaderStageTypeFlags shaderStages, const nzsl::Ast::Module& shaderModule, const nzsl::ShaderWriter::States& states) override;
std::shared_ptr<ShaderModule> InstantiateShaderModule(nzsl::ShaderStageTypeFlags shaderStages, ShaderLanguage lang, const void* source, std::size_t sourceSize, const nzsl::ShaderWriter::States& states) override;
std::shared_ptr<Texture> InstantiateTexture(const TextureInfo& params) override;
std::shared_ptr<TextureSampler> InstantiateTextureSampler(const TextureSamplerInfo& params) override;

View File

@@ -8,10 +8,10 @@
#define NAZARA_OPENGLRENDERER_OPENGLRENDERPIPELINE_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Core/MovablePtr.hpp>
#include <Nazara/OpenGLRenderer/Config.hpp>
#include <Nazara/OpenGLRenderer/Wrapper/Program.hpp>
#include <Nazara/Renderer/RenderPipeline.hpp>
#include <Nazara/Utils/MovablePtr.hpp>
#include <vector>
namespace Nz

View File

@@ -8,13 +8,13 @@
#define NAZARA_OPENGLRENDERER_OPENGLRENDERPIPELINELAYOUT_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Core/Bitset.hpp>
#include <Nazara/OpenGLRenderer/Config.hpp>
#include <Nazara/OpenGLRenderer/OpenGLShaderBinding.hpp>
#include <Nazara/OpenGLRenderer/Wrapper/Context.hpp>
#include <Nazara/OpenGLRenderer/Wrapper/CoreFunctions.hpp>
#include <Nazara/Renderer/RenderPipelineLayout.hpp>
#include <Nazara/Shader/GlslWriter.hpp>
#include <Nazara/Utils/Bitset.hpp>
#include <NZSL/GlslWriter.hpp>
#include <memory>
#include <type_traits>
#include <vector>
@@ -33,7 +33,7 @@ namespace Nz
ShaderBindingPtr AllocateShaderBinding(UInt32 setIndex) override;
inline const GlslWriter::BindingMapping& GetBindingMapping() const;
inline const nzsl::GlslWriter::BindingMapping& GetBindingMapping() const;
inline const RenderPipelineLayoutInfo& GetLayoutInfo() const;
OpenGLRenderPipelineLayout& operator=(const OpenGLRenderPipelineLayout&) = delete;
@@ -79,7 +79,7 @@ namespace Nz
std::size_t m_maxDescriptorCount;
std::vector<DescriptorPool> m_descriptorPools;
GlslWriter::BindingMapping m_bindingMapping;
nzsl::GlslWriter::BindingMapping m_bindingMapping;
RenderPipelineLayoutInfo m_layoutInfo;
};
}

View File

@@ -7,7 +7,7 @@
namespace Nz
{
inline const GlslWriter::BindingMapping& OpenGLRenderPipelineLayout::GetBindingMapping() const
inline const nzsl::GlslWriter::BindingMapping& OpenGLRenderPipelineLayout::GetBindingMapping() const
{
return m_bindingMapping;
}

View File

@@ -13,8 +13,8 @@
#include <Nazara/OpenGLRenderer/Wrapper/Shader.hpp>
#include <Nazara/Renderer/Enums.hpp>
#include <Nazara/Renderer/ShaderModule.hpp>
#include <Nazara/Shader/GlslWriter.hpp>
#include <Nazara/Shader/Ast/Module.hpp>
#include <NZSL/GlslWriter.hpp>
#include <NZSL/Ast/Module.hpp>
#include <vector>
namespace Nz
@@ -22,19 +22,19 @@ namespace Nz
class NAZARA_OPENGLRENDERER_API OpenGLShaderModule : public ShaderModule
{
public:
OpenGLShaderModule(OpenGLDevice& device, ShaderStageTypeFlags shaderStages, const ShaderAst::Module& shaderModule, const ShaderWriter::States& states = {});
OpenGLShaderModule(OpenGLDevice& device, ShaderStageTypeFlags shaderStages, ShaderLanguage lang, const void* source, std::size_t sourceSize, const ShaderWriter::States& states = {});
OpenGLShaderModule(OpenGLDevice& device, nzsl::ShaderStageTypeFlags shaderStages, const nzsl::Ast::Module& shaderModule, const nzsl::ShaderWriter::States& states = {});
OpenGLShaderModule(OpenGLDevice& device, nzsl::ShaderStageTypeFlags shaderStages, ShaderLanguage lang, const void* source, std::size_t sourceSize, const nzsl::ShaderWriter::States& states = {});
OpenGLShaderModule(const OpenGLShaderModule&) = delete;
OpenGLShaderModule(OpenGLShaderModule&&) noexcept = default;
~OpenGLShaderModule() = default;
ShaderStageTypeFlags Attach(GL::Program& program, const GlslWriter::BindingMapping& bindingMapping) const;
nzsl::ShaderStageTypeFlags Attach(GL::Program& program, const nzsl::GlslWriter::BindingMapping& bindingMapping) const;
OpenGLShaderModule& operator=(const OpenGLShaderModule&) = delete;
OpenGLShaderModule& operator=(OpenGLShaderModule&&) noexcept = default;
private:
void Create(OpenGLDevice& device, ShaderStageTypeFlags shaderStages, const ShaderAst::Module& shaderModule, const ShaderWriter::States& states);
void Create(OpenGLDevice& device, nzsl::ShaderStageTypeFlags shaderStages, const nzsl::Ast::Module& shaderModule, const nzsl::ShaderWriter::States& states);
static void CheckCompilationStatus(GL::Shader& shader);
@@ -45,17 +45,17 @@ namespace Nz
struct ShaderStatement
{
ShaderAst::ModulePtr ast;
nzsl::Ast::ModulePtr ast;
};
struct Shader
{
ShaderStageType stage;
nzsl::ShaderStageType stage;
std::variant<GlslShader, ShaderStatement> shader;
};
OpenGLDevice& m_device;
ShaderWriter::States m_states;
nzsl::ShaderWriter::States m_states;
std::vector<Shader> m_shaders;
};
}

View File

@@ -8,9 +8,9 @@
#define NAZARA_OPENGLRENDERER_OPENGLUPLOADPOOL_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Core/MovablePtr.hpp>
#include <Nazara/OpenGLRenderer/Config.hpp>
#include <Nazara/Renderer/UploadPool.hpp>
#include <Nazara/Utils/MovablePtr.hpp>
#include <array>
#include <memory>
#include <vector>

View File

@@ -10,8 +10,8 @@
#include <Nazara/Prerequisites.hpp>
#include <Nazara/OpenGLRenderer/Wrapper/Context.hpp>
#include <Nazara/Renderer/Enums.hpp>
#include <Nazara/Shader/Enums.hpp>
#include <Nazara/Utility/Enums.hpp>
#include <NZSL/Enums.hpp>
#include <optional>
#include <string>
@@ -40,7 +40,7 @@ namespace Nz
inline GLenum ToOpenGL(SamplerFilter filter);
inline GLenum ToOpenGL(SamplerFilter minFilter, SamplerMipmapMode mipmapFilter);
inline GLenum ToOpenGL(SamplerWrap wrapMode);
inline GLenum ToOpenGL(ShaderStageType stageType);
inline GLenum ToOpenGL(nzsl::ShaderStageType stageType);
inline GLenum ToOpenGL(StencilOperation stencilOp);
inline GLenum ToOpenGL(GL::BufferTarget bufferTarget);
inline GLenum ToOpenGL(GL::TextureTarget bufferTarget);

View File

@@ -225,15 +225,15 @@ namespace Nz
return {};
}
inline GLenum ToOpenGL(ShaderStageType stageType)
inline GLenum ToOpenGL(nzsl::ShaderStageType stageType)
{
switch (stageType)
{
case ShaderStageType::Fragment: return GL_FRAGMENT_SHADER;
case ShaderStageType::Vertex: return GL_VERTEX_SHADER;
case nzsl::ShaderStageType::Fragment: return GL_FRAGMENT_SHADER;
case nzsl::ShaderStageType::Vertex: return GL_VERTEX_SHADER;
}
NazaraError("Unhandled ShaderStageType 0x" + NumberToString(UnderlyingCast(stageType), 16));
NazaraError("Unhandled nzsl::ShaderStageType 0x" + NumberToString(UnderlyingCast(stageType), 16));
return {};
}

View File

@@ -8,9 +8,9 @@
#define NAZARA_OPENGLRENDERER_WRAPPER_BUFFER_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Core/MovableValue.hpp>
#include <Nazara/OpenGLRenderer/OpenGLDevice.hpp>
#include <Nazara/OpenGLRenderer/Wrapper/DeviceObject.hpp>
#include <Nazara/Utils/MovableValue.hpp>
namespace Nz::GL
{

View File

@@ -8,8 +8,8 @@
#define NAZARA_OPENGLRENDERER_WRAPPER_CONTEXTOBJECT_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Core/MovableValue.hpp>
#include <Nazara/OpenGLRenderer/Wrapper/Context.hpp>
#include <Nazara/Utils/MovableValue.hpp>
#include <string>
namespace Nz::GL

View File

@@ -8,9 +8,9 @@
#define NAZARA_OPENGLRENDERER_WRAPPER_DEVICEOBJECT_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Core/MovablePtr.hpp>
#include <Nazara/Core/MovableValue.hpp>
#include <Nazara/OpenGLRenderer/Wrapper/Context.hpp>
#include <Nazara/Utils/MovablePtr.hpp>
#include <Nazara/Utils/MovableValue.hpp>
#include <string>
namespace Nz::GL

View File

@@ -8,9 +8,9 @@
#define NAZARA_OPENGLRENDERER_WRAPPER_PROGRAM_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Core/MovableValue.hpp>
#include <Nazara/OpenGLRenderer/OpenGLDevice.hpp>
#include <Nazara/OpenGLRenderer/Wrapper/DeviceObject.hpp>
#include <Nazara/Utils/MovableValue.hpp>
namespace Nz::GL
{

View File

@@ -8,9 +8,9 @@
#define NAZARA_OPENGLRENDERER_WRAPPER_SAMPLER_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Core/MovableValue.hpp>
#include <Nazara/OpenGLRenderer/OpenGLDevice.hpp>
#include <Nazara/OpenGLRenderer/Wrapper/DeviceObject.hpp>
#include <Nazara/Utils/MovableValue.hpp>
namespace Nz::GL
{

View File

@@ -8,9 +8,9 @@
#define NAZARA_OPENGLRENDERER_WRAPPER_SHADER_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Core/MovableValue.hpp>
#include <Nazara/OpenGLRenderer/OpenGLDevice.hpp>
#include <Nazara/OpenGLRenderer/Wrapper/DeviceObject.hpp>
#include <Nazara/Utils/MovableValue.hpp>
namespace Nz::GL
{

View File

@@ -8,9 +8,9 @@
#define NAZARA_OPENGLRENDERER_WRAPPER_TEXTURE_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Core/MovableValue.hpp>
#include <Nazara/OpenGLRenderer/OpenGLDevice.hpp>
#include <Nazara/OpenGLRenderer/Wrapper/DeviceObject.hpp>
#include <Nazara/Utils/MovableValue.hpp>
namespace Nz::GL
{