Move FieldOffsets class to Shader module and remove Utility dependency

This commit is contained in:
SirLynix
2022-04-04 19:22:18 +02:00
parent 998bcde2e2
commit 68d2dfcae6
21 changed files with 117 additions and 93 deletions

View File

@@ -70,6 +70,20 @@ namespace Nz
constexpr std::size_t ErrorTypeCount = static_cast<std::size_t>(ErrorType::Max) + 1;
enum class ImageType
{
E1D,
E1D_Array,
E2D,
E2D_Array,
E3D,
Cubemap,
Max = Cubemap
};
constexpr std::size_t ImageTypeCount = static_cast<std::size_t>(ImageType::Max) + 1;
enum class HashType
{
CRC32,

View File

@@ -10,6 +10,7 @@
#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 <optional>
#include <string>

View File

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

View File

@@ -30,6 +30,8 @@
#define NAZARA_GLOBAL_SHADER_HPP
#include <Nazara/Shader/Config.hpp>
#include <Nazara/Shader/Enums.hpp>
#include <Nazara/Shader/FieldOffsets.hpp>
#include <Nazara/Shader/FilesystemModuleResolver.hpp>
#include <Nazara/Shader/GlslWriter.hpp>
#include <Nazara/Shader/LangWriter.hpp>

View File

@@ -8,10 +8,11 @@
#define NAZARA_SHADER_AST_EXPRESSIONTYPE_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Core/Enums.hpp>
#include <Nazara/Shader/Enums.hpp>
#include <Nazara/Shader/ShaderLangSourceLocation.hpp>
#include <Nazara/Shader/Ast/Enums.hpp>
#include <Nazara/Shader/Ast/ExpressionValue.hpp>
#include <Nazara/Utility/Enums.hpp>
#include <optional>
#include <string>
#include <variant>

View File

@@ -0,0 +1,70 @@
// Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
// This file is part of the "Nazara Engine - Shader module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_SHADER_ENUMS_HPP
#define NAZARA_SHADER_ENUMS_HPP
#include <Nazara/Core/Flags.hpp>
namespace Nz
{
enum class ShaderStageType
{
Fragment,
Vertex,
Max = Vertex
};
constexpr std::size_t ShaderStageTypeCount = static_cast<std::size_t>(ShaderStageType::Max) + 1;
template<>
struct EnumAsFlags<ShaderStageType>
{
static constexpr ShaderStageType max = ShaderStageType::Max;
};
using ShaderStageTypeFlags = Flags<ShaderStageType>;
constexpr ShaderStageTypeFlags ShaderStageType_All = ShaderStageType::Fragment | ShaderStageType::Vertex;
enum class StructFieldType
{
Bool1,
Bool2,
Bool3,
Bool4,
Float1,
Float2,
Float3,
Float4,
Double1,
Double2,
Double3,
Double4,
Int1,
Int2,
Int3,
Int4,
UInt1,
UInt2,
UInt3,
UInt4,
Max = UInt4
};
enum class StructLayout
{
Packed,
Std140,
Max = Std140
};
}
#endif // NAZARA_SHADER_ENUMS_HPP

View File

@@ -1,18 +1,20 @@
// Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
// This file is part of the "Nazara Engine - Utility module"
// This file is part of the "Nazara Engine - Shader module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_UTILITY_FIELDOFFSETS_HPP
#define NAZARA_UTILITY_FIELDOFFSETS_HPP
#ifndef NAZARA_SHADER_FIELDOFFSETS_HPP
#define NAZARA_SHADER_FIELDOFFSETS_HPP
#include <Nazara/Utility/Config.hpp>
#include <Nazara/Utility/Enums.hpp>
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Shader/Config.hpp>
#include <Nazara/Shader/Enums.hpp>
#include <cstddef>
namespace Nz
{
class NAZARA_UTILITY_API FieldOffsets
class NAZARA_SHADER_API FieldOffsets
{
public:
inline FieldOffsets(StructLayout layout);
@@ -47,6 +49,6 @@ namespace Nz
};
}
#include <Nazara/Utility/FieldOffsets.inl>
#include <Nazara/Shader/FieldOffsets.inl>
#endif // NAZARA_UTILITY_FIELDOFFSETS_HPP
#endif // NAZARA_SHADER_FIELDOFFSETS_HPP

View File

@@ -1,12 +1,12 @@
// Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
// This file is part of the "Nazara Engine - Utility module"
// This file is part of the "Nazara Engine - Shader module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Utility/FieldOffsets.hpp>
#include <Nazara/Shader/FieldOffsets.hpp>
#include <Nazara/Core/Algorithm.hpp>
#include <cassert>
#include <memory>
#include <Nazara/Utility/Debug.hpp>
#include <Nazara/Shader/Debug.hpp>
namespace Nz
{
@@ -171,4 +171,4 @@ namespace Nz
}
}
#include <Nazara/Utility/DebugOff.hpp>
#include <Nazara/Shader/DebugOff.hpp>

View File

@@ -39,7 +39,6 @@
#include <Nazara/Utility/Config.hpp>
#include <Nazara/Utility/CubemapParams.hpp>
#include <Nazara/Utility/Enums.hpp>
#include <Nazara/Utility/FieldOffsets.hpp>
#include <Nazara/Utility/Font.hpp>
#include <Nazara/Utility/FontData.hpp>
#include <Nazara/Utility/FontGlyph.hpp>

View File

@@ -166,20 +166,6 @@ namespace Nz
Max = CounterClockwise
};
enum class ImageType
{
E1D,
E1D_Array,
E2D,
E2D_Array,
E3D,
Cubemap,
Max = Cubemap
};
constexpr std::size_t ImageTypeCount = static_cast<std::size_t>(ImageType::Max) + 1;
enum class IndexType
{
U8,
@@ -351,60 +337,6 @@ namespace Nz
Max = Repeat
};
enum class ShaderStageType
{
Fragment,
Vertex,
Max = Vertex
};
constexpr std::size_t ShaderStageTypeCount = static_cast<std::size_t>(ShaderStageType::Max) + 1;
template<>
struct EnumAsFlags<ShaderStageType>
{
static constexpr ShaderStageType max = ShaderStageType::Max;
};
using ShaderStageTypeFlags = Flags<ShaderStageType>;
constexpr ShaderStageTypeFlags ShaderStageType_All = ShaderStageType::Fragment | ShaderStageType::Vertex;
enum class StructFieldType
{
Bool1,
Bool2,
Bool3,
Bool4,
Float1,
Float2,
Float3,
Float4,
Double1,
Double2,
Double3,
Double4,
Int1,
Int2,
Int3,
Int4,
UInt1,
UInt2,
UInt3,
UInt4,
Max = UInt4
};
enum class StructLayout
{
Packed,
Std140,
Max = Std140
};
enum class StencilOperation
{
Decrement,

View File

@@ -9,6 +9,7 @@
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Renderer/Enums.hpp>
#include <Nazara/Shader/Enums.hpp>
#include <Nazara/Utility/Enums.hpp>
#include <Nazara/VulkanRenderer/Wrapper/Loader.hpp>
#include <optional>