Improve emscripten support
This commit is contained in:
committed by
Jérôme Leclercq
parent
7cb90782de
commit
ea5c5240fc
@@ -174,6 +174,10 @@ namespace Nz
|
||||
m_states = states;
|
||||
m_states.sanitized = true; //< Shader is always sanitized (because of keywords)
|
||||
|
||||
#ifdef NAZARA_PLATFORM_WEB
|
||||
m_states.optimize = true; //< Always remove unused code with emscripten (prevents errors on draw calls when no buffer is bound on a unused binding)
|
||||
#endif
|
||||
|
||||
nzsl::Ast::SanitizeVisitor::Options options = nzsl::GlslWriter::GetSanitizeOptions();
|
||||
options.optionValues = states.optionValues;
|
||||
options.moduleResolver = states.shaderModuleResolver;
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -194,6 +194,10 @@ namespace Nz
|
||||
|
||||
WindowHandle WindowImpl::GetSystemHandle() const
|
||||
{
|
||||
#ifdef NAZARA_PLATFORM_WEB
|
||||
WindowHandle handle;
|
||||
return handle;
|
||||
#else
|
||||
SDL_SysWMinfo wmInfo;
|
||||
SDL_VERSION(&wmInfo.version);
|
||||
|
||||
@@ -256,6 +260,7 @@ namespace Nz
|
||||
}
|
||||
|
||||
return handle;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool WindowImpl::HasFocus() const
|
||||
|
||||
Reference in New Issue
Block a user