webgl2 1.1.3 → 1.1.4
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/coverage.md +23 -19
- package/package.json +1 -1
- package/src/webgl2_context.js +77 -6
- package/src/webgl2_resources.js +16 -0
- package/webgl2.debug.wasm +0 -0
- package/webgl2.wasm +0 -0
package/coverage.md
CHANGED
|
@@ -1,28 +1,32 @@
|
|
|
1
1
|
# Coverage Report
|
|
2
2
|
|
|
3
|
+
> **Legend:** 🟢 ≥80% | 🟡 ≥50% (or ≤6 lines) | 🟠 ≥20% | 🔴 <20%
|
|
4
|
+
|
|
3
5
|
| File | Lines Covered | Lines Missed | Total Lines | Coverage |
|
|
4
6
|
|---|---|---|---|---|
|
|
5
|
-
| src/
|
|
6
|
-
| src/arrayvec.rs | 0 | 1 | 1 | 0.00% 🔴 |
|
|
7
|
-
| src/binary16.rs | 0 | 2 | 2 | 0.00% 🔴 |
|
|
8
|
-
| src/core/code.rs | 0 | 2 | 2 | 0.00% 🔴 |
|
|
9
|
-
| src/core/globals.rs | 1 | 0 | 1 | 100.00% 🟢 |
|
|
10
|
-
| src/core/imports.rs | 0 | 1 | 1 | 0.00% 🔴 |
|
|
11
|
-
| src/imp_std.rs | 0 | 6 | 6 | 0.00% 🔴 |
|
|
12
|
-
| src/lexer.rs | 6 | 2 | 8 | 75.00% 🟡 |
|
|
13
|
-
| src/lib.rs | 73 | 14 | 87 | 83.91% 🟢 |
|
|
14
|
-
| src/math/rint.rs | 0 | 2 | 2 | 0.00% 🔴 |
|
|
7
|
+
| src/lib.rs | 78 | 17 | 95 | 82.11% 🟢 |
|
|
15
8
|
| src/naga_wasm_backend/backend.rs | 39 | 0 | 39 | 100.00% 🟢 |
|
|
16
9
|
| src/naga_wasm_backend/control_flow.rs | 15 | 4 | 19 | 78.95% 🟡 |
|
|
17
10
|
| src/naga_wasm_backend/expressions.rs | 27 | 12 | 39 | 69.23% 🟡 |
|
|
18
11
|
| src/naga_wasm_backend/types.rs | 6 | 0 | 6 | 100.00% 🟢 |
|
|
19
|
-
| src/pp.rs | 16 | 95 | 111 | 14.41% 🔴 |
|
|
20
|
-
| src/pp/if_parser.rs | 0 | 90 | 90 | 0.00% 🔴 |
|
|
21
|
-
| src/raw/mod.rs | 1 | 3 | 4 | 25.00% 🔴 |
|
|
22
|
-
| src/subscriber.rs | 0 | 1 | 1 | 0.00% 🔴 |
|
|
23
|
-
| src/tables.rs | 1 | 2 | 3 | 33.33% 🔴 |
|
|
24
|
-
| src/token.rs | 0 | 1 | 1 | 0.00% 🔴 |
|
|
25
|
-
| src/wasm_gl_emu/framebuffer.rs | 2 | 0 | 2 | 100.00% 🟢 |
|
|
26
12
|
| src/wasm_gl_emu/rasterizer.rs | 1 | 0 | 1 | 100.00% 🟢 |
|
|
27
|
-
| src/webgl2_context.rs |
|
|
28
|
-
|
|
|
13
|
+
| src/webgl2_context/buffers.rs | 16 | 1 | 17 | 94.12% 🟢 |
|
|
14
|
+
| src/webgl2_context/drawing.rs | 25 | 5 | 30 | 83.33% 🟢 |
|
|
15
|
+
| src/webgl2_context/framebuffers.rs | 8 | 0 | 8 | 100.00% 🟢 |
|
|
16
|
+
| src/webgl2_context/registry.rs | 3 | 2 | 5 | 60.00% 🟡 |
|
|
17
|
+
| src/webgl2_context/renderbuffers.rs | 10 | 0 | 10 | 100.00% 🟢 |
|
|
18
|
+
| src/webgl2_context/shaders.rs | 61 | 0 | 61 | 100.00% 🟢 |
|
|
19
|
+
| src/webgl2_context/state.rs | 11 | 3 | 14 | 78.57% 🟡 |
|
|
20
|
+
| src/webgl2_context/textures.rs | 9 | 0 | 9 | 100.00% 🟢 |
|
|
21
|
+
| src/webgl2_context/types.rs | 11 | 1 | 12 | 91.67% 🟢 |
|
|
22
|
+
| src/webgl2_context/vaos.rs | 16 | 0 | 16 | 100.00% 🟢 |
|
|
23
|
+
| **Total** | **336** | **45** | **381** | **88.19% 🟢** |
|
|
24
|
+
|
|
25
|
+
## Top Missed Files
|
|
26
|
+
|
|
27
|
+
| File | Lines Missed | Illustrative Line | Coverage |
|
|
28
|
+
|---|---|---|---|
|
|
29
|
+
| src/lib.rs | 17/95 | [56] `pub fn js_log(level: u32, s: &str) {` | 82.11% 🟢 |
|
|
30
|
+
| src/naga_wasm_backend/expressions.rs | 12/39 | [49] `if component_idx == 0 {` | 69.23% 🟡 |
|
|
31
|
+
| src/webgl2_context/drawing.rs | 5/30 | [561] `for k in 0..64 {` | 83.33% 🟢 |
|
|
32
|
+
| src/naga_wasm_backend/control_flow.rs | 4/19 | [80] `for _ in 0..types.len() {` | 78.95% 🟡 |
|
package/package.json
CHANGED
package/src/webgl2_context.js
CHANGED
|
@@ -15,7 +15,7 @@ export const ERR_GL = 5;
|
|
|
15
15
|
export const ERR_INTERNAL = 6;
|
|
16
16
|
|
|
17
17
|
import { WasmWebGLTexture } from './webgl2_texture.js';
|
|
18
|
-
import { WasmWebGLShader, WasmWebGLProgram, WasmWebGLBuffer } from './webgl2_resources.js';
|
|
18
|
+
import { WasmWebGLShader, WasmWebGLProgram, WasmWebGLBuffer, WasmWebGLRenderbuffer } from './webgl2_resources.js';
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* @implements {WebGL2RenderingContext}
|
|
@@ -44,6 +44,19 @@ export class WasmWebGL2RenderingContext {
|
|
|
44
44
|
BUFFER_SIZE = 0x8764;
|
|
45
45
|
NO_ERROR = 0;
|
|
46
46
|
|
|
47
|
+
RENDERBUFFER = 0x8D41;
|
|
48
|
+
FRAMEBUFFER = 0x8D40;
|
|
49
|
+
DEPTH_COMPONENT16 = 0x81A5;
|
|
50
|
+
DEPTH_STENCIL = 0x84F9;
|
|
51
|
+
RGBA4 = 0x8056;
|
|
52
|
+
RGB565 = 0x8D62;
|
|
53
|
+
RGB5_A1 = 0x8057;
|
|
54
|
+
STENCIL_INDEX8 = 0x8D48;
|
|
55
|
+
COLOR_ATTACHMENT0 = 0x8CE0;
|
|
56
|
+
DEPTH_ATTACHMENT = 0x8D00;
|
|
57
|
+
STENCIL_ATTACHMENT = 0x8D20;
|
|
58
|
+
DEPTH_STENCIL_ATTACHMENT = 0x821A;
|
|
59
|
+
|
|
47
60
|
TEXTURE_2D = 0x0DE1;
|
|
48
61
|
TEXTURE_WRAP_S = 0x2802;
|
|
49
62
|
TEXTURE_WRAP_T = 0x2803;
|
|
@@ -238,6 +251,69 @@ export class WasmWebGL2RenderingContext {
|
|
|
238
251
|
_checkErr(code, this._instance);
|
|
239
252
|
}
|
|
240
253
|
|
|
254
|
+
createRenderbuffer() {
|
|
255
|
+
this._assertNotDestroyed();
|
|
256
|
+
const ex = this._instance.exports;
|
|
257
|
+
if (!ex || typeof ex.wasm_ctx_create_renderbuffer !== 'function') {
|
|
258
|
+
throw new Error('wasm_ctx_create_renderbuffer not found');
|
|
259
|
+
}
|
|
260
|
+
const handle = ex.wasm_ctx_create_renderbuffer(this._ctxHandle);
|
|
261
|
+
if (handle === 0) {
|
|
262
|
+
const msg = readErrorMessage(this._instance);
|
|
263
|
+
throw new Error(`Failed to create renderbuffer: ${msg}`);
|
|
264
|
+
}
|
|
265
|
+
return new WasmWebGLRenderbuffer(this, handle);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
bindRenderbuffer(target, renderbuffer) {
|
|
269
|
+
this._assertNotDestroyed();
|
|
270
|
+
const ex = this._instance.exports;
|
|
271
|
+
if (!ex || typeof ex.wasm_ctx_bind_renderbuffer !== 'function') {
|
|
272
|
+
throw new Error('wasm_ctx_bind_renderbuffer not found');
|
|
273
|
+
}
|
|
274
|
+
const rbHandle = renderbuffer && typeof renderbuffer === 'object' && typeof renderbuffer._handle === 'number' ? renderbuffer._handle : (renderbuffer >>> 0);
|
|
275
|
+
const code = ex.wasm_ctx_bind_renderbuffer(this._ctxHandle, target >>> 0, rbHandle);
|
|
276
|
+
_checkErr(code, this._instance);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
deleteRenderbuffer(renderbuffer) {
|
|
280
|
+
this._assertNotDestroyed();
|
|
281
|
+
const ex = this._instance.exports;
|
|
282
|
+
if (!ex || typeof ex.wasm_ctx_delete_renderbuffer !== 'function') {
|
|
283
|
+
throw new Error('wasm_ctx_delete_renderbuffer not found');
|
|
284
|
+
}
|
|
285
|
+
const rbHandle = renderbuffer && typeof renderbuffer === 'object' && typeof renderbuffer._handle === 'number' ? renderbuffer._handle : (renderbuffer >>> 0);
|
|
286
|
+
const code = ex.wasm_ctx_delete_renderbuffer(this._ctxHandle, rbHandle);
|
|
287
|
+
_checkErr(code, this._instance);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
renderbufferStorage(target, internalFormat, width, height) {
|
|
291
|
+
this._assertNotDestroyed();
|
|
292
|
+
const ex = this._instance.exports;
|
|
293
|
+
if (!ex || typeof ex.wasm_ctx_renderbuffer_storage !== 'function') {
|
|
294
|
+
throw new Error('wasm_ctx_renderbuffer_storage not found');
|
|
295
|
+
}
|
|
296
|
+
const code = ex.wasm_ctx_renderbuffer_storage(this._ctxHandle, target >>> 0, internalFormat >>> 0, width | 0, height | 0);
|
|
297
|
+
_checkErr(code, this._instance);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
framebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer) {
|
|
301
|
+
this._assertNotDestroyed();
|
|
302
|
+
const ex = this._instance.exports;
|
|
303
|
+
if (!ex || typeof ex.wasm_ctx_framebuffer_renderbuffer !== 'function') {
|
|
304
|
+
throw new Error('wasm_ctx_framebuffer_renderbuffer not found');
|
|
305
|
+
}
|
|
306
|
+
const rbHandle = renderbuffer && typeof renderbuffer === 'object' && typeof renderbuffer._handle === 'number' ? renderbuffer._handle : (renderbuffer >>> 0);
|
|
307
|
+
const code = ex.wasm_ctx_framebuffer_renderbuffer(
|
|
308
|
+
this._ctxHandle,
|
|
309
|
+
target >>> 0,
|
|
310
|
+
attachment >>> 0,
|
|
311
|
+
renderbuffertarget >>> 0,
|
|
312
|
+
rbHandle
|
|
313
|
+
);
|
|
314
|
+
_checkErr(code, this._instance);
|
|
315
|
+
}
|
|
316
|
+
|
|
241
317
|
readPixels(x, y, width, height, format, type_, out) {
|
|
242
318
|
this._assertNotDestroyed();
|
|
243
319
|
const ex = this._instance.exports;
|
|
@@ -918,11 +994,6 @@ export class WasmWebGL2RenderingContext {
|
|
|
918
994
|
copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height) { this._assertNotDestroyed(); throw new Error('not implemented'); }
|
|
919
995
|
texImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels) { this._assertNotDestroyed(); throw new Error('not implemented'); }
|
|
920
996
|
|
|
921
|
-
createRenderbuffer() { this._assertNotDestroyed(); throw new Error('not implemented'); }
|
|
922
|
-
bindRenderbuffer(target, rb) { this._assertNotDestroyed(); throw new Error('not implemented'); }
|
|
923
|
-
deleteRenderbuffer(rb) { this._assertNotDestroyed(); throw new Error('not implemented'); }
|
|
924
|
-
renderbufferStorage(target, internalformat, width, height) { this._assertNotDestroyed(); throw new Error('not implemented'); }
|
|
925
|
-
framebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer) { this._assertNotDestroyed(); throw new Error('not implemented'); }
|
|
926
997
|
checkFramebufferStatus(target) { this._assertNotDestroyed(); throw new Error('not implemented'); }
|
|
927
998
|
blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter) { this._assertNotDestroyed(); throw new Error('not implemented'); }
|
|
928
999
|
readBuffer(src) { this._assertNotDestroyed(); throw new Error('not implemented'); }
|
package/src/webgl2_resources.js
CHANGED
|
@@ -49,3 +49,19 @@ export class WasmWebGLBuffer {
|
|
|
49
49
|
this._deleted = false;
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Thin wrapper for a WebGLRenderbuffer handle returned from WASM.
|
|
55
|
+
* @implements {WebGLRenderbuffer}
|
|
56
|
+
*/
|
|
57
|
+
export class WasmWebGLRenderbuffer {
|
|
58
|
+
/**
|
|
59
|
+
* @param {import('./webgl2_context.js').WasmWebGL2RenderingContext} ctx
|
|
60
|
+
* @param {number} handle
|
|
61
|
+
*/
|
|
62
|
+
constructor(ctx, handle) {
|
|
63
|
+
this._ctx = ctx;
|
|
64
|
+
this._handle = handle;
|
|
65
|
+
this._deleted = false;
|
|
66
|
+
}
|
|
67
|
+
}
|
package/webgl2.debug.wasm
CHANGED
|
Binary file
|
package/webgl2.wasm
CHANGED
|
Binary file
|