diff --git a/test/code_size/hello_webgl2_wasm.js b/test/code_size/hello_webgl2_wasm.js index 976cfda4d6010..75616c1b9a5bf 100644 --- a/test/code_size/hello_webgl2_wasm.js +++ b/test/code_size/hello_webgl2_wasm.js @@ -4,25 +4,28 @@ var Module = function(D = {}) { f.texImage2D(3553, 0, 6408, 6408, 5121, a); f.pixelStorei(37440, !1); } - var F, G, g, r, H, v, x, I, J, P = new TextDecoder("utf8"), t = (a, b) => { + var F, G, g, q, H, v, w, I, J, Q = new TextDecoder("utf8"), t = (a, b) => { if (!a) return ""; b = a + b; - for (var c = a; !(c >= b) && r[c]; ) ++c; - return P.decode(r.subarray(a, c)); - }, Q = [ 0, document, window ], y = a => { + for (var c = a; !(c >= b) && q[c]; ) ++c; + return Q.decode(q.subarray(a, c)); + }, R = [ 0, document, window ], y = a => { a = 2 < a ? t(a) : a; - return Q[a] || document.querySelector(a); - }, R = 1, K = [], p = [], z = [], u = [], A = [], w = a => { - for (var b = R++, c = a.length; c < b; c++) a[c] = null; + return R[a] || document.querySelector(a); + }, S = 1, K = [], p = [], z = [], u = [], A = [], x = a => { + for (var b = S++, c = a.length; c < b; c++) a[c] = null; return b; - }, B, S = [ "default", "low-power", "high-performance" ], L = (a, b, c, d) => { + }, r, T = [ "default", "low-power", "high-performance" ], L = (a, b, c, d) => { for (var e = 0; e < a; e++) { - var h = f[c](), k = h && w(d); + var h = f[c](), k = h && x(d); h && (h.name = k, d[k] = h); g[b + 4 * e >> 2] = k; } }, M = a => "]" == a.slice(-1) && a.lastIndexOf("["), N = a => { - var b = f.V, c = b.O[a]; + a -= 5120; + return 0 == a ? F : 1 == a ? q : 2 == a ? G : 4 == a ? g : 6 == a ? w : 5 == a || 28922 == a || 28520 == a || 30779 == a || 30782 == a ? v : H; + }, B = a => { + var b = f.W, c = b.O[a]; "number" == typeof c && (b.O[a] = c = f.getUniformLocation(b, b.S[a] + (0 < c ? "[" + c + "]" : ""))); return c; }, f, O; @@ -60,25 +63,25 @@ var Module = function(D = {}) { antialias: !!g[b + 3], premultipliedAlpha: !!g[b + 4], preserveDrawingBuffer: !!g[b + 5], - powerPreference: S[g[b + 6]], + powerPreference: T[g[b + 6]], failIfMajorPerformanceCaveat: !!g[b + 7], R: g[b + 8], ea: g[b + 9], aa: g[b + 10], - W: g[b + 11], + X: g[b + 11], fa: g[b + 12], ga: g[b + 13] }; a = y(a); - if (!a || b.W) b = 0; else if (a = 1 < b.R ? a.getContext("webgl2", b) : a.getContext("webgl", b)) { - var c = w(A); + if (!a || b.X) b = 0; else if (a = 1 < b.R ? a.getContext("webgl2", b) : a.getContext("webgl", b)) { + var c = x(A); b = { handle: c, attributes: b, version: b.R, U: a }; - a.canvas && (a.canvas.X = b); + a.canvas && (a.canvas.Y = b); A[c] = b; b = c; } else b = 0; @@ -90,8 +93,8 @@ var Module = function(D = {}) { g[a] = g[a + 1] = g[a + 3] = g[a + 4] = g[a + 8] = g[a + 10] = 1; }, g: a => { - B = A[a]; - D.Y = f = B && B.U; + r = A[a]; + D.Z = f = r && r.U; return !a || f ? 0 : -5; }, c: (a, b) => { @@ -101,7 +104,7 @@ var Module = function(D = {}) { f.bindAttribLocation(p[a], b, t(c)); }, C: (a, b) => { - 35051 == a ? f.Z = b : 35052 == a && (f.$ = b); + 35051 == a ? f.$ = b : 35052 == a && (f.V = b); f.bindBuffer(a, K[b]); }, d: (a, b) => { @@ -111,7 +114,7 @@ var Module = function(D = {}) { f.blendFunc(a, b); }, B: (a, b, c, d) => { - f.bufferData(a, c ? r.subarray(c, c + b) : b, d); + 2 <= r.version ? c && b ? f.bufferData(a, q, d, c, b) : f.bufferData(a, b, d) : f.bufferData(a, c ? q.subarray(c, c + b) : b, d); }, s: function(a) { f.clear(a); @@ -123,7 +126,7 @@ var Module = function(D = {}) { f.compileShader(u[a]); }, f: () => { - var a = w(p), b = f.createProgram(); + var a = x(p), b = f.createProgram(); b.name = a; b.da = b.ba = b.ca = 0; b.P = 1; @@ -131,7 +134,7 @@ var Module = function(D = {}) { return a; }, w: a => { - var b = w(u); + var b = x(u); u[b] = f.createShader(a); return b; }, @@ -155,14 +158,14 @@ var Module = function(D = {}) { if (a = p[a]) { var c = a, d = c.O, e = c.T, h; if (!d) for (c.O = d = {}, c.S = {}, h = 0; h < f.getProgramParameter(c, 35718); ++h) { - var k = f.getActiveUniform(c, h), n = k.name; + var k = f.getActiveUniform(c, h), m = k.name; k = k.size; - var m = M(n); - m = 0 < m ? n.slice(0, m) : n; - var q = c.P; + var l = M(m); + l = 0 < l ? m.slice(0, l) : m; + var n = c.P; c.P += k; - e[m] = [ k, q ]; - for (n = 0; n < k; ++n) d[q] = n, c.S[q++] = m; + e[l] = [ k, n ]; + for (m = 0; m < k; ++m) d[n] = m, c.S[n++] = l; } c = a.O; d = 0; @@ -186,40 +189,44 @@ var Module = function(D = {}) { } f.shaderSource(u[a], e); }, - x: (a, b, c, d, e, h, k, n, m) => { - var q = f, T = q.texImage2D; - if (m) { - var l = n - 5120; - l = 0 == l ? F : 1 == l ? r : 2 == l ? G : 4 == l ? g : 6 == l ? x : 5 == l || 28922 == l || 28520 == l || 30779 == l || 30782 == l ? v : H; - var C = 31 - Math.clz32(l.BYTES_PER_ELEMENT); - m = l.subarray(m >> C, m + e * (d * (({ - 5: 3, - 6: 4, - 8: 2, - 29502: 3, - 29504: 4, - 26917: 2, - 26918: 2, - 29846: 3, - 29847: 4 - }[k - 6402] || 1) << C) + 4 - 1 & -4) >> C); - } else m = null; - T.call(q, a, b, c, d, e, h, k, n, m); + x: (a, b, c, d, e, h, k, m, l) => { + if (2 <= r.version) if (f.V) f.texImage2D(a, b, c, d, e, h, k, m, l); else if (l) { + var n = N(m); + f.texImage2D(a, b, c, d, e, h, k, m, n, l >> 31 - Math.clz32(n.BYTES_PER_ELEMENT)); + } else f.texImage2D(a, b, c, d, e, h, k, m, null); else { + n = f; + var U = n.texImage2D; + if (l) { + var P = N(m), C = 31 - Math.clz32(P.BYTES_PER_ELEMENT); + l = P.subarray(l >> C, l + e * (d * (({ + 5: 3, + 6: 4, + 8: 2, + 29502: 3, + 29504: 4, + 26917: 2, + 26918: 2, + 29846: 3, + 29847: 4 + }[k - 6402] || 1) << C) + 4 - 1 & -4) >> C); + } else l = null; + U.call(n, a, b, c, d, e, h, k, m, l); + } }, a: function(a, b, c) { f.texParameteri(a, b, c); }, q: (a, b, c, d, e) => { - f.uniform4f(N(a), b, c, d, e); + f.uniform4f(B(a), b, c, d, e); }, r: (a, b, c, d) => { - b = x.subarray(d >> 2, d + 64 * b >> 2); - f.uniformMatrix4fv(N(a), !!c, b); + 2 <= r.version ? b && f.uniformMatrix4fv(B(a), !!c, w, d >> 2, 16 * b) : (b = w.subarray(d >> 2, d + 64 * b >> 2), + f.uniformMatrix4fv(B(a), !!c, b)); }, G: a => { a = p[a]; f.useProgram(a); - f.V = a; + f.W = a; }, A: (a, b, c, d, e, h) => { f.vertexAttribPointer(a, b, c, !!d, e, h); @@ -259,11 +266,11 @@ var Module = function(D = {}) { var b = I.buffer; F = new Int8Array(b); G = new Int16Array(b); - r = new Uint8Array(b); + q = new Uint8Array(b); H = new Uint16Array(b); g = new Int32Array(b); v = new Uint32Array(b); - x = new Float32Array(b); + w = new Float32Array(b); a.L(); O(); })); diff --git a/test/code_size/hello_webgl2_wasm.json b/test/code_size/hello_webgl2_wasm.json index 50b836d2d7423..6350888f64127 100644 --- a/test/code_size/hello_webgl2_wasm.json +++ b/test/code_size/hello_webgl2_wasm.json @@ -1,10 +1,10 @@ { "a.html": 569, "a.html.gz": 379, - "a.js": 4369, - "a.js.gz": 2328, + "a.js": 4698, + "a.js.gz": 2416, "a.wasm": 10482, "a.wasm.gz": 6713, - "total": 15420, - "total_gz": 9420 + "total": 15749, + "total_gz": 9508 } diff --git a/test/code_size/hello_webgl2_wasm2js.json b/test/code_size/hello_webgl2_wasm2js.json index 178d70f95d0d5..5d7c78e3896ed 100644 --- a/test/code_size/hello_webgl2_wasm2js.json +++ b/test/code_size/hello_webgl2_wasm2js.json @@ -1,10 +1,10 @@ { "a.html": 567, "a.html.gz": 379, - "a.js": 17650, - "a.js.gz": 7956, + "a.js": 17986, + "a.js.gz": 8049, "a.mem": 3171, "a.mem.gz": 2713, - "total": 21388, - "total_gz": 11048 + "total": 21724, + "total_gz": 11141 }