@gjsify/webgl 0.3.12 → 0.3.14

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.
Files changed (55) hide show
  1. package/lib/esm/conformance/attribs.spec.js +312 -293
  2. package/lib/esm/conformance/buffers.spec.js +217 -200
  3. package/lib/esm/conformance/context.spec.js +295 -295
  4. package/lib/esm/conformance/programs.spec.js +458 -445
  5. package/lib/esm/conformance/rendering-basic.spec.js +134 -128
  6. package/lib/esm/conformance/rendering.spec.js +502 -400
  7. package/lib/esm/conformance/setup.js +42 -31
  8. package/lib/esm/conformance/state.spec.js +360 -343
  9. package/lib/esm/conformance/textures.spec.js +330 -338
  10. package/lib/esm/conformance/uniforms.spec.js +465 -309
  11. package/lib/esm/conformance-test.js +24 -22
  12. package/lib/esm/extensions/ext-blend-minmax.js +16 -16
  13. package/lib/esm/extensions/ext-color-buffer-float.js +10 -11
  14. package/lib/esm/extensions/ext-color-buffer-half-float.js +10 -11
  15. package/lib/esm/extensions/ext-texture-filter-anisotropic.js +16 -16
  16. package/lib/esm/extensions/oes-element-index-unit.js +11 -12
  17. package/lib/esm/extensions/oes-standard-derivatives.js +15 -15
  18. package/lib/esm/extensions/oes-texture-float-linear.js +11 -12
  19. package/lib/esm/extensions/oes-texture-float.js +11 -12
  20. package/lib/esm/extensions/oes-texture-half-float.js +17 -17
  21. package/lib/esm/extensions/stackgl-destroy-context.js +10 -10
  22. package/lib/esm/extensions/stackgl-resize-drawing-buffer.js +10 -10
  23. package/lib/esm/html-canvas-element.js +64 -64
  24. package/lib/esm/index.js +29 -26
  25. package/lib/esm/linkable.js +49 -49
  26. package/lib/esm/test-utils.js +158 -107
  27. package/lib/esm/test.js +8 -4
  28. package/lib/esm/types/index.js +5 -5
  29. package/lib/esm/utils.js +164 -187
  30. package/lib/esm/webgl-active-info.js +10 -9
  31. package/lib/esm/webgl-bridge.js +162 -147
  32. package/lib/esm/webgl-buffer.js +17 -15
  33. package/lib/esm/webgl-context-attributes.js +23 -22
  34. package/lib/esm/webgl-context-base.js +3039 -3351
  35. package/lib/esm/webgl-drawing-buffer-wrapper.js +10 -9
  36. package/lib/esm/webgl-framebuffer.js +108 -106
  37. package/lib/esm/webgl-program.js +25 -23
  38. package/lib/esm/webgl-query.js +15 -13
  39. package/lib/esm/webgl-renderbuffer.js +23 -21
  40. package/lib/esm/webgl-rendering-context.js +173 -187
  41. package/lib/esm/webgl-sampler.js +15 -13
  42. package/lib/esm/webgl-shader-precision-format.js +10 -9
  43. package/lib/esm/webgl-shader.js +23 -21
  44. package/lib/esm/webgl-sync.js +15 -13
  45. package/lib/esm/webgl-texture-unit.js +12 -11
  46. package/lib/esm/webgl-texture.js +21 -19
  47. package/lib/esm/webgl-transform-feedback.js +15 -13
  48. package/lib/esm/webgl-uniform-location.js +14 -13
  49. package/lib/esm/webgl-vertex-array-object.js +20 -18
  50. package/lib/esm/webgl-vertex-attribute.js +149 -145
  51. package/lib/esm/webgl1.spec.js +1039 -650
  52. package/lib/esm/webgl2-rendering-context.js +1210 -1273
  53. package/lib/esm/webgl2.spec.js +1284 -1252
  54. package/package.json +9 -9
  55. package/lib/esm/@types/glsl-tokenizer/index.d.js +0 -0
