Add RenderPipelineLayout

This commit is contained in:
Lynix
2020-03-05 20:35:31 +01:00
parent 4941de61da
commit 2b3241f354
25 changed files with 330 additions and 126 deletions

View File

@@ -60,6 +60,7 @@ namespace Nz
Max = Vertex
};
template<>
struct EnumAsFlags<ShaderStageType>
{
static constexpr ShaderStageType max = ShaderStageType::Max;

View File

@@ -11,6 +11,7 @@
#include <Nazara/Renderer/Config.hpp>
#include <Nazara/Renderer/Enums.hpp>
#include <Nazara/Renderer/RenderPipeline.hpp>
#include <Nazara/Renderer/RenderPipelineLayout.hpp>
#include <Nazara/Utility/AbstractBuffer.hpp>
#include <memory>
#include <string>
@@ -28,6 +29,7 @@ namespace Nz
virtual std::unique_ptr<AbstractBuffer> InstantiateBuffer(Buffer* parent, BufferType type) = 0;
virtual std::unique_ptr<RenderPipeline> InstantiateRenderPipeline(RenderPipelineInfo pipelineInfo) = 0;
virtual std::shared_ptr<RenderPipelineLayout> InstantiateRenderPipelineLayout(RenderPipelineLayoutInfo pipelineLayoutInfo) = 0;
virtual std::shared_ptr<ShaderStageImpl> InstantiateShaderStage(ShaderStageType type, ShaderLanguage lang, const void* source, std::size_t sourceSize) = 0;
std::shared_ptr<ShaderStageImpl> InstantiateShaderStage(ShaderStageType type, ShaderLanguage lang, const std::filesystem::path& sourcePath);
};

View File

@@ -8,6 +8,7 @@
#define NAZARA_RENDERPIPELINE_HPP
#include <Nazara/Utility/Enums.hpp>
#include <Nazara/Renderer/RenderPipelineLayout.hpp>
#include <Nazara/Renderer/RenderStates.hpp>
//#include <Nazara/Renderer/Shader.hpp>
@@ -15,7 +16,15 @@ namespace Nz
{
struct RenderPipelineInfo : RenderStates
{
/*ShaderConstRef shader;*/
struct VertexBufferData
{
std::size_t binding;
VertexDeclarationConstRef declaration;
};
std::shared_ptr<RenderPipelineLayout> pipelineLayout;
std::vector<std::shared_ptr<ShaderStageImpl>> shaderStages;
std::vector<VertexBufferData> vertexBuffers;
};
class NAZARA_RENDERER_API RenderPipeline

View File

@@ -0,0 +1,40 @@
// 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
#pragma once
#ifndef NAZARA_RENDERPIPELINELAYOUT_HPP
#define NAZARA_RENDERPIPELINELAYOUT_HPP
#include <Nazara/Renderer/Config.hpp>
#include <Nazara/Renderer/Enums.hpp>
#include <string>
#include <vector>
namespace Nz
{
struct RenderPipelineLayoutInfo
{
struct Binding
{
std::string name; //< FIXME: wtf is this?
ShaderBindingType type;
ShaderStageTypeFlags shaderStageFlags;
unsigned int index;
};
std::vector<Binding> bindings;
};
class NAZARA_RENDERER_API RenderPipelineLayout
{
public:
RenderPipelineLayout() = default;
virtual ~RenderPipelineLayout();
};
}
#include <Nazara/Renderer/RenderPipelineLayout.inl>
#endif // NAZARA_RENDERPIPELINELAYOUT_HPP

View File

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

View File

@@ -37,15 +37,6 @@ namespace Nz
UInt32 writeMask = 0xFFFFFFFF;
} stencilBack, stencilFront;
struct VertexBufferData
{
std::size_t binding;
VertexDeclarationConstRef declaration;
};
std::vector<std::shared_ptr<ShaderStageImpl>> shaderStages;
std::vector<VertexBufferData> vertexBuffers;
bool blending = false;
bool colorWrite = true;
bool depthBuffer = false;