Skip to content

Commit

Permalink
Use JS naming convention for JS-only symbol. NFC
Browse files Browse the repository at this point in the history
The `emscripten_` naming convention is something we use for native
function and this symbol is not visible to native code.
  • Loading branch information
sbc100 committed Jan 29, 2024
1 parent cfdc30e commit f07d2aa
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
11 changes: 6 additions & 5 deletions src/library_html5_webgl.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ var LibraryHtml5WebGL = {
return len;
},

$emscripten_webgl_power_preferences: "['default', 'low-power', 'high-performance']",
$webglPowerPreferences__internal: true,
$webglPowerPreferences: ['default', 'low-power', 'high-performance'],

#if PTHREADS && OFFSCREEN_FRAMEBUFFER
// In offscreen framebuffer mode, we implement a proxied version of the
Expand Down Expand Up @@ -49,7 +50,7 @@ var LibraryHtml5WebGL = {
#if PTHREADS && OFFSCREEN_FRAMEBUFFER
'emscripten_webgl_create_context_proxied',
#endif
'$JSEvents', '$emscripten_webgl_power_preferences', '$findEventTarget', '$findCanvasEventTarget'],
'$JSEvents', '$webglPowerPreferences', '$findEventTarget', '$findCanvasEventTarget'],
// This function performs proxying manually, depending on the style of context that is to be created.
emscripten_webgl_do_create_context: (target, attributes) => {
#if ASSERTIONS
Expand All @@ -64,7 +65,7 @@ var LibraryHtml5WebGL = {
'antialias': !!HEAP32[a + ({{{ C_STRUCTS.EmscriptenWebGLContextAttributes.antialias }}}>>2)],
'premultipliedAlpha': !!HEAP32[a + ({{{ C_STRUCTS.EmscriptenWebGLContextAttributes.premultipliedAlpha }}}>>2)],
'preserveDrawingBuffer': !!HEAP32[a + ({{{ C_STRUCTS.EmscriptenWebGLContextAttributes.preserveDrawingBuffer }}}>>2)],
'powerPreference': emscripten_webgl_power_preferences[powerPreference],
'powerPreference': webglPowerPreferences[powerPreference],
'failIfMajorPerformanceCaveat': !!HEAP32[a + ({{{ C_STRUCTS.EmscriptenWebGLContextAttributes.failIfMajorPerformanceCaveat }}}>>2)],
// The following are not predefined WebGL context attributes in the WebGL specification, so the property names can be minified by Closure.
majorVersion: HEAP32[a + ({{{ C_STRUCTS.EmscriptenWebGLContextAttributes.majorVersion }}}>>2)],
Expand Down Expand Up @@ -251,7 +252,7 @@ var LibraryHtml5WebGL = {
},
emscripten_webgl_get_context_attributes__proxy: 'sync_on_webgl_context_handle_thread',
emscripten_webgl_get_context_attributes__deps: ['$emscripten_webgl_power_preferences'],
emscripten_webgl_get_context_attributes__deps: ['$webglPowerPreferences'],
emscripten_webgl_get_context_attributes: (c, a) => {
if (!a) return {{{ cDefs.EMSCRIPTEN_RESULT_INVALID_PARAM }}};
c = GL.contexts[c];
Expand All @@ -266,7 +267,7 @@ var LibraryHtml5WebGL = {
{{{ makeSetValue('a', C_STRUCTS.EmscriptenWebGLContextAttributes.antialias, 't.antialias', 'i32') }}};
{{{ makeSetValue('a', C_STRUCTS.EmscriptenWebGLContextAttributes.premultipliedAlpha, 't.premultipliedAlpha', 'i32') }}};
{{{ makeSetValue('a', C_STRUCTS.EmscriptenWebGLContextAttributes.preserveDrawingBuffer, 't.preserveDrawingBuffer', 'i32') }}};
var power = t['powerPreference'] && emscripten_webgl_power_preferences.indexOf(t['powerPreference']);
var power = t['powerPreference'] && webglPowerPreferences.indexOf(t['powerPreference']);
{{{ makeSetValue('a', C_STRUCTS.EmscriptenWebGLContextAttributes.powerPreference, 'power', 'i32') }}};
{{{ makeSetValue('a', C_STRUCTS.EmscriptenWebGLContextAttributes.failIfMajorPerformanceCaveat, 't.failIfMajorPerformanceCaveat', 'i32') }}};
{{{ makeSetValue('a', C_STRUCTS.EmscriptenWebGLContextAttributes.majorVersion, 'c.version', 'i32') }}};
Expand Down
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_hello_O0.gzsize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8408
8390
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_hello_O0.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
23069
23034
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_minimal_O0.gzsize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7238
7219
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_minimal_O0.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
19693
19658
2 changes: 1 addition & 1 deletion test/other/test_unoptimized_code_size.js.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
58237
58197

0 comments on commit f07d2aa

Please sign in to comment.