// 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 #include #include #include #include #include #include #include #include namespace Nz { OpenGLRenderPipeline::OpenGLRenderPipeline(OpenGLDevice& device, RenderPipelineInfo pipelineInfo) : m_pipelineInfo(std::move(pipelineInfo)) { if (!m_program.Create(device)) throw std::runtime_error("failed to create program"); for (const auto& shaderStagePtr : m_pipelineInfo.shaderStages) { OpenGLShaderStage& shaderStage = static_cast(*shaderStagePtr); m_program.AttachShader(shaderStage.GetShader().GetObjectId()); } m_program.Link(); std::string errLog; if (!m_program.GetLinkStatus(&errLog)) throw std::runtime_error("failed to link program: " + errLog); } void OpenGLRenderPipeline::Apply(const GL::Context& context) const { context.UpdateStates(m_pipelineInfo); context.BindProgram(m_program.GetObjectId()); //< Bind program after states } }