OpenGL: Random stuff I forgot
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include <Nazara/OpenGLRenderer/OpenGLDevice.hpp>
|
||||
#include <Nazara/Renderer/CommandPool.hpp>
|
||||
#include <Nazara/OpenGLRenderer/OpenGLBuffer.hpp>
|
||||
#include <Nazara/OpenGLRenderer/OpenGLRenderPipeline.hpp>
|
||||
#include <Nazara/OpenGLRenderer/OpenGLRenderPipelineLayout.hpp>
|
||||
#include <Nazara/OpenGLRenderer/OpenGLShaderStage.hpp>
|
||||
#include <Nazara/OpenGLRenderer/OpenGLTexture.hpp>
|
||||
@@ -25,7 +26,10 @@ namespace Nz
|
||||
m_contexts.insert(m_referenceContext.get());
|
||||
}
|
||||
|
||||
OpenGLDevice::~OpenGLDevice() = default;
|
||||
OpenGLDevice::~OpenGLDevice()
|
||||
{
|
||||
m_referenceContext.reset();
|
||||
}
|
||||
|
||||
std::unique_ptr<GL::Context> OpenGLDevice::CreateContext(const GL::ContextParams& params) const
|
||||
{
|
||||
@@ -55,7 +59,7 @@ namespace Nz
|
||||
|
||||
std::unique_ptr<RenderPipeline> OpenGLDevice::InstantiateRenderPipeline(RenderPipelineInfo pipelineInfo)
|
||||
{
|
||||
return {};
|
||||
return std::make_unique<OpenGLRenderPipeline>(*this, std::move(pipelineInfo));
|
||||
}
|
||||
|
||||
std::shared_ptr<RenderPipelineLayout> OpenGLDevice::InstantiateRenderPipelineLayout(RenderPipelineLayoutInfo pipelineLayoutInfo)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <Nazara/OpenGLRenderer/OpenGLRenderWindow.hpp>
|
||||
#include <Nazara/OpenGLRenderer/DummySurface.hpp>
|
||||
#include <Nazara/OpenGLRenderer/OpenGLCommandPool.hpp>
|
||||
#include <Nazara/OpenGLRenderer/OpenGLRenderer.hpp>
|
||||
#include <Nazara/Renderer/CommandPool.hpp>
|
||||
#include <Nazara/OpenGLRenderer/Debug.hpp>
|
||||
@@ -11,7 +12,8 @@
|
||||
namespace Nz
|
||||
{
|
||||
OpenGLRenderWindow::OpenGLRenderWindow() :
|
||||
m_currentFrame(0)
|
||||
m_currentFrame(0),
|
||||
m_framebuffer(*this)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -33,12 +35,18 @@ namespace Nz
|
||||
if (!m_context)
|
||||
return false;
|
||||
|
||||
constexpr std::size_t RenderImageCount = 2;
|
||||
|
||||
m_renderImage.reserve(RenderImageCount);
|
||||
for (std::size_t i = 0; i < RenderImageCount; ++i)
|
||||
m_renderImage.emplace_back(*this);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
std::unique_ptr<CommandPool> OpenGLRenderWindow::CreateCommandPool(QueueType queueType)
|
||||
{
|
||||
return {};
|
||||
return std::make_unique<OpenGLCommandPool>();
|
||||
}
|
||||
|
||||
const OpenGLFramebuffer& OpenGLRenderWindow::GetFramebuffer() const
|
||||
|
||||
@@ -49,6 +49,19 @@ namespace Nz::GL
|
||||
}
|
||||
}
|
||||
|
||||
void Context::BindFramebuffer(FramebufferTarget target, GLuint fbo) const
|
||||
{
|
||||
auto& currentFbo = (target == FramebufferTarget::Draw) ? m_state.boundDrawFBO : m_state.boundReadFBO;
|
||||
if (currentFbo != fbo)
|
||||
{
|
||||
if (!SetCurrentContext(this))
|
||||
throw std::runtime_error("failed to activate context");
|
||||
|
||||
glBindFramebuffer((target == FramebufferTarget::Draw) ? GL_DRAW_FRAMEBUFFER : GL_READ_FRAMEBUFFER, fbo);
|
||||
currentFbo = fbo;
|
||||
}
|
||||
}
|
||||
|
||||
void Context::BindSampler(UInt32 textureUnit, GLuint sampler) const
|
||||
{
|
||||
if (textureUnit >= m_state.textureUnits.size())
|
||||
|
||||
Reference in New Issue
Block a user