@@ -1,50 +1,50 @@
1
- class Linkable {
2
- constructor(_) {
3
- this._ = 0;
4
- this._references = [];
5
- this._refCount = 0;
6
- this._pendingDelete = false;
7
- this._binding = 0;
8
- this._ = _;
9
- this._references = [];
10
- this._refCount = 0;
11
- this._pendingDelete = false;
12
- this._binding = 0;
13
- }
14
- _link(b) {
15
- this._references.push(b);
16
- b._refCount += 1;
17
- return true;
18
- }
19
- _unlink(b) {
20
- let idx = this._references.indexOf(b);
21
- if (idx < 0) {
22
- return false;
23
- }
24
- while (idx >= 0) {
25
- this._references[idx] = this._references[this._references.length - 1];
26
- this._references.pop();
27
- b._refCount -= 1;
28
- b._checkDelete();
29
- idx = this._references.indexOf(b);
30
- }
31
- return true;
32
- }
33
- _linked(b) {
34
- return this._references.indexOf(b) >= 0;
35
- }
36
- _checkDelete() {
37
- if (this._refCount <= 0 && this._pendingDelete && this._ !== 0) {
38
- while (this._references.length > 0) {
39
- this._unlink(this._references[0]);
40
- }
41
- this._performDelete();
42
- this._ = 0;
43
- }
44
- }
45
- _performDelete() {
46
- }
47
- }
48
- export {
49
- Linkable
1
+ //#region src/ts/linkable.ts
2
+ var Linkable = class {
3
+ constructor(_) {
4
+ this._ = 0;
5
+ this._references = [];
6
+ this._refCount = 0;
7
+ this._pendingDelete = false;
8
+ this._binding = 0;
9
+ this._ = _;
10
+ this._references = [];
11
+ this._refCount = 0;
12
+ this._pendingDelete = false;
13
+ this._binding = 0;
14
+ }
15
+ _link(b) {
16
+ this._references.push(b);
17
+ b._refCount += 1;
18
+ return true;
19
+ }
20
+ _unlink(b) {
21
+ let idx = this._references.indexOf(b);
22
+ if (idx < 0) {
23
+ return false;
24
+ }
25
+ while (idx >= 0) {
26
+ this._references[idx] = this._references[this._references.length - 1];
27
+ this._references.pop();
28
+ b._refCount -= 1;
29
+ b._checkDelete();
30
+ idx = this._references.indexOf(b);
31
+ }
32
+ return true;
33
+ }
34
+ _linked(b) {
35
+ return this._references.indexOf(b) >= 0;
36
+ }
37
+ _checkDelete() {
38
+ if (this._refCount <= 0 && this._pendingDelete && this._ !== 0) {
39
+ while (this._references.length > 0) {
40
+ this._unlink(this._references[0]);
41
+ }
42
+ this._performDelete();
43
+ this._ = 0;
44
+ }
45
+ }
46
+ _performDelete() {}
50
47
  };
48
+
49
+ //#endregion
50
+ export { Linkable };
@@ -1,116 +1,179 @@
1
+ //#region src/ts/test-utils.ts
2
+ /** Compile a WebGL shader from source. Does not check compile status. */
1
3
  function makeShader(gl, type, src) {
2
- const shader = gl.createShader(type);
3
- gl.shaderSource(shader, src);
4
- gl.compileShader(shader);
5
- return shader;
4
+ const shader = gl.createShader(type);
5
+ gl.shaderSource(shader, src);
6
+ gl.compileShader(shader);
7
+ return shader;
6
8
  }
9
+ /**
10
+ * Link a WebGL program from vertex + fragment source strings.
11
+ * Binds attribute "position" to location 0 before linking so that drawTriangle() works
12
+ * without an explicit getAttribLocation() call.
13
+ * Does not check link status — call getProgramParameter(prog, LINK_STATUS) if needed.
14
+ */
7
15
  function makeProgram(gl, vsSrc, fsSrc) {
8
- const frag = makeShader(gl, gl.FRAGMENT_SHADER, fsSrc);
9
- const vert = makeShader(gl, gl.VERTEX_SHADER, vsSrc);
10
- const program = gl.createProgram();
11
- gl.attachShader(program, frag);
12
- gl.attachShader(program, vert);
13
- gl.bindAttribLocation(program, 0, "position");
14
- gl.linkProgram(program);
15
- return program;
16
+ const frag = makeShader(gl, gl.FRAGMENT_SHADER, fsSrc);
17
+ const vert = makeShader(gl, gl.VERTEX_SHADER, vsSrc);
18
+ const program = gl.createProgram();
19
+ gl.attachShader(program, frag);
20
+ gl.attachShader(program, vert);
21
+ gl.bindAttribLocation(program, 0, "position");
22
+ gl.linkProgram(program);
23
+ return program;
16
24
  }
25
+ /**
26
+ * Draw a fullscreen triangle using attribute location 0.
27
+ * Covers the entire clip space: vertices at (-2,-2), (-2,4), (4,-2).
28
+ * The active program must expose a vec2 attribute named "position" at location 0
29
+ * (ensured by makeProgram's bindAttribLocation call).
30
+ */
17
31
  function drawTriangle(gl) {
18
- const buffer = gl.createBuffer();
19
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
20
- gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([-2, -2, -2, 4, 4, -2]), gl.STREAM_DRAW);
21
- gl.enableVertexAttribArray(0);
22
- gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 0, 0);
23
- gl.drawArrays(gl.TRIANGLES, 0, 3);
24
- gl.bindBuffer(gl.ARRAY_BUFFER, null);
25
- gl.disableVertexAttribArray(0);
26
- gl.deleteBuffer(buffer);
32
+ const buffer = gl.createBuffer();
33
+ gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
34
+ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
35
+ -2,
36
+ -2,
37
+ -2,
38
+ 4,
39
+ 4,
40
+ -2
41
+ ]), gl.STREAM_DRAW);
42
+ gl.enableVertexAttribArray(0);
43
+ gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 0, 0);
44
+ gl.drawArrays(gl.TRIANGLES, 0, 3);
45
+ gl.bindBuffer(gl.ARRAY_BUFFER, null);
46
+ gl.disableVertexAttribArray(0);
47
+ gl.deleteBuffer(buffer);
27
48
  }
