From 4d4fac074affa4b5fdc4d9f5199e64ab181b9ae8 Mon Sep 17 00:00:00 2001 From: Tadej Novak Date: Mon, 20 Oct 2025 07:15:46 +0200 Subject: [PATCH] Compatibility fixes for WebAssembly and WebGL 2 (#3752) --- src/mbgl/gl/uniform_buffer_gl.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/mbgl/gl/uniform_buffer_gl.cpp b/src/mbgl/gl/uniform_buffer_gl.cpp index 200a945c6..af3bf4b76 100644 --- a/src/mbgl/gl/uniform_buffer_gl.cpp +++ b/src/mbgl/gl/uniform_buffer_gl.cpp @@ -41,8 +41,14 @@ UniformBufferGL::UniformBufferGL(Context& context_, const void* data_, std::size context.renderingStats().numBuffers++; context.renderingStats().memBuffers += size; +#ifdef __EMSCRIPTEN__ + constexpr bool forceDisableManagedAllocation{true}; +#else + constexpr bool forceDisableManagedAllocation{false}; +#endif + MLN_TRACE_ALLOC_CONST_BUFFER(uniqueDebugId, size_); - if (size_ > managedBuffer.allocator.pageSize()) { + if (forceDisableManagedAllocation || size_ > managedBuffer.allocator.pageSize()) { // Buffer is very large, won't fit in the provided allocator MBGL_CHECK_ERROR(glGenBuffers(1, &localID)); MBGL_CHECK_ERROR(glBindBuffer(GL_UNIFORM_BUFFER, localID));