Skip to content

Commit e97af5a

Browse files
committed
Rebaseline
1 parent 7d48ac1 commit e97af5a

11 files changed

+579
-33
lines changed

test/code_size/hello_webgl2_wasm.js

+271
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,271 @@
1+
var Module = function(D = {}) {
2+
function E(a) {
3+
f.pixelStorei(37440, !0);
4+
f.texImage2D(3553, 0, 6408, 6408, 5121, a);
5+
f.pixelStorei(37440, !1);
6+
}
7+
var F, G, g, r, H, v, x, I, J, P = new TextDecoder("utf8"), t = (a, b) => {
8+
if (!a) return "";
9+
b = a + b;
10+
for (var c = a; !(c >= b) && r[c]; ) ++c;
11+
return P.decode(r.subarray(a, c));
12+
}, Q = [ 0, document, window ], y = a => {
13+
a = 2 < a ? t(a) : a;
14+
return Q[a] || document.querySelector(a);
15+
}, R = 1, K = [], p = [], z = [], u = [], A = [], w = a => {
16+
for (var b = R++, c = a.length; c < b; c++) a[c] = null;
17+
return b;
18+
}, B, S = [ "default", "low-power", "high-performance" ], L = (a, b, c, d) => {
19+
for (var e = 0; e < a; e++) {
20+
var h = f[c](), k = h && w(d);
21+
h && (h.name = k, d[k] = h);
22+
g[b + 4 * e >> 2] = k;
23+
}
24+
}, M = a => "]" == a.slice(-1) && a.lastIndexOf("["), N = a => {
25+
var b = f.V, c = b.O[a];
26+
"number" == typeof c && (b.O[a] = c = f.getUniformLocation(b, b.S[a] + (0 < c ? "[" + c + "]" : "")));
27+
return c;
28+
}, f, O;
29+
WebAssembly.instantiate(D.wasm, {
30+
a: {
31+
z: () => devicePixelRatio,
32+
b: () => Math.random(),
33+
J: (a, b) => {
34+
function c(d) {
35+
J.get(a)(d, b) && requestAnimationFrame(c);
36+
}
37+
return requestAnimationFrame(c);
38+
},
39+
k: () => !1,
40+
j: (a, b, c) => {
41+
a = y(a);
42+
if (!a) return -4;
43+
a.width = b;
44+
a.height = c;
45+
return 0;
46+
},
47+
p: (a, b, c) => {
48+
a = y(a);
49+
if (!a) return -4;
50+
a.style.width = b + "px";
51+
a.style.height = c + "px";
52+
return 0;
53+
},
54+
h: (a, b) => {
55+
b >>= 2;
56+
b = {
57+
alpha: !!g[b],
58+
depth: !!g[b + 1],
59+
stencil: !!g[b + 2],
60+
antialias: !!g[b + 3],
61+
premultipliedAlpha: !!g[b + 4],
62+
preserveDrawingBuffer: !!g[b + 5],
63+
powerPreference: S[g[b + 6]],
64+
failIfMajorPerformanceCaveat: !!g[b + 7],
65+
R: g[b + 8],
66+
ea: g[b + 9],
67+
aa: g[b + 10],
68+
W: g[b + 11],
69+
fa: g[b + 12],
70+
ga: g[b + 13]
71+
};
72+
a = y(a);
73+
if (!a || b.W) b = 0; else if (a = 1 < b.R ? a.getContext("webgl2", b) : a.getContext("webgl", b)) {
74+
var c = w(A);
75+
b = {
76+
handle: c,
77+
attributes: b,
78+
version: b.R,
79+
U: a
80+
};
81+
a.canvas && (a.canvas.X = b);
82+
A[c] = b;
83+
b = c;
84+
} else b = 0;
85+
return b;
86+
},
87+
i: a => {
88+
a >>= 2;
89+
for (var b = 0; 14 > b; ++b) g[a + b] = 0;
90+
g[a] = g[a + 1] = g[a + 3] = g[a + 4] = g[a + 8] = g[a + 10] = 1;
91+
},
92+
g: a => {
93+
B = A[a];
94+
D.Y = f = B && B.U;
95+
return !a || f ? 0 : -5;
96+
},
97+
c: (a, b) => {
98+
f.attachShader(p[a], u[b]);
99+
},
100+
I: (a, b, c) => {
101+
f.bindAttribLocation(p[a], b, t(c));
102+
},
103+
C: (a, b) => {
104+
35051 == a ? f.Z = b : 35052 == a && (f.$ = b);
105+
f.bindBuffer(a, K[b]);
106+
},
107+
d: (a, b) => {
108+
f.bindTexture(a, z[b]);
109+
},
110+
E: function(a, b) {
111+
f.blendFunc(a, b);
112+
},
113+
B: (a, b, c, d) => {
114+
f.bufferData(a, c ? r.subarray(c, c + b) : b, d);
115+
},
116+
s: function(a) {
117+
f.clear(a);
118+
},
119+
t: function(a, b, c, d) {
120+
f.clearColor(a, b, c, d);
121+
},
122+
u: a => {
123+
f.compileShader(u[a]);
124+
},
125+
f: () => {
126+
var a = w(p), b = f.createProgram();
127+
b.name = a;
128+
b.da = b.ba = b.ca = 0;
129+
b.P = 1;
130+
p[a] = b;
131+
return a;
132+
},
133+
w: a => {
134+
var b = w(u);
135+
u[b] = f.createShader(a);
136+
return b;
137+
},
138+
o: (a, b, c) => {
139+
f.drawArrays(a, b, c);
140+
},
141+
F: function(a) {
142+
f.enable(a);
143+
},
144+
y: a => {
145+
f.enableVertexAttribArray(a);
146+
},
147+
D: (a, b) => {
148+
L(a, b, "createBuffer", K);
149+
},
150+
l: (a, b) => {
151+
L(a, b, "createTexture", z);
152+
},
153+
e: (a, b) => {
154+
b = t(b);
155+
if (a = p[a]) {
156+
var c = a, d = c.O, e = c.T, h;
157+
if (!d) for (c.O = d = {}, c.S = {}, h = 0; h < f.getProgramParameter(c, 35718); ++h) {
158+
var k = f.getActiveUniform(c, h), n = k.name;
159+
k = k.size;
160+
var m = M(n);
161+
m = 0 < m ? n.slice(0, m) : n;
162+
var q = c.P;
163+
c.P += k;
164+
e[m] = [ k, q ];
165+
for (n = 0; n < k; ++n) d[q] = n, c.S[q++] = m;
166+
}
167+
c = a.O;
168+
d = 0;
169+
e = b;
170+
h = M(b);
171+
0 < h && (d = parseInt(b.slice(h + 1)) >>> 0, e = b.slice(0, h));
172+
if ((e = a.T[e]) && d < e[0] && (d += e[1], c[d] = c[d] || f.getUniformLocation(a, b))) return d;
173+
}
174+
return -1;
175+
},
176+
H: a => {
177+
a = p[a];
178+
f.linkProgram(a);
179+
a.O = 0;
180+
a.T = {};
181+
},
182+
v: (a, b, c, d) => {
183+
for (var e = "", h = 0; h < b; ++h) {
184+
var k = d ? g[d + 4 * h >> 2] : -1;
185+
e += t(g[c + 4 * h >> 2], 0 > k ? void 0 : k);
186+
}
187+
f.shaderSource(u[a], e);
188+
},
189+
x: (a, b, c, d, e, h, k, n, m) => {
190+
var q = f, T = q.texImage2D;
191+
if (m) {
192+
var l = n - 5120;
193+
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;
194+
var C = 31 - Math.clz32(l.BYTES_PER_ELEMENT);
195+
m = l.subarray(m >> C, m + e * (d * (({
196+
5: 3,
197+
6: 4,
198+
8: 2,
199+
29502: 3,
200+
29504: 4,
201+
26917: 2,
202+
26918: 2,
203+
29846: 3,
204+
29847: 4
205+
}[k - 6402] || 1) << C) + 4 - 1 & -4) >> C);
206+
} else m = null;
207+
T.call(q, a, b, c, d, e, h, k, n, m);
208+
},
209+
a: function(a, b, c) {
210+
f.texParameteri(a, b, c);
211+
},
212+
q: (a, b, c, d, e) => {
213+
f.uniform4f(N(a), b, c, d, e);
214+
},
215+
r: (a, b, c, d) => {
216+
b = x.subarray(d >> 2, d + 64 * b >> 2);
217+
f.uniformMatrix4fv(N(a), !!c, b);
218+
},
219+
G: a => {
220+
a = p[a];
221+
f.useProgram(a);
222+
f.V = a;
223+
},
224+
A: (a, b, c, d, e, h) => {
225+
f.vertexAttribPointer(a, b, c, !!d, e, h);
226+
},
227+
n: function(a, b, c, d) {
228+
var e = new Image;
229+
e.onload = () => {
230+
v[c >> 2] = e.width;
231+
v[d >> 2] = e.height;
232+
f.bindTexture(3553, z[a]);
233+
E(e);
234+
};
235+
e.src = t(b);
236+
},
237+
m: function(a, b, c) {
238+
var d = document.createElement("canvas");
239+
d.width = d.height = b;
240+
var e = d.getContext("2d");
241+
e.fillStyle = "black";
242+
e.globalCompositeOperator = "copy";
243+
e.globalAlpha = 0;
244+
e.fillRect(0, 0, d.width, d.height);
245+
e.globalAlpha = 1;
246+
e.fillStyle = "white";
247+
e.font = b + "px Arial Unicode";
248+
c && (e.shadowColor = "black", e.shadowOffsetX = 2, e.shadowOffsetY = 2, e.shadowBlur = 3,
249+
e.strokeStyle = "gray", e.strokeText(String.fromCharCode(a), 0, d.height - 7));
250+
e.fillText(String.fromCharCode(a), 0, d.height - 7);
251+
E(d);
252+
}
253+
}
254+
}).then((a => {
255+
a = a.instance.exports;
256+
O = a.M;
257+
J = a.N;
258+
I = a.K;
259+
var b = I.buffer;
260+
F = new Int8Array(b);
261+
G = new Int16Array(b);
262+
r = new Uint8Array(b);
263+
H = new Uint16Array(b);
264+
g = new Int32Array(b);
265+
v = new Uint32Array(b);
266+
x = new Float32Array(b);
267+
a.L();
268+
O();
269+
}));
270+
return {};
271+
};

test/code_size/hello_webgl2_wasm.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"a.html": 569,
33
"a.html.gz": 379,
4-
"a.js": 4700,
5-
"a.js.gz": 2417,
6-
"a.wasm": 10479,
4+
"a.js": 4369,
5+
"a.js.gz": 2328,
6+
"a.wasm": 10482,
77
"a.wasm.gz": 6713,
8-
"total": 15748,
9-
"total_gz": 9509
8+
"total": 15420,
9+
"total_gz": 9420
1010
}
+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"a.html": 567,
33
"a.html.gz": 379,
4-
"a.js": 17975,
5-
"a.js.gz": 8044,
4+
"a.js": 17650,
5+
"a.js.gz": 7956,
66
"a.mem": 3171,
77
"a.mem.gz": 2713,
8-
"total": 21713,
9-
"total_gz": 11136
8+
"total": 21388,
9+
"total_gz": 11048
1010
}

0 commit comments

Comments
 (0)