49
+ /** Read a single RGBA pixel at (x, y). Defaults to (0, 0). */
28
50
  function readPixel(gl, x = 0, y = 0) {
29
- const pixel = new Uint8Array(4);
30
- gl.readPixels(x, y, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, pixel);
31
- return pixel;
51
+ const pixel = new Uint8Array(4);
52
+ gl.readPixels(x, y, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, pixel);
53
+ return pixel;
32
54
  }
55
+ /** Return true if |a[i] - b[i]| <= tolerance for every RGBA component. */
33
56
  function pixelClose(a, b, tolerance = 3) {
34
- for (let i = 0; i < 4; i++) {
35
- if (Math.abs(a[i] - b[i]) > tolerance) return false;
36
- }
37
- return true;
57
+ for (let i = 0; i < 4; i++) {
58
+ if (Math.abs(a[i] - b[i]) > tolerance) return false;
59
+ }
60
+ return true;
38
61
  }
62
+ /**
63
+ * Create a w×h RGBA8 FBO and bind it as the current framebuffer.
64
+ * Also sets the viewport to (0, 0, w, h).
65
+ * Call destroyTestFBO() when done.
66
+ */
39
67
  function makeTestFBO(gl, width = 4, height = 4) {
40
- const fb = gl.createFramebuffer();
41
- const colorTex = gl.createTexture();
42
- gl.bindTexture(gl.TEXTURE_2D, colorTex);
43
- gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
44
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
45
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
46
- gl.bindTexture(gl.TEXTURE_2D, null);
47
- gl.bindFramebuffer(gl.FRAMEBUFFER, fb);
48
- gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, colorTex, 0);
49
- gl.viewport(0, 0, width, height);
50
- return { fb, colorTex, width, height };
68
+ const fb = gl.createFramebuffer();
69
+ const colorTex = gl.createTexture();
70
+ gl.bindTexture(gl.TEXTURE_2D, colorTex);
71
+ gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
72
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
73
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
74
+ gl.bindTexture(gl.TEXTURE_2D, null);
75
+ gl.bindFramebuffer(gl.FRAMEBUFFER, fb);
76
+ gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, colorTex, 0);
77
+ gl.viewport(0, 0, width, height);
78
+ return {
79
+ fb,
80
+ colorTex,
81
+ width,
82
+ height
83
+ };
51
84
  }
85
+ /**
86
+ * Create a w×h RGBA8 FBO with a DEPTH_COMPONENT16 renderbuffer and bind it.
87
+ * Also sets the viewport to (0, 0, w, h).
88
+ * Call destroyTestFBOWithDepth() when done.
89
+ */
52
90
  function makeTestFBOWithDepth(gl, width = 4, height = 4) {
53
- const base = makeTestFBO(gl, width, height);
54
- const depthRb = gl.createRenderbuffer();
55
- gl.bindRenderbuffer(gl.RENDERBUFFER, depthRb);
56
- gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT16, width, height);
57
- gl.bindRenderbuffer(gl.RENDERBUFFER, null);
58
- gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, depthRb);
59
- return { ...base, depthRb };
91
+ const base = makeTestFBO(gl, width, height);
92
+ const depthRb = gl.createRenderbuffer();
93
+ gl.bindRenderbuffer(gl.RENDERBUFFER, depthRb);
94
+ gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT16, width, height);
95
+ gl.bindRenderbuffer(gl.RENDERBUFFER, null);
96
+ gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, depthRb);
97
+ return {
98
+ ...base,
99
+ depthRb
100
+ };
60
101
  }
