Renderer: Replace ShaderStage by ShaderModule (a module can handle multiple stages)
This commit is contained in:
@@ -38,8 +38,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<ShaderStage> InstantiateShaderStage(const ShaderAst& shaderAst, const ShaderWriter::States& states) override;
|
||||
std::shared_ptr<ShaderStage> InstantiateShaderStage(ShaderStageType type, ShaderLanguage lang, const void* source, std::size_t sourceSize) override;
|
||||
std::shared_ptr<ShaderModule> InstantiateShaderModule(ShaderStageTypeFlags shaderStages, ShaderAst::StatementPtr& shaderAst, const ShaderWriter::States& states) override;
|
||||
std::shared_ptr<ShaderModule> InstantiateShaderModule(ShaderStageTypeFlags shaderStages, ShaderLanguage lang, const void* source, std::size_t sourceSize) override;
|
||||
std::shared_ptr<Texture> InstantiateTexture(const TextureInfo& params) override;
|
||||
std::shared_ptr<TextureSampler> InstantiateTextureSampler(const TextureSamplerInfo& params) override;
|
||||
|
||||
|
||||
45
include/Nazara/OpenGLRenderer/OpenGLShaderModule.hpp
Normal file
45
include/Nazara/OpenGLRenderer/OpenGLShaderModule.hpp
Normal file
@@ -0,0 +1,45 @@
|
||||
// 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
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_OPENGLRENDERER_OPENGLSHADERMODULE_HPP
|
||||
#define NAZARA_OPENGLRENDERER_OPENGLSHADERMODULE_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Renderer/Enums.hpp>
|
||||
#include <Nazara/Renderer/ShaderModule.hpp>
|
||||
#include <Nazara/OpenGLRenderer/Wrapper/Context.hpp>
|
||||
#include <Nazara/OpenGLRenderer/Wrapper/Shader.hpp>
|
||||
#include <Nazara/Shader/ShaderWriter.hpp>
|
||||
#include <vector>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class NAZARA_OPENGLRENDERER_API OpenGLShaderModule : public ShaderModule
|
||||
{
|
||||
public:
|
||||
OpenGLShaderModule(OpenGLDevice& device, ShaderStageTypeFlags shaderStages, ShaderAst::StatementPtr& shaderAst, const ShaderWriter::States& states);
|
||||
OpenGLShaderModule(OpenGLDevice& device, ShaderStageTypeFlags shaderStages, ShaderLanguage lang, const void* source, std::size_t sourceSize);
|
||||
OpenGLShaderModule(const OpenGLShaderModule&) = delete;
|
||||
OpenGLShaderModule(OpenGLShaderModule&&) noexcept = default;
|
||||
~OpenGLShaderModule() = default;
|
||||
|
||||
inline const std::vector<GL::Shader>& GetShaders() const;
|
||||
|
||||
OpenGLShaderModule& operator=(const OpenGLShaderModule&) = delete;
|
||||
OpenGLShaderModule& operator=(OpenGLShaderModule&&) noexcept = default;
|
||||
|
||||
private:
|
||||
void Create(OpenGLDevice& device, ShaderStageTypeFlags shaderStages, ShaderAst::StatementPtr& shaderAst, const ShaderWriter::States& states);
|
||||
|
||||
static void CheckCompilationStatus(GL::Shader& shader);
|
||||
|
||||
std::vector<GL::Shader> m_shaders;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/OpenGLRenderer/OpenGLShaderModule.inl>
|
||||
|
||||
#endif // NAZARA_OPENGLRENDERER_OPENGLSHADERSTAGE_HPP
|
||||
@@ -2,14 +2,14 @@
|
||||
// This file is part of the "Nazara Engine - OpenGL Renderer"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/OpenGLRenderer/OpenGLShaderStage.hpp>
|
||||
#include <Nazara/OpenGLRenderer/OpenGLShaderModule.hpp>
|
||||
#include <Nazara/OpenGLRenderer/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline const GL::Shader& OpenGLShaderStage::GetShader() const
|
||||
inline const std::vector<GL::Shader>& OpenGLShaderModule::GetShaders() const
|
||||
{
|
||||
return m_shader;
|
||||
return m_shaders;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
// 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
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_OPENGLRENDERER_OPENGLSHADERSTAGE_HPP
|
||||
#define NAZARA_OPENGLRENDERER_OPENGLSHADERSTAGE_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Renderer/Enums.hpp>
|
||||
#include <Nazara/Renderer/ShaderStage.hpp>
|
||||
#include <Nazara/OpenGLRenderer/Wrapper/Context.hpp>
|
||||
#include <Nazara/OpenGLRenderer/Wrapper/Shader.hpp>
|
||||
#include <Nazara/Shader/ShaderWriter.hpp>
|
||||
#include <vector>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class ShaderAst;
|
||||
|
||||
class NAZARA_OPENGLRENDERER_API OpenGLShaderStage : public ShaderStage
|
||||
{
|
||||
public:
|
||||
OpenGLShaderStage(OpenGLDevice& device, const ShaderAst& shaderAst, const ShaderWriter::States& states);
|
||||
OpenGLShaderStage(OpenGLDevice& device, ShaderStageType type, ShaderLanguage lang, const void* source, std::size_t sourceSize);
|
||||
OpenGLShaderStage(const OpenGLShaderStage&) = delete;
|
||||
OpenGLShaderStage(OpenGLShaderStage&&) noexcept = default;
|
||||
~OpenGLShaderStage() = default;
|
||||
|
||||
inline const GL::Shader& GetShader() const;
|
||||
|
||||
OpenGLShaderStage& operator=(const OpenGLShaderStage&) = delete;
|
||||
OpenGLShaderStage& operator=(OpenGLShaderStage&&) noexcept = default;
|
||||
|
||||
private:
|
||||
void CheckCompilationStatus();
|
||||
void Create(OpenGLDevice& device, const ShaderAst& shaderAst, const ShaderWriter::States& states);
|
||||
|
||||
GL::Shader m_shader;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/OpenGLRenderer/OpenGLShaderStage.inl>
|
||||
|
||||
#endif // NAZARA_OPENGLRENDERER_OPENGLSHADERSTAGE_HPP
|
||||
Reference in New Issue
Block a user