You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +00:00
[HTML5] Use compatibility function for glGetBufferSubData.
The "webgl/webgl2.h" include provides that function, but it's not available in emscripten versions < 2.0.17 . Since we need to support emscripten 1.39.9 (mono builds), this commit adds a JS function in library_godot_display.js as a compatibility layer for it, and implement glGetBufferSubData by funneling the call to that function (so we don't have name collisions JS-side with recent emcc). All those hacks are now moved to the platform directory instead of being ifdefs inside the drivers implementations.
This commit is contained in:
@@ -320,6 +320,18 @@ const GodotDisplay = {
|
||||
},
|
||||
},
|
||||
|
||||
// This is implemented as "glGetBufferSubData" in new emscripten versions.
|
||||
// Since we have to support older (pre 2.0.17) emscripten versions, we add this wrapper function instead.
|
||||
godot_js_display_glGetBufferSubData__sig: 'viiii',
|
||||
godot_js_display_glGetBufferSubData__deps: ['$GL', 'emscripten_webgl_get_current_context'],
|
||||
godot_js_display_glGetBufferSubData: function (target, offset, size, data) {
|
||||
const gl_context_handle = _emscripten_webgl_get_current_context(); // eslint-disable-line no-undef
|
||||
const gl = GL.getContext(gl_context_handle);
|
||||
if (gl) {
|
||||
gl.GLctx['getBufferSubData'](target, offset, HEAPU8, data, size);
|
||||
}
|
||||
},
|
||||
|
||||
godot_js_display_is_swap_ok_cancel__sig: 'i',
|
||||
godot_js_display_is_swap_ok_cancel: function () {
|
||||
const win = (['Windows', 'Win64', 'Win32', 'WinCE']);
|
||||
|
||||
Reference in New Issue
Block a user