102
+ /** Unbind the FBO and delete the color texture. */
61
103
  function destroyTestFBO(gl, fbo) {
62
- gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.fb);
63
- gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, null, 0);
64
- gl.bindFramebuffer(gl.FRAMEBUFFER, null);
65
- gl.deleteTexture(fbo.colorTex);
66
- gl.deleteFramebuffer(fbo.fb);
104
+ gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.fb);
105
+ gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, null, 0);
106
+ gl.bindFramebuffer(gl.FRAMEBUFFER, null);
107
+ gl.deleteTexture(fbo.colorTex);
108
+ gl.deleteFramebuffer(fbo.fb);
67
109
  }
110
+ /** Unbind the FBO and delete both the color texture and depth renderbuffer. */
68
111
  function destroyTestFBOWithDepth(gl, fbo) {
69
- gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.fb);
70
- gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, null, 0);
71
- gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, null);
72
- gl.bindFramebuffer(gl.FRAMEBUFFER, null);
73
- gl.deleteTexture(fbo.colorTex);
74
- gl.deleteRenderbuffer(fbo.depthRb);
75
- gl.deleteFramebuffer(fbo.fb);
112
+ gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.fb);
113
+ gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, null, 0);
114
+ gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, null);
115
+ gl.bindFramebuffer(gl.FRAMEBUFFER, null);
116
+ gl.deleteTexture(fbo.colorTex);
117
+ gl.deleteRenderbuffer(fbo.depthRb);
118
+ gl.deleteFramebuffer(fbo.fb);
76
119
  }
120
+ /**
121
+ * Create a w×h RGBA16F FBO (half-float color texture) and bind it.
122
+ * Used for testing Three.js post-processing render target patterns.
123
+ */
77
124
  function makeTestFBOFloat(gl, width = 4, height = 4) {
78
- const RGBA16F = 34842;
79
- const HALF_FLOAT = 5131;
80
- const fb = gl.createFramebuffer();
81
- const colorTex = gl.createTexture();
82
- gl.bindTexture(gl.TEXTURE_2D, colorTex);
83
- gl.texImage2D(gl.TEXTURE_2D, 0, RGBA16F, width, height, 0, gl.RGBA, HALF_FLOAT, null);
84
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
85
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
86
- gl.bindTexture(gl.TEXTURE_2D, null);
87
- gl.bindFramebuffer(gl.FRAMEBUFFER, fb);
88
- gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, colorTex, 0);
89
- gl.viewport(0, 0, width, height);
90
- return { fb, colorTex, width, height };
125
+ const RGBA16F = 34842;
126
+ const HALF_FLOAT = 5131;
127
+ const fb = gl.createFramebuffer();
128
+ const colorTex = gl.createTexture();
129
+ gl.bindTexture(gl.TEXTURE_2D, colorTex);
130
+ gl.texImage2D(gl.TEXTURE_2D, 0, RGBA16F, width, height, 0, gl.RGBA, HALF_FLOAT, null);
131
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
132
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
133
+ gl.bindTexture(gl.TEXTURE_2D, null);
134
+ gl.bindFramebuffer(gl.FRAMEBUFFER, fb);
135
+ gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, colorTex, 0);
136
+ gl.viewport(0, 0, width, height);
137
+ return {
138
+ fb,
139
+ colorTex,
140
+ width,
141
+ height
142
+ };
91
143
  }
