You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Current emscripten html5_webgl.h has this comment regarding GetProcAddress emulation:
// Returns function pointers to WebGL 2 functions. Please avoid using this function ever - all WebGL2/GLES3 functions, even those for WebGL2 extensions, are available to user code via static linking. Calling GL functions
// via function pointers obtained here is slow, and using this function can greatly increase resulting compiled program size. This functionality is available only for easier program code porting purposes, but be aware
// that calling this is causing a noticeable performance and compiled code size hit.
void *emscripten_webgl2_get_proc_address(const char *name);
And it is true, they contain khronos headers with:
Meaning whole GL api surface is available as pure functions and ready to be statically linked. Given how costly function pointer calls on js/wasm, it would make sense to take leverage of static-linking-available GL functions.
I've quickly tried doing that by disabling glimports.h and friends, and disabling 3rdparty/khronos headers, instead relying on emscripten provided headers, that almost worked! But the bgfx code is sprinkled with non-GLES function calls like glQueryCounter and glGetQueryObjectui64v which are not really available in GLES headers of emscripten (they do have GL/glext.h but I doubt it gonna work).
Is there some reasonable way to make it work without reinventing how bgfx consumes GL api? I was thinking something among the lines of a "smart" GL_IMPORT that could only define function signature if already existing GLES headers not provided it, but it seems a bit tricky to do.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Current emscripten
html5_webgl.h
has this comment regarding GetProcAddress emulation:And it is true, they contain khronos headers with:
Meaning whole GL api surface is available as pure functions and ready to be statically linked. Given how costly function pointer calls on js/wasm, it would make sense to take leverage of static-linking-available GL functions.
I've quickly tried doing that by disabling glimports.h and friends, and disabling 3rdparty/khronos headers, instead relying on emscripten provided headers, that almost worked! But the bgfx code is sprinkled with non-GLES function calls like
glQueryCounter
andglGetQueryObjectui64v
which are not really available in GLES headers of emscripten (they do haveGL/glext.h
but I doubt it gonna work).Is there some reasonable way to make it work without reinventing how bgfx consumes GL api? I was thinking something among the lines of a "smart"
GL_IMPORT
that could only define function signature if already existing GLES headers not provided it, but it seems a bit tricky to do.Thanks!
Beta Was this translation helpful? Give feedback.
All reactions