Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ See docs/process.md for more on how version tagging works.

3.1.52 (in development)
-----------------------
- The WORKAROUND_OLD_WEBGL_UNIFORM_UPLOAD_IGNORED_OFFSET_BUG setting was
removed. This was a workaround from 2018 (#7459) that should no longer be
needed. (#20925)
- The `--default-obj-ext` command line flag was removed. (#20917)
- emcc will now treat `.bc` files as source files. These means that will get
compiled by clang before being passed to the linker. This matches the
Expand Down
68 changes: 0 additions & 68 deletions src/library_webgl.js
Original file line number Diff line number Diff line change
Expand Up @@ -1065,41 +1065,6 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
GLctx: ctx
};

#if WORKAROUND_OLD_WEBGL_UNIFORM_UPLOAD_IGNORED_OFFSET_BUG
context.cannotHandleOffsetsInUniformArrayViews = (function(g) {
function b(c, t) {
var s = g.createShader(t);
g.shaderSource(s, c);
g.compileShader(s);
return s;
}
try {
// Note: we do not delete this program so it stays part of the context
// we created, but that is ok - it does not do anything and we want to
// keep this detection size minimal.
var p = g.createProgram();
g.attachShader(p, b("attribute vec4 p;void main(){gl_Position=p;}", 0x8B31 /*GL_VERTEX_SHADER*/));
g.attachShader(p, b("precision lowp float;uniform vec4 u;void main(){gl_FragColor=u;}", 0x8B30 /*GL_FRAGMENT_SHADER*/));
g.linkProgram(p);
var h = new Float32Array(8);
h[4] = 1;
g.useProgram(p);
var l = g.getUniformLocation(p, "u");
// Uploading a 4-vector GL uniform from last four elements of array
// [0,0,0,0,1,0,0,0], i.e. uploading vec4=(1,0,0,0) at offset=4.
g.uniform4fv(l, h.subarray(4, 8));
// in proper WebGL we expect to read back the vector we just uploaded:
// (1,0,0,0). On buggy browser would instead have uploaded offset=0 of
// above array, i.e. vec4=(0,0,0,0)
return !g.getUniform(p, l)[0];i
} catch(e) {
// If we get an exception, we assume we got some other error, and do
// not trigger this workaround.
return false;
}
})();
#endif

// Store the created context object so that we can access the context
// given a canvas without having to pass the parameters again.
if (ctx.canvas) ctx.canvas.GLctxObject = context;
Expand Down Expand Up @@ -2515,9 +2480,6 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
#endif
{
var view = {{{ makeHEAPView('32', 'value', 'value+count*4') }}};
#if WORKAROUND_OLD_WEBGL_UNIFORM_UPLOAD_IGNORED_OFFSET_BUG
if (GL.currentContext.cannotHandleOffsetsInUniformArrayViews) view = new Int32Array(view);
#endif
}
GLctx.uniform1iv(webglGetUniformLocation(location), view);
#endif // MIN_WEBGL_VERSION >= 2
Expand Down Expand Up @@ -2560,9 +2522,6 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
#endif
{
var view = {{{ makeHEAPView('32', 'value', 'value+count*8') }}};
#if WORKAROUND_OLD_WEBGL_UNIFORM_UPLOAD_IGNORED_OFFSET_BUG
if (GL.currentContext.cannotHandleOffsetsInUniformArrayViews) view = new Int32Array(view);
#endif
}
GLctx.uniform2iv(webglGetUniformLocation(location), view);
#endif // MIN_WEBGL_VERSION >= 2
Expand Down Expand Up @@ -2606,9 +2565,6 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
#endif
{
var view = {{{ makeHEAPView('32', 'value', 'value+count*12') }}};
#if WORKAROUND_OLD_WEBGL_UNIFORM_UPLOAD_IGNORED_OFFSET_BUG
if (GL.currentContext.cannotHandleOffsetsInUniformArrayViews) view = new Int32Array(view);
#endif
}
GLctx.uniform3iv(webglGetUniformLocation(location), view);
#endif // MIN_WEBGL_VERSION >= 2
Expand Down Expand Up @@ -2655,9 +2611,6 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
#endif
{
var view = {{{ makeHEAPView('32', 'value', 'value+count*16') }}};
#if WORKAROUND_OLD_WEBGL_UNIFORM_UPLOAD_IGNORED_OFFSET_BUG
if (GL.currentContext.cannotHandleOffsetsInUniformArrayViews) view = new Int32Array(view);
#endif
}
GLctx.uniform4iv(webglGetUniformLocation(location), view);
#endif // MIN_WEBGL_VERSION >= 2
Expand Down Expand Up @@ -2699,9 +2652,6 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
#endif
{
var view = {{{ makeHEAPView('F32', 'value', 'value+count*4') }}};
#if WORKAROUND_OLD_WEBGL_UNIFORM_UPLOAD_IGNORED_OFFSET_BUG
if (GL.currentContext.cannotHandleOffsetsInUniformArrayViews) view = new Float32Array(view);
#endif
}
GLctx.uniform1fv(webglGetUniformLocation(location), view);
#endif // MIN_WEBGL_VERSION >= 2
Expand Down Expand Up @@ -2746,9 +2696,6 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
#endif
{
var view = {{{ makeHEAPView('F32', 'value', 'value+count*8') }}};
#if WORKAROUND_OLD_WEBGL_UNIFORM_UPLOAD_IGNORED_OFFSET_BUG
if (GL.currentContext.cannotHandleOffsetsInUniformArrayViews) view = new Float32Array(view);
#endif
}
GLctx.uniform2fv(webglGetUniformLocation(location), view);
#endif // MIN_WEBGL_VERSION >= 2
Expand Down Expand Up @@ -2794,9 +2741,6 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
#endif
{
var view = {{{ makeHEAPView('F32', 'value', 'value+count*12') }}};
#if WORKAROUND_OLD_WEBGL_UNIFORM_UPLOAD_IGNORED_OFFSET_BUG
if (GL.currentContext.cannotHandleOffsetsInUniformArrayViews) view = new Float32Array(view);
#endif
}
GLctx.uniform3fv(webglGetUniformLocation(location), view);
#endif // MIN_WEBGL_VERSION >= 2
Expand Down Expand Up @@ -2847,9 +2791,6 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
#endif
{
var view = {{{ makeHEAPView('F32', 'value', 'value+count*16') }}};
#if WORKAROUND_OLD_WEBGL_UNIFORM_UPLOAD_IGNORED_OFFSET_BUG
if (GL.currentContext.cannotHandleOffsetsInUniformArrayViews) view = new Float32Array(view);
#endif
}
GLctx.uniform4fv(webglGetUniformLocation(location), view);
#endif // MIN_WEBGL_VERSION >= 2
Expand Down Expand Up @@ -2896,9 +2837,6 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
#endif
{
var view = {{{ makeHEAPView('F32', 'value', 'value+count*16') }}};
#if WORKAROUND_OLD_WEBGL_UNIFORM_UPLOAD_IGNORED_OFFSET_BUG
if (GL.currentContext.cannotHandleOffsetsInUniformArrayViews) view = new Float32Array(view);
#endif
}
GLctx.uniformMatrix2fv(webglGetUniformLocation(location), !!transpose, view);
#endif // MIN_WEBGL_VERSION >= 2
Expand Down Expand Up @@ -2950,9 +2888,6 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
#endif
{
var view = {{{ makeHEAPView('F32', 'value', 'value+count*36') }}};
#if WORKAROUND_OLD_WEBGL_UNIFORM_UPLOAD_IGNORED_OFFSET_BUG
if (GL.currentContext.cannotHandleOffsetsInUniformArrayViews) view = new Float32Array(view);
#endif
}
GLctx.uniformMatrix3fv(webglGetUniformLocation(location), !!transpose, view);
#endif // MIN_WEBGL_VERSION >= 2
Expand Down Expand Up @@ -3015,9 +2950,6 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
#endif
{
var view = {{{ makeHEAPView('F32', 'value', 'value+count*64') }}};
#if WORKAROUND_OLD_WEBGL_UNIFORM_UPLOAD_IGNORED_OFFSET_BUG
if (GL.currentContext.cannotHandleOffsetsInUniformArrayViews) view = new Float32Array(view);
#endif
}
GLctx.uniformMatrix4fv(webglGetUniformLocation(location), !!transpose, view);
#endif // MIN_WEBGL_VERSION >= 2
Expand Down
9 changes: 1 addition & 8 deletions src/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -492,13 +492,6 @@ var GL_SUPPORT_EXPLICIT_SWAP_CONTROL = false;
// [link]
var GL_POOL_TEMP_BUFFERS = true;

// Some old Android WeChat (Chromium 37?) browser has a WebGL bug that it ignores
// the offset of a typed array view pointing to an ArrayBuffer. Set this to
// 1 to enable a polyfill that works around the issue when it appears. This
// bug is only relevant to WebGL 1, the affected browsers do not support WebGL 2.
// [link]
var WORKAROUND_OLD_WEBGL_UNIFORM_UPLOAD_IGNORED_OFFSET_BUG = false;

// If true, enables support for the EMSCRIPTEN_explicit_uniform_location WebGL
// extension. See docs/EMSCRIPTEN_explicit_uniform_location.txt
var GL_EXPLICIT_UNIFORM_LOCATION = false;
Expand Down Expand Up @@ -611,7 +604,6 @@ var POLYFILL_OLD_MATH_FUNCTIONS = false;
// the highest possible probability of the code working everywhere, even in rare old
// browsers and shell environments. Specifically:
// * Add polyfilling for Math.clz32, Math.trunc, Math.imul, Math.fround. (-sPOLYFILL_OLD_MATH_FUNCTIONS)
// * Work around old Chromium WebGL 1 bug (-sWORKAROUND_OLD_WEBGL_UNIFORM_UPLOAD_IGNORED_OFFSET_BUG)
// * Disable WebAssembly. (Must be paired with -sWASM=0)
// * Adjusts MIN_X_VERSION settings to 0 to include support for all browser versions.
// * Avoid TypedArray.fill, if necessary, in zeroMemory utility function.
Expand Down Expand Up @@ -2159,4 +2151,5 @@ var LEGACY_SETTINGS = [
['RUNTIME_LOGGING', 'RUNTIME_DEBUG'],
['MIN_EDGE_VERSION', [0x7FFFFFFF], 'No longer supported'],
['MIN_IE_VERSION', [0x7FFFFFFF], 'No longer supported'],
['WORKAROUND_OLD_WEBGL_UNIFORM_UPLOAD_IGNORED_OFFSET_BUG', [0], 'No longer supported'],
];
7 changes: 1 addition & 6 deletions test/test_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2794,7 +2794,7 @@ def test_webgl_unmasked_vendor_webgl(self):
@requires_graphics_hardware
@parameterized({
'legacy_browser': (['-sMIN_CHROME_VERSION=0', '-Wno-transpile'],),
'closure': (['-O2', '-g1', '--closure=1', '-sWORKAROUND_OLD_WEBGL_UNIFORM_UPLOAD_IGNORED_OFFSET_BUG'],),
'closure': (['-O2', '-g1', '--closure=1'],),
'full_es2': (['-sFULL_ES2'],),
})
def test_webgl2(self, args):
Expand Down Expand Up @@ -4750,11 +4750,6 @@ def test_webgl_offscreen_framebuffer_state_restoration(self):
cmd = args + ['-lGL', '-sOFFSCREEN_FRAMEBUFFER', '-DEXPLICIT_SWAP=1']
self.btest_exit('webgl_offscreen_framebuffer_swap_with_bad_state.c', args=cmd)

# Tests that -sWORKAROUND_OLD_WEBGL_UNIFORM_UPLOAD_IGNORED_OFFSET_BUG rendering works.
@requires_graphics_hardware
def test_webgl_workaround_webgl_uniform_upload_bug(self):
self.btest_exit('webgl_draw_triangle_with_uniform_color.c', args=['-lGL', '-sWORKAROUND_OLD_WEBGL_UNIFORM_UPLOAD_IGNORED_OFFSET_BUG'])

# Tests that using an array of structs in GL uniforms works.
@requires_graphics_hardware
def test_webgl_array_of_structs_uniform(self):
Expand Down
4 changes: 0 additions & 4 deletions tools/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -1101,9 +1101,6 @@ def phase_linker_setup(options, state, newargs):
settings.MIN_CHROME_VERSION = 0
settings.MIN_NODE_VERSION = 0

if settings.MIN_CHROME_VERSION <= 37:
settings.WORKAROUND_OLD_WEBGL_UNIFORM_UPLOAD_IGNORED_OFFSET_BUG = 1

# 10.19.0 is the oldest version of node that we do any testing with.
# Keep this in sync with the test-node-compat in .circleci/config.yml
# and MINIMUM_NODE_VERSION in tools/shared.py
Expand Down Expand Up @@ -1153,7 +1150,6 @@ def phase_linker_setup(options, state, newargs):
# Silently drop any individual backwards compatibility emulation flags that are known never to occur on browsers that support WebAssembly.
if not settings.WASM2JS:
settings.POLYFILL_OLD_MATH_FUNCTIONS = 0
settings.WORKAROUND_OLD_WEBGL_UNIFORM_UPLOAD_IGNORED_OFFSET_BUG = 0

if settings.STB_IMAGE and final_suffix in EXECUTABLE_ENDINGS:
state.forced_stdlibs.append('libstb_image')
Expand Down