144
+ /**
145
+ * Create a w×h RGBA8 FBO with a DEPTH_COMPONENT24 texture attachment.
146
+ * Three.js uses depth textures (not renderbuffers) for RenderPixelatedPass.
147
+ */
92
148
  function makeTestFBOWithDepthTexture(gl, width = 4, height = 4) {
93
- const DEPTH_COMPONENT24 = 33190;
94
- const DEPTH_COMPONENT = 6402;
95
- const UNSIGNED_INT = 5125;
96
- const fb = gl.createFramebuffer();
97
- const colorTex = gl.createTexture();
98
- gl.bindTexture(gl.TEXTURE_2D, colorTex);
99
- gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
100
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
101
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
102
- const depthTex = gl.createTexture();
103
- gl.bindTexture(gl.TEXTURE_2D, depthTex);
104
- gl.texImage2D(gl.TEXTURE_2D, 0, DEPTH_COMPONENT24, width, height, 0, DEPTH_COMPONENT, UNSIGNED_INT, null);
105
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
106
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
107
- gl.bindTexture(gl.TEXTURE_2D, null);
108
- gl.bindFramebuffer(gl.FRAMEBUFFER, fb);
109
- gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, colorTex, 0);
110
- gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.TEXTURE_2D, depthTex, 0);
111
- gl.viewport(0, 0, width, height);
112
- return { fb, colorTex, depthTex, width, height };
149
+ const DEPTH_COMPONENT24 = 33190;
150
+ const DEPTH_COMPONENT = 6402;
151
+ const UNSIGNED_INT = 5125;
152
+ const fb = gl.createFramebuffer();
153
+ const colorTex = gl.createTexture();
154
+ gl.bindTexture(gl.TEXTURE_2D, colorTex);
155
+ gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
156
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
157
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
158
+ const depthTex = gl.createTexture();
159
+ gl.bindTexture(gl.TEXTURE_2D, depthTex);
160
+ gl.texImage2D(gl.TEXTURE_2D, 0, DEPTH_COMPONENT24, width, height, 0, DEPTH_COMPONENT, UNSIGNED_INT, null);
161
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
162
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
163
+ gl.bindTexture(gl.TEXTURE_2D, null);
164
+ gl.bindFramebuffer(gl.FRAMEBUFFER, fb);
165
+ gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, colorTex, 0);
166
+ gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.TEXTURE_2D, depthTex, 0);
167
+ gl.viewport(0, 0, width, height);
168
+ return {
169
+ fb,
170
+ colorTex,
171
+ depthTex,
172
+ width,
173
+ height
174
+ };
113
175
  }
176
+ /** WebGL2 passthrough texture shader (samples texture at UV and outputs it). */
114
177
  const TEXTURE_VS_300 = `#version 300 es
115
178
  in vec2 position;
116
179
  out vec2 vUv;
@@ -126,6 +189,7 @@ out vec4 fragColor;
126
189
  void main() {
127
190
  fragColor = texture(uTexture, vUv);
128
191
  }`;
192
+ /** WebGL2 cubemap sampling shader. */
129
193
  const CUBEMAP_FS_300 = `#version 300 es
130
194
  precision mediump float;
131
195
  uniform samplerCube uCubemap;
@@ -134,19 +198,6 @@ out vec4 fragColor;
134
198
  void main() {
135
199
  fragColor = texture(uCubemap, uDirection);
136
200
  }`;
137
- export {
138
- CUBEMAP_FS_300,
139
- TEXTURE_FS_300,
140
- TEXTURE_VS_300,
141
- destroyTestFBO,
142
- destroyTestFBOWithDepth,
143
- drawTriangle,
144
- makeProgram,
145
- makeShader,
146
- makeTestFBO,
147
- makeTestFBOFloat,
148
- makeTestFBOWithDepth,
149
- makeTestFBOWithDepthTexture,
150
- pixelClose,
151
- readPixel
152
- };
201
+
202
+ //#endregion
203
+ export { CUBEMAP_FS_300, TEXTURE_FS_300, TEXTURE_VS_300, destroyTestFBO, destroyTestFBOWithDepth, drawTriangle, makeProgram, makeShader, makeTestFBO, makeTestFBOFloat, makeTestFBOWithDepth, makeTestFBOWithDepthTexture, pixelClose, readPixel };
package/lib/esm/test.js CHANGED
@@ -1,7 +1,11 @@
1
+ import webgl1_spec_default from "./webgl1.spec.js";
2
+ import webgl2_spec_default from "./webgl2.spec.js";
1
3
  import { run } from "@gjsify/unit";
2
- import webgl1TestSuite from "./webgl1.spec.js";
3
- import webgl2TestSuite from "./webgl2.spec.js";
4
+
5
+ //#region src/ts/test.ts
4
6
  run({ testSuite: async () => {
5
- await webgl1TestSuite();
6
- await webgl2TestSuite();
7
+ await webgl1_spec_default();
8
+ await webgl2_spec_default();
7
9
  } });
10
+
11
+ //#endregion
@@ -1,5 +1,5 @@
1
- export * from "./constructor.js";
2
- export * from "./extension.js";
3
- export * from "./typed-array.js";
4
- export * from "./webgl-constants.js";
5
- export * from "./webgl-context-attribute-options.js";
1
+ import "./constructor.js";
2
+ import "./extension.js";
3
+ import "./typed-array.js";
4
+ import "./webgl-constants.js";
5
+ import "./webgl-context-attribute-options.js";