Improve emscripten support

This commit is contained in:
SirLynix
2022-12-06 08:05:28 +01:00
committed by Jérôme Leclercq
parent 7cb90782de
commit ea5c5240fc
10 changed files with 53 additions and 32 deletions

View File

@@ -147,11 +147,14 @@ namespace Nz::GL
GLenum Context::BindFramebuffer(GLuint fbo) const
{
// it looks like emscripten wants us to rebind the FBO everytime
#ifndef NAZARA_PLATFORM_WEB
if (m_state.boundDrawFBO == fbo)
return GL_DRAW_FRAMEBUFFER;
else if (m_state.boundReadFBO == fbo)
return GL_READ_FRAMEBUFFER;
else
#endif
{
if (!SetCurrentContext(this))
throw std::runtime_error("failed to activate context");
@@ -166,12 +169,10 @@ namespace Nz::GL
void Context::BindFramebuffer(FramebufferTarget target, GLuint fbo) const
{
auto& currentFbo = (target == FramebufferTarget::Draw) ? m_state.boundDrawFBO : m_state.boundReadFBO;
#ifdef NAZARA_PLATFORM_WEB
constexpr bool isWeb = true;
#else
constexpr bool isWeb = false;
// it looks like emscripten wants us to rebind the FBO everytime
#ifndef NAZARA_PLATFORM_WEB
if (currentFbo != fbo)
#endif
if (currentFbo != fbo || isWeb);
{
if (!SetCurrentContext(this))
throw std::runtime_error("failed to activate context");