Raised minimum OpenGL version to 4.3. OpenGLES to 3.0. Removed glsl-optimizer. (#3905)

This commit is contained in:
Branimir Karadžić
2026-08-19 10:12:25 -07:00
committed by GitHub
parent 1820f47383
commit fde976604c
918 changed files with 9177 additions and 116077 deletions
+14 -21
View File
@@ -88,7 +88,7 @@ namespace bgfx { namespace gl
{
if (emscripten_webgl_get_context_attributes(context, &s_attrs) >= 0)
{
import(s_attrs.majorVersion);
import();
m_primary = BX_NEW(g_allocator, SwapChainGL)(context, canvas);
}
else
@@ -147,29 +147,22 @@ namespace bgfx { namespace gl
BX_UNUSED(_width, _height);
const char* canvas = (const char*)_nwh;
int32_t error = 0;
for (int version = 2; version >= 1; --version)
s_attrs.majorVersion = 2;
EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context = emscripten_webgl_create_context(canvas, &s_attrs);
if (context > 0)
{
s_attrs.majorVersion = version;
EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context = emscripten_webgl_create_context(canvas, &s_attrs);
EMSCRIPTEN_CHECK(emscripten_webgl_make_context_current(context) );
if (context > 0)
{
EMSCRIPTEN_CHECK(emscripten_webgl_make_context_current(context) );
SwapChainGL* swapChain = BX_NEW(g_allocator, SwapChainGL)(context, canvas);
SwapChainGL* swapChain = BX_NEW(g_allocator, SwapChainGL)(context, canvas);
import();
import(version);
return swapChain;
}
error = (int32_t)context;
return swapChain;
}
BX_TRACE("Failed to create WebGL context. (Canvas handle: '%s', last attempt error %d)", canvas, error);
BX_UNUSED(error);
BX_TRACE("Failed to create WebGL 2 context. (Canvas handle: '%s', error %d)", canvas, (int32_t)context);
return NULL;
}
@@ -209,10 +202,10 @@ namespace bgfx { namespace gl
}
template<typename Fn>
static Fn getProcAddress(int _version, const char* _name)
static Fn getProcAddress(const char* _name)
{
Fn func = reinterpret_cast<Fn>(emscripten_webgl1_get_proc_address(_name) );
if (NULL == func && _version >= 2)
if (NULL == func)
{
func = reinterpret_cast<Fn>(emscripten_webgl2_get_proc_address(_name) );
}
@@ -220,7 +213,7 @@ namespace bgfx { namespace gl
return func;
}
void GlContext::import(int _webGLVersion)
void GlContext::import()
{
BX_TRACE("Import:");
@@ -228,7 +221,7 @@ namespace bgfx { namespace gl
{ \
if (NULL == _func) \
{ \
_func = getProcAddress<_proto>(_webGLVersion, #_import); \
_func = getProcAddress<_proto>(#_import); \
BX_TRACE("\t%p " #_func " (" #_import ")", _func); \
BGFX_FATAL(_optional || NULL != _func, Fatal::UnableToInitialize \
, "Failed to create WebGL/OpenGLES context. GetProcAddress(\"%s\")" \