xbintsc 0.5.32 → 0.5.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -7
- package/README.zh-CN.md +10 -8
- package/dist/scripts/check-version.d.ts +27 -0
- package/dist/scripts/check-version.js +71 -0
- package/dist/scripts/check-version.js.map +1 -0
- package/dist/scripts/package-platform.d.ts +58 -0
- package/dist/scripts/package-platform.js +142 -0
- package/dist/scripts/package-platform.js.map +1 -0
- package/dist/scripts/verify-platform-package.d.ts +34 -0
- package/dist/scripts/verify-platform-package.js +161 -0
- package/dist/scripts/verify-platform-package.js.map +1 -0
- package/dist/src/cli/help.d.ts +1 -1
- package/dist/src/cli/main.js +3 -1
- package/dist/src/cli/main.js.map +1 -1
- package/dist/src/driver/runtime-lib.d.ts +29 -4
- package/dist/src/driver/runtime-lib.js +68 -10
- package/dist/src/driver/runtime-lib.js.map +1 -1
- package/dist/src/driver/version.d.ts +1 -1
- package/dist/src/driver/version.js +1 -1
- package/dist/src/extensions/gui/index.js +18 -5
- package/dist/src/extensions/gui/index.js.map +1 -1
- package/dist/src/extensions/media/index.js +4 -3
- package/dist/src/extensions/media/index.js.map +1 -1
- package/dist/src/parser/context.d.ts +41 -0
- package/dist/src/parser/context.js +89 -4
- package/dist/src/parser/context.js.map +1 -1
- package/dist/src/parser/literals.js +6 -12
- package/dist/src/parser/literals.js.map +1 -1
- package/dist/tests/driver/platform-package.test.d.ts +1 -0
- package/dist/tests/driver/platform-package.test.js +49 -0
- package/dist/tests/driver/platform-package.test.js.map +1 -0
- package/dist/tests/driver/runtime-lib.test.js +51 -4
- package/dist/tests/driver/runtime-lib.test.js.map +1 -1
- package/dist/tests/e2e/gui-audio.test.d.ts +14 -0
- package/dist/tests/e2e/gui-audio.test.js +287 -0
- package/dist/tests/e2e/gui-audio.test.js.map +1 -0
- package/dist/tests/e2e/gui-browser.test.js +65 -0
- package/dist/tests/e2e/gui-browser.test.js.map +1 -1
- package/dist/tests/e2e/gui-canvas-args.test.d.ts +6 -0
- package/dist/tests/e2e/gui-canvas-args.test.js +217 -0
- package/dist/tests/e2e/gui-canvas-args.test.js.map +1 -0
- package/dist/tests/e2e/gui-canvas.test.js.map +1 -1
- package/dist/tests/e2e/gui-dom.test.js +215 -0
- package/dist/tests/e2e/gui-dom.test.js.map +1 -1
- package/dist/tests/e2e/gui-events.test.js +112 -0
- package/dist/tests/e2e/gui-events.test.js.map +1 -1
- package/dist/tests/e2e/gui-helpers.d.ts +7 -0
- package/dist/tests/e2e/gui-helpers.js +1 -0
- package/dist/tests/e2e/gui-helpers.js.map +1 -1
- package/dist/tests/e2e/gui-media.test.js +78 -0
- package/dist/tests/e2e/gui-media.test.js.map +1 -1
- package/dist/tests/e2e/gui-style.test.js +55 -0
- package/dist/tests/e2e/gui-style.test.js.map +1 -1
- package/dist/tests/e2e/gui-webgl.test.js +258 -0
- package/dist/tests/e2e/gui-webgl.test.js.map +1 -1
- package/dist/tests/e2e/gui-webgl2-3d.test.d.ts +4 -0
- package/dist/tests/e2e/gui-webgl2-3d.test.js +264 -0
- package/dist/tests/e2e/gui-webgl2-3d.test.js.map +1 -0
- package/dist/tests/e2e/gui-webgl2-blit.test.d.ts +10 -0
- package/dist/tests/e2e/gui-webgl2-blit.test.js +262 -0
- package/dist/tests/e2e/gui-webgl2-blit.test.js.map +1 -0
- package/dist/tests/e2e/gui-webgl2-formats.test.d.ts +6 -0
- package/dist/tests/e2e/gui-webgl2-formats.test.js +395 -0
- package/dist/tests/e2e/gui-webgl2-formats.test.js.map +1 -0
- package/dist/tests/e2e/gui-webgl2-mrt.test.d.ts +4 -0
- package/dist/tests/e2e/gui-webgl2-mrt.test.js +105 -0
- package/dist/tests/e2e/gui-webgl2-mrt.test.js.map +1 -0
- package/dist/tests/e2e/gui-webgl2-ubo.test.d.ts +8 -0
- package/dist/tests/e2e/gui-webgl2-ubo.test.js +112 -0
- package/dist/tests/e2e/gui-webgl2-ubo.test.js.map +1 -0
- package/dist/tests/e2e/gui-webgl2.test.js +45 -1
- package/dist/tests/e2e/gui-webgl2.test.js.map +1 -1
- package/dist/tests/extensions/gui-index.test.js +1 -0
- package/dist/tests/extensions/gui-index.test.js.map +1 -1
- package/dist/tests/extensions/media.test.js +1 -0
- package/dist/tests/extensions/media.test.js.map +1 -1
- package/dist/tests/parser/expressions.test.js +30 -0
- package/dist/tests/parser/expressions.test.js.map +1 -1
- package/dist/tests/platform-tarball.test.d.ts +1 -0
- package/dist/tests/platform-tarball.test.js +111 -0
- package/dist/tests/platform-tarball.test.js.map +1 -0
- package/dist/tests/version.test.js +6 -0
- package/dist/tests/version.test.js.map +1 -1
- package/doc/ai/contributing.md +11 -0
- package/doc/ai/extensions.md +7 -4
- package/doc/ai/troubleshooting.md +7 -5
- package/doc/ai/zh-CN/contributing.md +9 -0
- package/doc/ai/zh-CN/extensions.md +4 -2
- package/doc/ai/zh-CN/troubleshooting.md +5 -3
- package/doc/gui/api.md +99 -22
- package/doc/gui/build.md +11 -4
- package/doc/gui/canvas.md +49 -18
- package/doc/gui/dom.md +57 -7
- package/doc/gui/media.md +4 -0
- package/doc/gui/webgl.md +105 -46
- package/doc/gui.md +7 -3
- package/doc/npm-package.md +55 -27
- package/doc/requirements.md +6 -2
- package/doc/zh-CN/gui/api.md +84 -14
- package/doc/zh-CN/gui/build.md +7 -2
- package/doc/zh-CN/gui/canvas.md +44 -19
- package/doc/zh-CN/gui/dom.md +48 -4
- package/doc/zh-CN/gui/media.md +3 -0
- package/doc/zh-CN/gui/webgl.md +22 -16
- package/doc/zh-CN/gui.md +3 -2
- package/doc/zh-CN/npm-package.md +44 -23
- package/doc/zh-CN/requirements.md +4 -1
- package/package.json +17 -1
- package/runtime/ext_gui/audio.cpp +365 -153
- package/runtime/ext_gui/audio_buffer.cpp +166 -0
- package/runtime/ext_gui/audio_buffer.h +37 -0
- package/runtime/ext_gui/audio_decode.cpp +219 -0
- package/runtime/ext_gui/audio_decode.h +39 -0
- package/runtime/ext_gui/audio_device.cpp +87 -0
- package/runtime/ext_gui/audio_effects.cpp +163 -0
- package/runtime/ext_gui/audio_effects.h +25 -0
- package/runtime/ext_gui/audio_internal.h +30 -0
- package/runtime/ext_gui/audio_mixer.cpp +494 -0
- package/runtime/ext_gui/audio_mixer.h +238 -0
- package/runtime/ext_gui/audio_param.cpp +104 -0
- package/runtime/ext_gui/audio_param_object.cpp +155 -0
- package/runtime/ext_gui/browser.cpp +45 -50
- package/runtime/ext_gui/browser_abort.cpp +249 -0
- package/runtime/ext_gui/browser_dialogs.cpp +76 -0
- package/runtime/ext_gui/browser_media.cpp +176 -0
- package/runtime/ext_gui/browser_navigation.cpp +130 -0
- package/runtime/ext_gui/canvas.cpp +88 -30
- package/runtime/ext_gui/canvas.h +74 -9
- package/runtime/ext_gui/canvas_image_data.cpp +143 -0
- package/runtime/ext_gui/canvas_internal.h +8 -5
- package/runtime/ext_gui/canvas_pattern.cpp +90 -0
- package/runtime/ext_gui/canvas_raster.cpp +31 -9
- package/runtime/ext_gui/canvas_style.cpp +4 -2
- package/runtime/ext_gui/css_selector.cpp +21 -3
- package/runtime/ext_gui/dom.h +4 -0
- package/runtime/ext_gui/dom_api.cpp +1 -0
- package/runtime/ext_gui/dom_api_canvas.cpp +120 -114
- package/runtime/ext_gui/dom_api_canvas_extra.cpp +57 -2
- package/runtime/ext_gui/dom_api_canvas_image.cpp +239 -0
- package/runtime/ext_gui/dom_api_canvas_paths.cpp +179 -0
- package/runtime/ext_gui/dom_api_computed_style.cpp +124 -0
- package/runtime/ext_gui/dom_api_dataset.cpp +154 -0
- package/runtime/ext_gui/dom_api_document.cpp +58 -5
- package/runtime/ext_gui/dom_api_events.cpp +93 -17
- package/runtime/ext_gui/dom_api_internal.h +71 -2
- package/runtime/ext_gui/dom_api_mutation.cpp +159 -0
- package/runtime/ext_gui/dom_api_node.cpp +40 -19
- package/runtime/ext_gui/dom_api_node_read.cpp +37 -1
- package/runtime/ext_gui/dom_api_path2d.cpp +358 -0
- package/runtime/ext_gui/dom_api_proto.cpp +35 -0
- package/runtime/ext_gui/dom_api_style.cpp +223 -13
- package/runtime/ext_gui/dom_api_webgl.cpp +7 -0
- package/runtime/ext_gui/dom_api_webgl2.cpp +151 -36
- package/runtime/ext_gui/dom_api_webgl2_draw.cpp +3 -3
- package/runtime/ext_gui/dom_api_webgl_buffer.cpp +6 -2
- package/runtime/ext_gui/dom_api_webgl_compressed.cpp +167 -0
- package/runtime/ext_gui/dom_api_webgl_framebuffer.cpp +160 -0
- package/runtime/ext_gui/dom_api_webgl_shader.cpp +4 -4
- package/runtime/ext_gui/dom_api_webgl_source.cpp +161 -0
- package/runtime/ext_gui/dom_api_webgl_state.cpp +169 -23
- package/runtime/ext_gui/dom_api_webgl_texture.cpp +276 -236
- package/runtime/ext_gui/dom_api_webgl_ubo.cpp +81 -0
- package/runtime/ext_gui/gui.cpp +103 -14
- package/runtime/ext_gui/gui_engine.h +56 -4
- package/runtime/ext_gui/gui_events.cpp +80 -9
- package/runtime/ext_gui/image_bitmap.cpp +28 -0
- package/runtime/ext_gui/image_bitmap.h +26 -0
- package/runtime/ext_gui/image_bitmap_browser.cpp +136 -0
- package/runtime/ext_gui/listener_options.h +43 -0
- package/runtime/ext_gui/media.cpp +32 -0
- package/runtime/ext_gui/media.h +13 -0
- package/runtime/ext_gui/media_api.h +23 -0
- package/runtime/ext_gui/paint.cpp +28 -0
- package/runtime/ext_gui/paint.h +4 -0
- package/runtime/ext_gui/webgl.h +152 -18
- package/runtime/ext_gui/webgl_blit.cpp +95 -0
- package/runtime/ext_gui/webgl_buffer.cpp +178 -263
- package/runtime/ext_gui/webgl_buffer_objects.cpp +270 -0
- package/runtime/ext_gui/webgl_clear.cpp +142 -0
- package/runtime/ext_gui/webgl_compressed.cpp +180 -0
- package/runtime/ext_gui/webgl_context.cpp +241 -156
- package/runtime/ext_gui/webgl_draw.cpp +68 -3
- package/runtime/ext_gui/webgl_draw_buffers.cpp +75 -0
- package/runtime/ext_gui/webgl_glsl.h +40 -0
- package/runtime/ext_gui/webgl_glsl_compile.cpp +6 -0
- package/runtime/ext_gui/webgl_glsl_rewrite.cpp +18 -0
- package/runtime/ext_gui/webgl_glsl_scan.cpp +20 -11
- package/runtime/ext_gui/webgl_glsl_scan_block.cpp +126 -0
- package/runtime/ext_gui/webgl_glsl_tokens.h +28 -0
- package/runtime/ext_gui/webgl_pipeline.cpp +71 -19
- package/runtime/ext_gui/webgl_program_blocks.cpp +58 -0
- package/runtime/ext_gui/webgl_program_internal.h +6 -0
- package/runtime/ext_gui/webgl_shader.cpp +13 -1
- package/runtime/ext_gui/webgl_state.cpp +228 -0
- package/runtime/ext_gui/webgl_texture.cpp +144 -17
- package/runtime/ext_gui/webgl_texture_3d.cpp +215 -0
- package/runtime/ext_gui/webgl_uniform_block.h +31 -0
- package/runtime/ext_gui/webgl_webgl2.cpp +58 -5
- package/runtime/ext_gui/window.cpp +14 -65
- package/runtime/ext_gui/window_events.cpp +125 -0
- package/runtime/ext_media/decode_audio.cpp +308 -0
- package/runtime/ext_media/media_bridge.c +2 -0
- package/runtime/rt.h +43 -0
- package/runtime/rt_internal.h +4 -0
- package/runtime/xt_array_buffer.c +30 -0
- package/runtime/xt_builtins.c +0 -21
- package/runtime/xt_containers/access.inc +94 -2
- package/runtime/xt_containers/objects.inc +29 -31
- package/runtime/xt_typed_array/elements.inc +13 -0
- package/scripts/build-media.ts +14 -6
- package/scripts/build-runtime.ts +21 -16
- package/scripts/check-version.ts +39 -9
- package/scripts/package-platform.ts +183 -0
- package/scripts/set-platform-version.ts +62 -0
- package/scripts/verify-platform-package.ts +182 -0
- package/src/cli/main.ts +5 -1
- package/src/driver/runtime-lib.ts +73 -9
- package/src/driver/version.ts +1 -1
- package/src/extensions/gui/index.ts +18 -5
- package/src/extensions/media/index.ts +4 -3
- package/src/parser/context.ts +99 -4
- package/src/parser/literals.ts +6 -12
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* End-to-end tests for the WebGL 2 format additions: stencil, float/depth
|
|
3
|
+
* textures, `ImageBitmap` uploads and compressed textures. Framebuffer blits
|
|
4
|
+
* and scissored clears live in `gui-webgl2-blit.test.ts`.
|
|
5
|
+
*/
|
|
6
|
+
import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
|
7
|
+
import { createGuiHarness, guiAvailable } from "./gui-helpers.js";
|
|
8
|
+
const harness = createGuiHarness();
|
|
9
|
+
const PAGE = `
|
|
10
|
+
<html><head><title>webgl2-formats</title></head>
|
|
11
|
+
<body style="margin:0">
|
|
12
|
+
<canvas id="c" width="64" height="64"></canvas>
|
|
13
|
+
</body></html>`;
|
|
14
|
+
/**
|
|
15
|
+
* Compare a `readPixels` result with the expected RGBA bytes. Byte values that
|
|
16
|
+
* came from a float or UNORM conversion differ by one or two between GPU
|
|
17
|
+
* backends, so exact equality is only used for values written as bytes.
|
|
18
|
+
*/
|
|
19
|
+
function near(actual, expected, tolerance) {
|
|
20
|
+
const parts = actual.split(",").map((part) => Number(part));
|
|
21
|
+
expect(parts.length).toBe(expected.length);
|
|
22
|
+
for (let i = 0; i < expected.length; i++) {
|
|
23
|
+
const actual = parts[i] ?? Number.POSITIVE_INFINITY;
|
|
24
|
+
const want = expected[i] ?? Number.POSITIVE_INFINITY;
|
|
25
|
+
expect(Math.abs(actual - want)).toBeLessThanOrEqual(tolerance);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
describe.skipIf(!guiAvailable)("gui extension — WebGL 2 formats", () => {
|
|
29
|
+
beforeAll(() => harness.setup());
|
|
30
|
+
afterAll(() => harness.cleanup());
|
|
31
|
+
it("supports stencil operations, float textures and depth textures", () => {
|
|
32
|
+
const { value, stderr } = harness.compileAndRun("webgl2-formats", `
|
|
33
|
+
import { createWindow } from "gui";
|
|
34
|
+
import page from "./page.html";
|
|
35
|
+
|
|
36
|
+
const win = createWindow({ title: "formats", width: 320, height: 240 });
|
|
37
|
+
const label = (name: string, value: any): void => console.log(name + "=" + value);
|
|
38
|
+
|
|
39
|
+
win.on("ready", () => {
|
|
40
|
+
const canvas: any = document.getElementById("c");
|
|
41
|
+
const gl: any = canvas.getContext("webgl2");
|
|
42
|
+
if (gl == null) {
|
|
43
|
+
console.log("webgl2=false");
|
|
44
|
+
win.close();
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const px = new Uint8Array(4);
|
|
48
|
+
const probe = (): string => {
|
|
49
|
+
gl.readPixels(32, 32, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, px);
|
|
50
|
+
return px[0] + "," + px[1] + "," + px[2] + "," + px[3];
|
|
51
|
+
};
|
|
52
|
+
label("stencil-bits", gl.getParameter(gl.STENCIL_BITS));
|
|
53
|
+
label("stencil-attr", gl.getContextAttributes().stencil);
|
|
54
|
+
|
|
55
|
+
const vs: any = gl.createShader(gl.VERTEX_SHADER);
|
|
56
|
+
gl.shaderSource(vs, "#version 300 es\\n" +
|
|
57
|
+
"in vec2 a_pos; uniform float u_z;" +
|
|
58
|
+
"void main() { gl_Position = vec4(a_pos, u_z, 1.0); }");
|
|
59
|
+
gl.compileShader(vs);
|
|
60
|
+
const fs: any = gl.createShader(gl.FRAGMENT_SHADER);
|
|
61
|
+
gl.shaderSource(fs, "#version 300 es\\n" +
|
|
62
|
+
"precision highp float; uniform vec4 u_color; out vec4 fragColor;" +
|
|
63
|
+
"void main() { fragColor = u_color; }");
|
|
64
|
+
gl.compileShader(fs);
|
|
65
|
+
const flat: any = gl.createProgram();
|
|
66
|
+
gl.attachShader(flat, vs);
|
|
67
|
+
gl.attachShader(flat, fs);
|
|
68
|
+
gl.linkProgram(flat);
|
|
69
|
+
label("flat-link", gl.getProgramParameter(flat, gl.LINK_STATUS) === true);
|
|
70
|
+
|
|
71
|
+
const quad = gl.createBuffer();
|
|
72
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, quad);
|
|
73
|
+
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
|
|
74
|
+
-1, -1, 3, -1, -1, 3,
|
|
75
|
+
]), gl.STATIC_DRAW);
|
|
76
|
+
gl.useProgram(flat);
|
|
77
|
+
const pos: any = gl.getAttribLocation(flat, "a_pos");
|
|
78
|
+
gl.enableVertexAttribArray(pos);
|
|
79
|
+
gl.vertexAttribPointer(pos, 2, gl.FLOAT, false, 8, 0);
|
|
80
|
+
gl.uniform1f(gl.getUniformLocation(flat, "u_z"), 0.0);
|
|
81
|
+
const flat_color: any = gl.getUniformLocation(flat, "u_color");
|
|
82
|
+
|
|
83
|
+
// --- stencil -------------------------------------------------------
|
|
84
|
+
gl.viewport(0, 0, 64, 64);
|
|
85
|
+
gl.clearColor(0, 0, 0, 1);
|
|
86
|
+
gl.clearStencil(0);
|
|
87
|
+
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT);
|
|
88
|
+
gl.enable(gl.STENCIL_TEST);
|
|
89
|
+
gl.stencilMask(255);
|
|
90
|
+
gl.stencilFunc(gl.ALWAYS, 1, 255);
|
|
91
|
+
gl.stencilOp(gl.KEEP, gl.KEEP, gl.REPLACE);
|
|
92
|
+
gl.uniform4f(flat_color, 1, 1, 1, 1);
|
|
93
|
+
gl.drawArrays(gl.TRIANGLES, 0, 3);
|
|
94
|
+
gl.stencilFunc(gl.EQUAL, 1, 255);
|
|
95
|
+
gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP);
|
|
96
|
+
gl.uniform4f(flat_color, 1, 0, 0, 1);
|
|
97
|
+
gl.drawArrays(gl.TRIANGLES, 0, 3);
|
|
98
|
+
label("stencil-red", probe());
|
|
99
|
+
gl.stencilFunc(gl.EQUAL, 0, 255);
|
|
100
|
+
gl.uniform4f(flat_color, 0, 1, 0, 1);
|
|
101
|
+
gl.drawArrays(gl.TRIANGLES, 0, 3);
|
|
102
|
+
label("stencil-blocked", probe());
|
|
103
|
+
gl.clear(gl.COLOR_BUFFER_BIT | gl.STENCIL_BUFFER_BIT);
|
|
104
|
+
gl.stencilFunc(gl.EQUAL, 1, 255);
|
|
105
|
+
gl.drawArrays(gl.TRIANGLES, 0, 3);
|
|
106
|
+
label("stencil-cleared", probe());
|
|
107
|
+
gl.disable(gl.STENCIL_TEST);
|
|
108
|
+
|
|
109
|
+
// --- float texture sampling ---------------------------------------
|
|
110
|
+
const sample_vs: any = gl.createShader(gl.VERTEX_SHADER);
|
|
111
|
+
gl.shaderSource(sample_vs, "#version 300 es\\n" +
|
|
112
|
+
"in vec2 a_pos; out vec2 v_uv;" +
|
|
113
|
+
"void main() { v_uv = a_pos * 0.5 + 0.5;" +
|
|
114
|
+
" gl_Position = vec4(a_pos, 0.0, 1.0); }");
|
|
115
|
+
gl.compileShader(sample_vs);
|
|
116
|
+
const sample_fs: any = gl.createShader(gl.FRAGMENT_SHADER);
|
|
117
|
+
gl.shaderSource(sample_fs, "#version 300 es\\n" +
|
|
118
|
+
"precision highp float; in vec2 v_uv; uniform sampler2D u_tex;" +
|
|
119
|
+
"out vec4 fragColor;" +
|
|
120
|
+
"void main() { fragColor = texture(u_tex, v_uv); }");
|
|
121
|
+
gl.compileShader(sample_fs);
|
|
122
|
+
const sample: any = gl.createProgram();
|
|
123
|
+
gl.attachShader(sample, sample_vs);
|
|
124
|
+
gl.attachShader(sample, sample_fs);
|
|
125
|
+
gl.linkProgram(sample);
|
|
126
|
+
label("sample-link", gl.getProgramParameter(sample, gl.LINK_STATUS) === true);
|
|
127
|
+
|
|
128
|
+
const float_tex = gl.createTexture();
|
|
129
|
+
gl.bindTexture(gl.TEXTURE_2D, float_tex);
|
|
130
|
+
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA16F, 2, 2, 0, gl.RGBA, gl.FLOAT,
|
|
131
|
+
new Float32Array([0.25, 0.5, 0.75, 1, 0.25, 0.5, 0.75, 1,
|
|
132
|
+
0.25, 0.5, 0.75, 1, 0.25, 0.5, 0.75, 1]));
|
|
133
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
|
|
134
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
|
|
135
|
+
gl.useProgram(sample);
|
|
136
|
+
gl.uniform1i(gl.getUniformLocation(sample, "u_tex"), 0);
|
|
137
|
+
gl.clearColor(0, 0, 0, 1);
|
|
138
|
+
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
139
|
+
gl.drawArrays(gl.TRIANGLES, 0, 3);
|
|
140
|
+
label("float-texture", probe());
|
|
141
|
+
|
|
142
|
+
// --- render into an RGBA16F target and sample it -------------------
|
|
143
|
+
const target = gl.createTexture();
|
|
144
|
+
gl.bindTexture(gl.TEXTURE_2D, target);
|
|
145
|
+
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA16F, 32, 32, 0, gl.RGBA, gl.FLOAT, null);
|
|
146
|
+
const fbo = gl.createFramebuffer();
|
|
147
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
|
|
148
|
+
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, target, 0);
|
|
149
|
+
label("float-fbo", gl.checkFramebufferStatus(gl.FRAMEBUFFER) === gl.FRAMEBUFFER_COMPLETE);
|
|
150
|
+
gl.viewport(0, 0, 32, 32);
|
|
151
|
+
gl.clearColor(0.2, 0.4, 0.6, 1);
|
|
152
|
+
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
153
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
154
|
+
gl.viewport(0, 0, 64, 64);
|
|
155
|
+
gl.bindTexture(gl.TEXTURE_2D, target);
|
|
156
|
+
gl.clearColor(0, 0, 0, 1);
|
|
157
|
+
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
158
|
+
gl.drawArrays(gl.TRIANGLES, 0, 3);
|
|
159
|
+
label("float-target", probe());
|
|
160
|
+
|
|
161
|
+
// --- depth texture as a framebuffer depth attachment ---------------
|
|
162
|
+
const depth_tex = gl.createTexture();
|
|
163
|
+
gl.bindTexture(gl.TEXTURE_2D, depth_tex);
|
|
164
|
+
gl.texImage2D(gl.TEXTURE_2D, 0, gl.DEPTH_COMPONENT24, 32, 32, 0,
|
|
165
|
+
gl.DEPTH_COMPONENT, gl.UNSIGNED_INT, null);
|
|
166
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
|
|
167
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
|
|
168
|
+
const depth_color = gl.createTexture();
|
|
169
|
+
gl.bindTexture(gl.TEXTURE_2D, depth_color);
|
|
170
|
+
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 32, 32, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
|
|
171
|
+
const depth_fbo = gl.createFramebuffer();
|
|
172
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, depth_fbo);
|
|
173
|
+
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, depth_color, 0);
|
|
174
|
+
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.TEXTURE_2D, depth_tex, 0);
|
|
175
|
+
label("depth-fbo", gl.checkFramebufferStatus(gl.FRAMEBUFFER) === gl.FRAMEBUFFER_COMPLETE);
|
|
176
|
+
gl.viewport(0, 0, 32, 32);
|
|
177
|
+
gl.clearColor(0, 0, 0, 1);
|
|
178
|
+
gl.clearDepth(1);
|
|
179
|
+
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
|
|
180
|
+
gl.enable(gl.DEPTH_TEST);
|
|
181
|
+
gl.depthFunc(gl.LESS);
|
|
182
|
+
gl.useProgram(flat);
|
|
183
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, quad);
|
|
184
|
+
gl.enableVertexAttribArray(gl.getAttribLocation(flat, "a_pos"));
|
|
185
|
+
gl.vertexAttribPointer(gl.getAttribLocation(flat, "a_pos"), 2, gl.FLOAT, false, 8, 0);
|
|
186
|
+
gl.uniform1f(gl.getUniformLocation(flat, "u_z"), 0.5);
|
|
187
|
+
gl.uniform4f(flat_color, 1, 1, 1, 1);
|
|
188
|
+
gl.drawArrays(gl.TRIANGLES, 0, 3);
|
|
189
|
+
gl.disable(gl.DEPTH_TEST);
|
|
190
|
+
|
|
191
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
192
|
+
gl.viewport(0, 0, 64, 64);
|
|
193
|
+
const depth_fs: any = gl.createShader(gl.FRAGMENT_SHADER);
|
|
194
|
+
gl.shaderSource(depth_fs, "#version 300 es\\n" +
|
|
195
|
+
"precision highp float; in vec2 v_uv; uniform sampler2D u_tex;" +
|
|
196
|
+
"out vec4 fragColor;" +
|
|
197
|
+
"void main() { fragColor = vec4(vec3(texture(u_tex, v_uv).r), 1.0); }");
|
|
198
|
+
gl.compileShader(depth_fs);
|
|
199
|
+
label("depth-fs", gl.getShaderParameter(depth_fs, gl.COMPILE_STATUS) === true);
|
|
200
|
+
const depth_program: any = gl.createProgram();
|
|
201
|
+
gl.attachShader(depth_program, sample_vs);
|
|
202
|
+
gl.attachShader(depth_program, depth_fs);
|
|
203
|
+
gl.linkProgram(depth_program);
|
|
204
|
+
label("depth-link", gl.getProgramParameter(depth_program, gl.LINK_STATUS) === true);
|
|
205
|
+
gl.useProgram(depth_program);
|
|
206
|
+
gl.uniform1i(gl.getUniformLocation(depth_program, "u_tex"), 0);
|
|
207
|
+
gl.bindTexture(gl.TEXTURE_2D, depth_tex);
|
|
208
|
+
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
209
|
+
gl.drawArrays(gl.TRIANGLES, 0, 3);
|
|
210
|
+
label("depth-pixel", probe());
|
|
211
|
+
label("error", gl.getError());
|
|
212
|
+
win.close();
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
win.loadHTML(page);
|
|
216
|
+
`, { files: { "page.html": PAGE }, autocloseMs: 10000 });
|
|
217
|
+
expect(value("stencil-bits")).toBe("8");
|
|
218
|
+
expect(value("stencil-attr")).toBe("true");
|
|
219
|
+
expect(value("flat-link")).toBe("true");
|
|
220
|
+
expect(value("stencil-red")).toBe("255,0,0,255");
|
|
221
|
+
expect(value("stencil-blocked")).toBe("255,0,0,255");
|
|
222
|
+
expect(value("stencil-cleared")).toBe("0,0,0,255");
|
|
223
|
+
expect(value("sample-link")).toBe("true");
|
|
224
|
+
near(value("float-texture"), [64, 128, 191, 255], 2);
|
|
225
|
+
expect(value("float-fbo")).toBe("true");
|
|
226
|
+
near(value("float-target"), [51, 102, 153, 255], 3);
|
|
227
|
+
expect(value("depth-fbo")).toBe("true");
|
|
228
|
+
expect(value("depth-fs")).toBe("true");
|
|
229
|
+
expect(value("depth-link")).toBe("true");
|
|
230
|
+
// The engine hands GLSL to Vulkan/Metal directly, so the stored depth is
|
|
231
|
+
// the backend's clip-space z (0.5), not GL's remapped (z + 1) / 2 (0.75).
|
|
232
|
+
near(value("depth-pixel"), [128, 128, 128, 255], 4);
|
|
233
|
+
expect(value("error")).toBe("0");
|
|
234
|
+
expect(stderr).not.toContain("pipeline creation failed");
|
|
235
|
+
});
|
|
236
|
+
it("uploads an ImageBitmap created from an ImageData-shaped source", () => {
|
|
237
|
+
const { value, stderr } = harness.compileAndRun("webgl2-bitmap", `
|
|
238
|
+
import { createWindow } from "gui";
|
|
239
|
+
import page from "./page.html";
|
|
240
|
+
|
|
241
|
+
const win = createWindow({ title: "bitmap", width: 320, height: 240 });
|
|
242
|
+
const label = (name: string, value: any): void => console.log(name + "=" + value);
|
|
243
|
+
|
|
244
|
+
win.on("ready", async () => {
|
|
245
|
+
const canvas: any = document.getElementById("c");
|
|
246
|
+
const gl: any = canvas.getContext("webgl2");
|
|
247
|
+
if (gl == null) {
|
|
248
|
+
console.log("webgl2=false");
|
|
249
|
+
win.close();
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
const bitmap: any = await createImageBitmap({
|
|
253
|
+
width: 2,
|
|
254
|
+
height: 2,
|
|
255
|
+
data: new Uint8Array([64, 128, 191, 255, 64, 128, 191, 255,
|
|
256
|
+
64, 128, 191, 255, 64, 128, 191, 255]),
|
|
257
|
+
});
|
|
258
|
+
label("bitmap-size", bitmap.width + "x" + bitmap.height);
|
|
259
|
+
label("bitmap-type", typeof ImageBitmap === "function");
|
|
260
|
+
|
|
261
|
+
const vs: any = gl.createShader(gl.VERTEX_SHADER);
|
|
262
|
+
gl.shaderSource(vs, "#version 300 es\\n" +
|
|
263
|
+
"in vec2 a_pos; out vec2 v_uv;" +
|
|
264
|
+
"void main() { v_uv = a_pos * 0.5 + 0.5;" +
|
|
265
|
+
" gl_Position = vec4(a_pos, 0.0, 1.0); }");
|
|
266
|
+
gl.compileShader(vs);
|
|
267
|
+
const fs: any = gl.createShader(gl.FRAGMENT_SHADER);
|
|
268
|
+
gl.shaderSource(fs, "#version 300 es\\n" +
|
|
269
|
+
"precision highp float; in vec2 v_uv; uniform sampler2D u_tex;" +
|
|
270
|
+
"out vec4 fragColor; void main() { fragColor = texture(u_tex, v_uv); }");
|
|
271
|
+
gl.compileShader(fs);
|
|
272
|
+
const program: any = gl.createProgram();
|
|
273
|
+
gl.attachShader(program, vs);
|
|
274
|
+
gl.attachShader(program, fs);
|
|
275
|
+
gl.linkProgram(program);
|
|
276
|
+
label("link", gl.getProgramParameter(program, gl.LINK_STATUS) === true);
|
|
277
|
+
gl.useProgram(program);
|
|
278
|
+
|
|
279
|
+
const texture: any = gl.createTexture();
|
|
280
|
+
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
281
|
+
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, bitmap);
|
|
282
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
|
|
283
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
|
|
284
|
+
gl.uniform1i(gl.getUniformLocation(program, "u_tex"), 0);
|
|
285
|
+
const quad = gl.createBuffer();
|
|
286
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, quad);
|
|
287
|
+
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
|
|
288
|
+
-1, -1, 3, -1, -1, 3,
|
|
289
|
+
]), gl.STATIC_DRAW);
|
|
290
|
+
const pos: any = gl.getAttribLocation(program, "a_pos");
|
|
291
|
+
gl.enableVertexAttribArray(pos);
|
|
292
|
+
gl.vertexAttribPointer(pos, 2, gl.FLOAT, false, 8, 0);
|
|
293
|
+
gl.viewport(0, 0, 64, 64);
|
|
294
|
+
gl.clearColor(0, 0, 0, 1);
|
|
295
|
+
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
296
|
+
gl.drawArrays(gl.TRIANGLES, 0, 3);
|
|
297
|
+
const px = new Uint8Array(4);
|
|
298
|
+
gl.readPixels(32, 32, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, px);
|
|
299
|
+
label("pixel", px[0] + "," + px[1] + "," + px[2] + "," + px[3]);
|
|
300
|
+
label("error", gl.getError());
|
|
301
|
+
win.close();
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
win.loadHTML(page);
|
|
305
|
+
`, { files: { "page.html": PAGE }, autocloseMs: 10000 });
|
|
306
|
+
expect(value("bitmap-size")).toBe("2x2");
|
|
307
|
+
expect(value("bitmap-type")).toBe("true");
|
|
308
|
+
expect(value("link")).toBe("true");
|
|
309
|
+
expect(value("pixel")).toBe("64,128,191,255");
|
|
310
|
+
expect(value("error")).toBe("0");
|
|
311
|
+
expect(stderr).not.toContain("pipeline creation failed");
|
|
312
|
+
});
|
|
313
|
+
it("samples an S3TC-compressed texture when the device supports it", () => {
|
|
314
|
+
const { value, stderr } = harness.compileAndRun("webgl2-compressed", `
|
|
315
|
+
import { createWindow } from "gui";
|
|
316
|
+
import page from "./page.html";
|
|
317
|
+
|
|
318
|
+
const win = createWindow({ title: "compressed", width: 320, height: 240 });
|
|
319
|
+
const label = (name: string, value: any): void => console.log(name + "=" + value);
|
|
320
|
+
|
|
321
|
+
win.on("ready", () => {
|
|
322
|
+
const canvas: any = document.getElementById("c");
|
|
323
|
+
const gl: any = canvas.getContext("webgl2");
|
|
324
|
+
if (gl == null) {
|
|
325
|
+
console.log("webgl2=false");
|
|
326
|
+
win.close();
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
const s3tc: any = gl.getExtension("WEBGL_compressed_texture_s3tc");
|
|
330
|
+
label("s3tc", s3tc != null);
|
|
331
|
+
const supported: any = gl.getSupportedExtensions();
|
|
332
|
+
label("listed", supported.indexOf("WEBGL_compressed_texture_s3tc") >= 0);
|
|
333
|
+
if (s3tc == null) {
|
|
334
|
+
win.close();
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
const vs: any = gl.createShader(gl.VERTEX_SHADER);
|
|
338
|
+
gl.shaderSource(vs, "#version 300 es\\n" +
|
|
339
|
+
"in vec2 a_pos; out vec2 v_uv;" +
|
|
340
|
+
"void main() { v_uv = a_pos * 0.5 + 0.5;" +
|
|
341
|
+
" gl_Position = vec4(a_pos, 0.0, 1.0); }");
|
|
342
|
+
gl.compileShader(vs);
|
|
343
|
+
const fs: any = gl.createShader(gl.FRAGMENT_SHADER);
|
|
344
|
+
gl.shaderSource(fs, "#version 300 es\\n" +
|
|
345
|
+
"precision highp float; in vec2 v_uv; uniform sampler2D u_tex;" +
|
|
346
|
+
"out vec4 fragColor; void main() { fragColor = texture(u_tex, v_uv); }");
|
|
347
|
+
gl.compileShader(fs);
|
|
348
|
+
const program: any = gl.createProgram();
|
|
349
|
+
gl.attachShader(program, vs);
|
|
350
|
+
gl.attachShader(program, fs);
|
|
351
|
+
gl.linkProgram(program);
|
|
352
|
+
label("link", gl.getProgramParameter(program, gl.LINK_STATUS) === true);
|
|
353
|
+
gl.useProgram(program);
|
|
354
|
+
|
|
355
|
+
const texture: any = gl.createTexture();
|
|
356
|
+
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
357
|
+
// One BC1 block: colour0 = red (RGB565 0xF800), colour1 = black,
|
|
358
|
+
// every index selects colour0.
|
|
359
|
+
gl.compressedTexImage2D(gl.TEXTURE_2D, 0, s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,
|
|
360
|
+
4, 4, 0, new Uint8Array([0x00, 0xF8, 0x00, 0x00, 0, 0, 0, 0]));
|
|
361
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
|
|
362
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
|
|
363
|
+
gl.uniform1i(gl.getUniformLocation(program, "u_tex"), 0);
|
|
364
|
+
const quad = gl.createBuffer();
|
|
365
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, quad);
|
|
366
|
+
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
|
|
367
|
+
-1, -1, 3, -1, -1, 3,
|
|
368
|
+
]), gl.STATIC_DRAW);
|
|
369
|
+
const pos: any = gl.getAttribLocation(program, "a_pos");
|
|
370
|
+
gl.enableVertexAttribArray(pos);
|
|
371
|
+
gl.vertexAttribPointer(pos, 2, gl.FLOAT, false, 8, 0);
|
|
372
|
+
gl.viewport(0, 0, 64, 64);
|
|
373
|
+
gl.clearColor(0, 0, 0, 1);
|
|
374
|
+
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
375
|
+
gl.drawArrays(gl.TRIANGLES, 0, 3);
|
|
376
|
+
const px = new Uint8Array(4);
|
|
377
|
+
gl.readPixels(32, 32, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, px);
|
|
378
|
+
label("pixel", px[0] + "," + px[1] + "," + px[2] + "," + px[3]);
|
|
379
|
+
label("error", gl.getError());
|
|
380
|
+
win.close();
|
|
381
|
+
});
|
|
382
|
+
|
|
383
|
+
win.loadHTML(page);
|
|
384
|
+
`, { files: { "page.html": PAGE }, autocloseMs: 10000 });
|
|
385
|
+
expect(["true", "false"]).toContain(value("s3tc"));
|
|
386
|
+
expect(value("listed")).toBe(value("s3tc"));
|
|
387
|
+
if (value("s3tc") === "true") {
|
|
388
|
+
expect(value("link")).toBe("true");
|
|
389
|
+
expect(value("pixel")).toBe("255,0,0,255");
|
|
390
|
+
expect(value("error")).toBe("0");
|
|
391
|
+
}
|
|
392
|
+
expect(stderr).not.toContain("pipeline creation failed");
|
|
393
|
+
});
|
|
394
|
+
});
|
|
395
|
+
//# sourceMappingURL=gui-webgl2-formats.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gui-webgl2-formats.test.js","sourceRoot":"","sources":["../../../tests/e2e/gui-webgl2-formats.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAElE,MAAM,OAAO,GAAG,gBAAgB,EAAE,CAAC;AAEnC,MAAM,IAAI,GAAG;;;;eAIE,CAAC;AAEhB;;;;GAIG;AACH,SAAS,IAAI,CAAC,MAAc,EAAE,QAAkB,EAAE,SAAiB;IACjE,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5D,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACzC,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,M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AC,MAAM,CAAC,CAAC,CAAC;QACnD,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;QAC5C,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,MAAM,EAAE,CAAC;YAC7B,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACnC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YAC3C,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACnC,CAAC;QACD,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,0BAA0B,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* End-to-end test for WebGL 2 multiple render targets.
|
|
3
|
+
*/
|
|
4
|
+
import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
|
5
|
+
import { createGuiHarness, guiAvailable } from "./gui-helpers.js";
|
|
6
|
+
const harness = createGuiHarness();
|
|
7
|
+
const PAGE = `
|
|
8
|
+
<html><head><title>webgl2-mrt</title></head>
|
|
9
|
+
<body style="margin:0">
|
|
10
|
+
<canvas id="c" width="64" height="64"></canvas>
|
|
11
|
+
</body></html>`;
|
|
12
|
+
describe.skipIf(!guiAvailable)("gui extension — WebGL 2 MRT", () => {
|
|
13
|
+
beforeAll(() => harness.setup());
|
|
14
|
+
afterAll(() => harness.cleanup());
|
|
15
|
+
it("writes two fragment outputs and reads each attachment", () => {
|
|
16
|
+
const { value, stderr } = harness.compileAndRun("webgl2-mrt", `
|
|
17
|
+
import { createWindow } from "gui";
|
|
18
|
+
import page from "./page.html";
|
|
19
|
+
|
|
20
|
+
const win = createWindow({ title: "mrt", width: 320, height: 240 });
|
|
21
|
+
const label = (name: string, value: any): void => console.log(name + "=" + value);
|
|
22
|
+
|
|
23
|
+
win.on("ready", () => {
|
|
24
|
+
const canvas: any = document.getElementById("c");
|
|
25
|
+
const gl: any = canvas.getContext("webgl2");
|
|
26
|
+
if (gl == null) {
|
|
27
|
+
console.log("webgl2=false");
|
|
28
|
+
win.close();
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
label("max-draw", gl.getParameter(gl.MAX_DRAW_BUFFERS));
|
|
32
|
+
|
|
33
|
+
const vs: any = gl.createShader(gl.VERTEX_SHADER);
|
|
34
|
+
gl.shaderSource(vs, "#version 300 es\\n" +
|
|
35
|
+
"in vec2 a_pos; void main() { gl_Position = vec4(a_pos, 0.0, 1.0); }");
|
|
36
|
+
gl.compileShader(vs);
|
|
37
|
+
const fs: any = gl.createShader(gl.FRAGMENT_SHADER);
|
|
38
|
+
gl.shaderSource(fs, "#version 300 es\\n" +
|
|
39
|
+
"precision highp float;" +
|
|
40
|
+
"out vec4 fragColor0; out vec4 fragColor1;" +
|
|
41
|
+
"void main() { fragColor0 = vec4(1.0, 0.0, 0.0, 1.0);" +
|
|
42
|
+
" fragColor1 = vec4(0.0, 1.0, 0.0, 1.0); }");
|
|
43
|
+
gl.compileShader(fs);
|
|
44
|
+
label("fs", gl.getShaderParameter(fs, gl.COMPILE_STATUS) === true);
|
|
45
|
+
const program: any = gl.createProgram();
|
|
46
|
+
gl.attachShader(program, vs);
|
|
47
|
+
gl.attachShader(program, fs);
|
|
48
|
+
gl.linkProgram(program);
|
|
49
|
+
label("link", gl.getProgramParameter(program, gl.LINK_STATUS) === true);
|
|
50
|
+
gl.useProgram(program);
|
|
51
|
+
|
|
52
|
+
const quad = gl.createBuffer();
|
|
53
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, quad);
|
|
54
|
+
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
|
|
55
|
+
-1, -1, 3, -1, -1, 3,
|
|
56
|
+
]), gl.STATIC_DRAW);
|
|
57
|
+
const pos: any = gl.getAttribLocation(program, "a_pos");
|
|
58
|
+
gl.enableVertexAttribArray(pos);
|
|
59
|
+
gl.vertexAttribPointer(pos, 2, gl.FLOAT, false, 8, 0);
|
|
60
|
+
|
|
61
|
+
const make_target = (): any => {
|
|
62
|
+
const texture: any = gl.createTexture();
|
|
63
|
+
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
64
|
+
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 32, 32, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
|
|
65
|
+
return texture;
|
|
66
|
+
};
|
|
67
|
+
const first: any = make_target();
|
|
68
|
+
const second: any = make_target();
|
|
69
|
+
const fbo: any = gl.createFramebuffer();
|
|
70
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
|
|
71
|
+
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, first, 0);
|
|
72
|
+
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT1, gl.TEXTURE_2D, second, 0);
|
|
73
|
+
gl.drawBuffers([gl.COLOR_ATTACHMENT0, gl.COLOR_ATTACHMENT1]);
|
|
74
|
+
label("status", gl.checkFramebufferStatus(gl.FRAMEBUFFER) === gl.FRAMEBUFFER_COMPLETE);
|
|
75
|
+
label("draw-buffer-1", gl.getParameter(gl.DRAW_BUFFER1) === gl.COLOR_ATTACHMENT1);
|
|
76
|
+
gl.viewport(0, 0, 32, 32);
|
|
77
|
+
gl.clearColor(0, 0, 0, 0);
|
|
78
|
+
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
79
|
+
gl.drawArrays(gl.TRIANGLES, 0, 3);
|
|
80
|
+
const px = new Uint8Array(4);
|
|
81
|
+
const read = (attachment: number): string => {
|
|
82
|
+
gl.readBuffer(attachment);
|
|
83
|
+
gl.readPixels(16, 16, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, px);
|
|
84
|
+
return px[0] + "," + px[1] + "," + px[2] + "," + px[3];
|
|
85
|
+
};
|
|
86
|
+
label("target-0", read(gl.COLOR_ATTACHMENT0));
|
|
87
|
+
label("target-1", read(gl.COLOR_ATTACHMENT1));
|
|
88
|
+
label("error", gl.getError());
|
|
89
|
+
win.close();
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
win.loadHTML(page);
|
|
93
|
+
`, { files: { "page.html": PAGE }, autocloseMs: 10000 });
|
|
94
|
+
expect(value("max-draw")).toBe("4");
|
|
95
|
+
expect(value("fs")).toBe("true");
|
|
96
|
+
expect(value("link")).toBe("true");
|
|
97
|
+
expect(value("status")).toBe("true");
|
|
98
|
+
expect(value("draw-buffer-1")).toBe("true");
|
|
99
|
+
expect(value("target-0")).toBe("255,0,0,255");
|
|
100
|
+
expect(value("target-1")).toBe("0,255,0,255");
|
|
101
|
+
expect(value("error")).toBe("0");
|
|
102
|
+
expect(stderr).not.toContain("pipeline creation failed");
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
//# sourceMappingURL=gui-webgl2-mrt.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gui-webgl2-mrt.test.js","sourceRoot":"","sources":["../../../tests/e2e/gui-webgl2-mrt.test.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAElE,MAAM,OAAO,GAAG,gBAAgB,EAAE,CAAC;AAEnC,MAAM,IAAI,GAAG;;;;eAIE,CAAC;AAEhB,QAAQ,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC,6BAA6B,EAAE,GAAG,EAAE;IACjE,SAAS,CAAC,GAAG,EAAE,CAAC,OAAO,CAA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}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* End-to-end test for WebGL 2 uniform buffer objects.
|
|
3
|
+
*
|
|
4
|
+
* The engine merges a user block into its single std140 block and copies the
|
|
5
|
+
* bound buffer into that block at draw time, because SDL_GPU has no bindable
|
|
6
|
+
* uniform buffers.
|
|
7
|
+
*/
|
|
8
|
+
import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
|
9
|
+
import { createGuiHarness, guiAvailable } from "./gui-helpers.js";
|
|
10
|
+
const harness = createGuiHarness();
|
|
11
|
+
const PAGE = `
|
|
12
|
+
<html><head><title>webgl2-ubo</title></head>
|
|
13
|
+
<body style="margin:0">
|
|
14
|
+
<canvas id="c" width="64" height="64"></canvas>
|
|
15
|
+
</body></html>`;
|
|
16
|
+
describe.skipIf(!guiAvailable)("gui extension — WebGL 2 UBO", () => {
|
|
17
|
+
beforeAll(() => harness.setup());
|
|
18
|
+
afterAll(() => harness.cleanup());
|
|
19
|
+
it("feeds a uniform block from a bound buffer", () => {
|
|
20
|
+
const { value, stderr } = harness.compileAndRun("webgl2-ubo", `
|
|
21
|
+
import { createWindow } from "gui";
|
|
22
|
+
import page from "./page.html";
|
|
23
|
+
|
|
24
|
+
const win = createWindow({ title: "ubo", width: 320, height: 240 });
|
|
25
|
+
const label = (name: string, value: any): void => console.log(name + "=" + value);
|
|
26
|
+
|
|
27
|
+
win.on("ready", () => {
|
|
28
|
+
const canvas: any = document.getElementById("c");
|
|
29
|
+
const gl: any = canvas.getContext("webgl2");
|
|
30
|
+
if (gl == null) {
|
|
31
|
+
console.log("webgl2=false");
|
|
32
|
+
win.close();
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const block = "layout(std140) uniform Camera {" +
|
|
36
|
+
" vec4 u_color; float u_scale; } cam;";
|
|
37
|
+
const vs: any = gl.createShader(gl.VERTEX_SHADER);
|
|
38
|
+
gl.shaderSource(vs, "#version 300 es\\n" + block +
|
|
39
|
+
"in vec2 a_pos;" +
|
|
40
|
+
"void main() { gl_Position = vec4(a_pos * cam.u_scale, 0.0, 1.0); }");
|
|
41
|
+
gl.compileShader(vs);
|
|
42
|
+
label("vs", gl.getShaderParameter(vs, gl.COMPILE_STATUS) === true);
|
|
43
|
+
const fs: any = gl.createShader(gl.FRAGMENT_SHADER);
|
|
44
|
+
gl.shaderSource(fs, "#version 300 es\\nprecision highp float;\\n" + block +
|
|
45
|
+
"out vec4 fragColor;" +
|
|
46
|
+
"void main() { fragColor = cam.u_color; }");
|
|
47
|
+
gl.compileShader(fs);
|
|
48
|
+
label("fs", gl.getShaderParameter(fs, gl.COMPILE_STATUS) === true);
|
|
49
|
+
const program: any = gl.createProgram();
|
|
50
|
+
gl.attachShader(program, vs);
|
|
51
|
+
gl.attachShader(program, fs);
|
|
52
|
+
gl.linkProgram(program);
|
|
53
|
+
label("link", gl.getProgramParameter(program, gl.LINK_STATUS) === true);
|
|
54
|
+
gl.useProgram(program);
|
|
55
|
+
|
|
56
|
+
const index: any = gl.getUniformBlockIndex(program, "Camera");
|
|
57
|
+
label("block-index", index != 4294967295);
|
|
58
|
+
label("block-name", gl.getActiveUniformBlockName(program, index));
|
|
59
|
+
gl.uniformBlockBinding(program, index, 0);
|
|
60
|
+
label("binding", gl.getActiveUniformBlockParameter(
|
|
61
|
+
program, index, gl.UNIFORM_BLOCK_BINDING));
|
|
62
|
+
label("size", gl.getActiveUniformBlockParameter(
|
|
63
|
+
program, index, gl.UNIFORM_BLOCK_DATA_SIZE) >= 20);
|
|
64
|
+
|
|
65
|
+
const data = new Float32Array([1, 0, 0, 1, 1]);
|
|
66
|
+
const buffer: any = gl.createBuffer();
|
|
67
|
+
gl.bindBuffer(gl.UNIFORM_BUFFER, buffer);
|
|
68
|
+
gl.bufferData(gl.UNIFORM_BUFFER, data, gl.DYNAMIC_DRAW);
|
|
69
|
+
gl.bindBufferBase(gl.UNIFORM_BUFFER, 0, buffer);
|
|
70
|
+
label("buffer-bound", gl.getIndexedParameter(gl.UNIFORM_BUFFER, 0) != null);
|
|
71
|
+
|
|
72
|
+
const quad = gl.createBuffer();
|
|
73
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, quad);
|
|
74
|
+
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
|
|
75
|
+
-1, -1, 3, -1, -1, 3,
|
|
76
|
+
]), gl.STATIC_DRAW);
|
|
77
|
+
const pos: any = gl.getAttribLocation(program, "a_pos");
|
|
78
|
+
gl.enableVertexAttribArray(pos);
|
|
79
|
+
gl.vertexAttribPointer(pos, 2, gl.FLOAT, false, 8, 0);
|
|
80
|
+
gl.viewport(0, 0, 64, 64);
|
|
81
|
+
const px = new Uint8Array(4);
|
|
82
|
+
const sample = (): string => {
|
|
83
|
+
gl.clearColor(0, 0, 1, 1);
|
|
84
|
+
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
85
|
+
gl.drawArrays(gl.TRIANGLES, 0, 3);
|
|
86
|
+
gl.readPixels(32, 32, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, px);
|
|
87
|
+
return px[0] + "," + px[1] + "," + px[2] + "," + px[3];
|
|
88
|
+
};
|
|
89
|
+
label("red", sample());
|
|
90
|
+
gl.bufferSubData(gl.UNIFORM_BUFFER, 0, new Float32Array([0, 1, 0, 1]));
|
|
91
|
+
label("green", sample());
|
|
92
|
+
label("error", gl.getError());
|
|
93
|
+
win.close();
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
win.loadHTML(page);
|
|
97
|
+
`, { files: { "page.html": PAGE }, autocloseMs: 10000 });
|
|
98
|
+
expect(value("vs")).toBe("true");
|
|
99
|
+
expect(value("fs")).toBe("true");
|
|
100
|
+
expect(value("link")).toBe("true");
|
|
101
|
+
expect(value("block-index")).toBe("true");
|
|
102
|
+
expect(value("block-name")).toBe("Camera");
|
|
103
|
+
expect(value("binding")).toBe("0");
|
|
104
|
+
expect(value("size")).toBe("true");
|
|
105
|
+
expect(value("buffer-bound")).toBe("true");
|
|
106
|
+
expect(value("red")).toBe("255,0,0,255");
|
|
107
|
+
expect(value("green")).toBe("0,255,0,255");
|
|
108
|
+
expect(value("error")).toBe("0");
|
|
109
|
+
expect(stderr).not.toContain("pipeline creation failed");
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
//# sourceMappingURL=gui-webgl2-ubo.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gui-webgl2-ubo.test.js","sourceRoot":"","sources":["../../../tests/e2e/gui-webgl2-ubo.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAElE,MAAM,OAAO,GAAG,gBAAgB,EAAE,CAAC;AAEnC,MAAM,IAAI,GAAG;;;;eAIE,CAAC;AAEhB,QAAQ,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC,6BAA6B,EAAE,GAAG,EAAE;IACjE,SAAS,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;IACjC,QAAQ,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAElC,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACnD,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,aAAa,CAC7C,YAAY,EACZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6EC,EACD,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,CACrD,CAAC;QAEF,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,C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