From b379518479d0f2433f6657fda97b6584c7a4676a Mon Sep 17 00:00:00 2001 From: SirLynix Date: Tue, 6 Dec 2022 09:08:17 +0100 Subject: [PATCH] Forgot to commit this file --- src/Nazara/OpenGLRenderer/OpenGLDevice.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Nazara/OpenGLRenderer/OpenGLDevice.cpp b/src/Nazara/OpenGLRenderer/OpenGLDevice.cpp index e19463455..2a5012d95 100644 --- a/src/Nazara/OpenGLRenderer/OpenGLDevice.cpp +++ b/src/Nazara/OpenGLRenderer/OpenGLDevice.cpp @@ -125,24 +125,34 @@ namespace Nz m_referenceContext.reset(); } - std::unique_ptr OpenGLDevice::CreateContext(GL::ContextParams params) const + std::shared_ptr OpenGLDevice::CreateContext([[maybe_unused]] GL::ContextParams params) const { +#ifdef NAZARA_PLATFORM_WEB + // WebGL doesn't support context sharing and we support only one canvas, return the reference context + return m_referenceContext; +#else params.type = m_referenceContext->GetParams().type; auto contextPtr = m_loader.CreateContext(this, params, m_referenceContext.get()); m_contexts.insert(contextPtr.get()); return contextPtr; +#endif } - std::unique_ptr OpenGLDevice::CreateContext(GL::ContextParams params, WindowHandle handle) const + std::shared_ptr OpenGLDevice::CreateContext([[maybe_unused]] GL::ContextParams params, [[maybe_unused]] WindowHandle handle) const { +#ifdef NAZARA_PLATFORM_WEB + // WebGL doesn't support context sharing and we support only one canvas, return the reference context + return m_referenceContext; +#else params.type = m_referenceContext->GetParams().type; auto contextPtr = m_loader.CreateContext(this, params, handle, m_referenceContext.get()); m_contexts.insert(contextPtr.get()); return contextPtr; +#endif } const RenderDeviceInfo& OpenGLDevice::GetDeviceInfo() const