webgl2 1.3.1 → 1.3.2

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 CHANGED
@@ -4,52 +4,52 @@
4
4
 
5
5
  | File | Lines Covered | Lines Missed | Total Lines | Coverage |
6
6
  |---|---|---|---|---:|
7
- | src/coverage.rs | 9 | 5 | 14 | 64.29% 🟡 |
8
- | src/decompiler/ast.rs | 6 | 0 | 6 | 100.00% 🟢 |
9
- | src/decompiler/emitter.rs | 24 | 3 | 27 | 88.89% 🟢 |
7
+ | src/coverage.rs | 11 | 5 | 16 | 68.75% 🟡 |
8
+ | src/decompiler/ast.rs | 3 | 5 | 8 | 37.50% 🟠 |
9
+ | src/decompiler/emitter.rs | 30 | 3 | 33 | 90.91% 🟢 |
10
10
  | src/decompiler/lifter.rs | 6 | 2 | 8 | 75.00% 🟡 |
11
- | src/decompiler/parser.rs | 12 | 3 | 15 | 80.00% 🟢 |
12
- | src/decompiler/simplifier.rs | 36 | 2 | 38 | 94.74% 🟢 |
13
- | src/error.rs | 33 | 8 | 41 | 80.49% 🟢 |
14
- | src/lib.rs | 155 | 298 | 453 | 34.22% 🟠 |
15
- | src/naga_wasm_backend/backend.rs | 151 | 24 | 175 | 86.29% 🟢 |
11
+ | src/decompiler/parser.rs | 2 | 1 | 3 | 66.67% 🟡 |
12
+ | src/decompiler/simplifier.rs | 35 | 2 | 37 | 94.59% 🟢 |
13
+ | src/error.rs | 32 | 5 | 37 | 86.49% 🟢 |
14
+ | src/lib.rs | 144 | 305 | 449 | 32.07% 🟠 |
15
+ | src/naga_wasm_backend/backend.rs | 154 | 28 | 182 | 84.62% 🟢 |
16
16
  | src/naga_wasm_backend/call_lowering.rs | 9 | 3 | 12 | 75.00% 🟡 |
17
- | src/naga_wasm_backend/control_flow.rs | 38 | 30 | 68 | 55.88% 🟡 |
18
- | src/naga_wasm_backend/debug/stub.rs | 11 | 16 | 27 | 40.74% 🟠 |
19
- | src/naga_wasm_backend/expressions.rs | 270 | 155 | 425 | 63.53% 🟡 |
20
- | src/naga_wasm_backend/function_abi.rs | 15 | 8 | 23 | 65.22% 🟡 |
17
+ | src/naga_wasm_backend/control_flow.rs | 38 | 29 | 67 | 56.72% 🟡 |
18
+ | src/naga_wasm_backend/debug/stub.rs | 11 | 15 | 26 | 42.31% 🟠 |
19
+ | src/naga_wasm_backend/expressions.rs | 255 | 149 | 404 | 63.12% 🟡 |
20
+ | src/naga_wasm_backend/function_abi.rs | 19 | 5 | 24 | 79.17% 🟡 |
21
21
  | src/naga_wasm_backend/functions/prep.rs | 5 | 0 | 5 | 100.00% 🟢 |
22
22
  | src/naga_wasm_backend/functions/registry.rs | 6 | 0 | 6 | 100.00% 🟢 |
23
23
  | src/naga_wasm_backend/memory_layout.rs | 15 | 1 | 16 | 93.75% 🟢 |
24
- | src/naga_wasm_backend/mod.rs | 6 | 0 | 6 | 100.00% 🟢 |
25
- | src/naga_wasm_backend/output_layout.rs | 7 | 1 | 8 | 87.50% 🟢 |
26
- | src/naga_wasm_backend/types.rs | 22 | 6 | 28 | 78.57% 🟡 |
27
- | src/wasm_gl_emu/device.rs | 3 | 0 | 3 | 100.00% 🟢 |
24
+ | src/naga_wasm_backend/mod.rs | 7 | 0 | 7 | 100.00% 🟢 |
25
+ | src/naga_wasm_backend/output_layout.rs | 5 | 0 | 5 | 100.00% 🟢 |
26
+ | src/naga_wasm_backend/types.rs | 22 | 5 | 27 | 81.48% 🟢 |
27
+ | src/wasm_gl_emu/device.rs | 3 | 2 | 5 | 60.00% 🟡 |
28
28
  | src/wasm_gl_emu/framebuffer.rs | 1 | 0 | 1 | 100.00% 🟢 |
29
- | src/wasm_gl_emu/rasterizer.rs | 16 | 41 | 57 | 28.07% 🟠 |
30
- | src/wasm_gl_emu/transfer.rs | 3 | 0 | 3 | 100.00% 🟢 |
31
- | src/webgl2_context/blend.rs | 14 | 1 | 15 | 93.33% 🟢 |
32
- | src/webgl2_context/buffers.rs | 12 | 0 | 12 | 100.00% 🟢 |
33
- | src/webgl2_context/drawing.rs | 33 | 0 | 33 | 100.00% 🟢 |
34
- | src/webgl2_context/ephemeral.rs | 0 | 1 | 1 | 0.00% 🟡 |
35
- | src/webgl2_context/framebuffers.rs | 8 | 6 | 14 | 57.14% 🟡 |
36
- | src/webgl2_context/registry.rs | 11 | 0 | 11 | 100.00% 🟢 |
37
- | src/webgl2_context/shaders.rs | 137 | 29 | 166 | 82.53% 🟢 |
38
- | src/webgl2_context/state.rs | 33 | 9 | 42 | 78.57% 🟡 |
39
- | src/webgl2_context/textures.rs | 60 | 0 | 60 | 100.00% 🟢 |
40
- | src/webgl2_context/types.rs | 45 | 21 | 66 | 68.18% 🟡 |
41
- | src/webgpu/adapter.rs | 3 | 0 | 3 | 100.00% 🟢 |
42
- | src/webgpu/backend.rs | 52 | 17 | 69 | 75.36% 🟡 |
43
- | src/webgpu/bind_group.rs | 6 | 1 | 7 | 85.71% 🟢 |
44
- | src/webgpu/buffer.rs | 8 | 2 | 10 | 80.00% 🟢 |
45
- | src/webgpu/command.rs | 12 | 5 | 17 | 70.59% 🟡 |
46
- | **Total** | **1293** | **698** | **1991** | **64.94% 🟡** |
29
+ | src/wasm_gl_emu/rasterizer.rs | 17 | 41 | 58 | 29.31% 🟠 |
30
+ | src/wasm_gl_emu/transfer.rs | 0 | 2 | 2 | 0.00% 🟡 |
31
+ | src/webgl2_context/buffers.rs | 14 | 0 | 14 | 100.00% 🟢 |
32
+ | src/webgl2_context/drawing.rs | 30 | 0 | 30 | 100.00% 🟢 |
33
+ | src/webgl2_context/ephemeral.rs | 3 | 0 | 3 | 100.00% 🟢 |
34
+ | src/webgl2_context/registry.rs | 10 | 0 | 10 | 100.00% 🟢 |
35
+ | src/webgl2_context/shaders.rs | 141 | 27 | 168 | 83.93% 🟢 |
36
+ | src/webgl2_context/state.rs | 2 | 0 | 2 | 100.00% 🟢 |
37
+ | src/webgl2_context/textures.rs | 59 | 0 | 59 | 100.00% 🟢 |
38
+ | src/webgl2_context/types.rs | 46 | 17 | 63 | 73.02% 🟡 |
39
+ | src/webgpu/adapter.rs | 5 | 0 | 5 | 100.00% 🟢 |
40
+ | src/webgpu/backend.rs | 61 | 21 | 82 | 74.39% 🟡 |
41
+ | src/webgpu/bind_group.rs | 3 | 0 | 3 | 100.00% 🟢 |
42
+ | src/webgpu/buffer.rs | 1 | 2 | 3 | 33.33% 🟡 |
43
+ | src/webgpu/command.rs | 7 | 5 | 12 | 58.33% 🟡 |
44
+ | src/webgpu/shader.rs | 1 | 0 | 1 | 100.00% 🟢 |
45
+ | src/webgpu/texture.rs | 8 | 4 | 12 | 66.67% 🟡 |
46
+ | **Total** | **1221** | **684** | **1905** | **64.09% 🟡** |
47
47
 
48
48
  ## Top Missed Files
49
49
 
50
50
  | File | Lines Missed | Illustrative Line | Coverage |
51
51
  |---|---|---|---:|
52
- | src/lib.rs | 298/453 | [1994] `vertex_module_handle: u32,` | 34.22% 🟠 |
53
- | src/naga_wasm_backend/expressions.rs | 155/425 | [910] `if let Some(handle) = found_global {` | 63.53% 🟡 |
54
- | src/wasm_gl_emu/rasterizer.rs | 41/57 | [370] `match eq {` | 28.07% 🟠 |
55
- | src/naga_wasm_backend/control_flow.rs | 30/68 | [489] `let types = super::types::naga_to_wasm_types(` | 55.88% 🟡 |
52
+ | src/lib.rs | 305/449 | [1994] `depth_write_enabled: u32,` | 32.07% 🟠 |
53
+ | src/naga_wasm_backend/expressions.rs | 149/404 | [910] `if let Some(handle) = found_global {` | 63.12% 🟡 |
54
+ | src/wasm_gl_emu/rasterizer.rs | 41/58 | [370] `match eq {` | 29.31% 🟠 |
55
+ | src/naga_wasm_backend/control_flow.rs | 29/67 | [489] `let types = super::types::naga_to_wasm_types(` | 56.72% 🟡 |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webgl2",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "WebGL2 tools to derisk large GPU projects on the web beyond toys and demos.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -2219,10 +2219,6 @@ export class WasmWebGL2RenderingContext {
2219
2219
  throw new Error('wasm_ctx_get_parameter not found');
2220
2220
  }
2221
2221
 
2222
- if (pname === 0x8869 /* MAX_VERTEX_ATTRIBS */) {
2223
- return 16;
2224
- }
2225
-
2226
2222
  const ptr = ex.wasm_ctx_get_parameter(this._ctxHandle, pname);
2227
2223
  if (ptr === 0) {
2228
2224
  return null;
@@ -2230,71 +2226,67 @@ export class WasmWebGL2RenderingContext {
2230
2226
 
2231
2227
  const dv = new DataView(ex.memory.buffer);
2232
2228
 
2233
- if (pname === 0x1F00 || pname === 0x1F01 || pname === 0x1F02 || pname === 0x8B8C) {
2234
- const len = dv.getUint32(ptr - 16, true);
2235
- const bytes = new Uint8Array(ex.memory.buffer, ptr, len);
2236
- return new TextDecoder().decode(bytes);
2237
- }
2238
-
2239
- if (pname === 0x0BA2 /* VIEWPORT */) {
2240
- return new Int32Array(ex.memory.buffer.slice(ptr, ptr + 16));
2241
- }
2242
-
2243
- if (pname === 0x0C22 /* COLOR_CLEAR_VALUE */) {
2244
- return new Float32Array(ex.memory.buffer.slice(ptr, ptr + 16));
2245
- }
2246
-
2247
- if (pname === 0x0C23 /* COLOR_WRITEMASK */) {
2248
- const mem = new Uint8Array(ex.memory.buffer, ptr, 4);
2249
- return [mem[0] !== 0, mem[1] !== 0, mem[2] !== 0, mem[3] !== 0];
2250
- }
2251
-
2252
- if (pname === 0x8CA6 /* DRAW_FRAMEBUFFER_BINDING */ || pname === 0x8CAA /* READ_FRAMEBUFFER_BINDING */) {
2253
- const handle = dv.getInt32(ptr, true);
2254
- if (handle === 0) return null;
2255
- return this._fbHandles.get(handle) || null;
2256
- }
2257
-
2258
- if (pname === 0x8CA7 /* RENDERBUFFER_BINDING */) {
2259
- const handle = dv.getInt32(ptr, true);
2260
- if (handle === 0) return null;
2261
- return this._rbHandles.get(handle) || null;
2262
- }
2229
+ switch (pname) {
2230
+ case this.VENDOR:
2231
+ case this.RENDERER:
2232
+ case this.VERSION:
2233
+ case this.SHADING_LANGUAGE_VERSION: {
2234
+ const len = dv.getUint32(ptr - 16, true);
2235
+ const bytes = new Uint8Array(ex.memory.buffer, ptr, len);
2236
+ return new TextDecoder().decode(bytes);
2237
+ }
2263
2238
 
2264
- if (pname === 0x8824 /* MAX_DRAW_BUFFERS */ || pname === 0x8CDF /* MAX_COLOR_ATTACHMENTS */) {
2265
- return dv.getInt32(ptr, true);
2266
- }
2239
+ case this.VIEWPORT:
2240
+ return new Int32Array(ex.memory.buffer.slice(ptr, ptr + 16));
2267
2241
 
2268
- if (pname >= 0x8825 /* DRAW_BUFFER0 */ && pname <= 0x882C /* DRAW_BUFFER7 */) {
2269
- return dv.getInt32(ptr, true);
2270
- }
2242
+ case this.COLOR_CLEAR_VALUE:
2243
+ return new Float32Array(ex.memory.buffer.slice(ptr, ptr + 16));
2271
2244
 
2272
- if (pname === 0x0B72 /* DEPTH_WRITEMASK */) {
2273
- return dv.getUint8(ptr) !== 0;
2274
- }
2245
+ case this.COLOR_WRITEMASK: {
2246
+ const mem = new Uint8Array(ex.memory.buffer, ptr, 4);
2247
+ return [mem[0] !== 0, mem[1] !== 0, mem[2] !== 0, mem[3] !== 0];
2248
+ }
2275
2249
 
2276
- if (pname === 0x0B98 /* STENCIL_WRITEMASK */ || pname === 0x8CA5 /* STENCIL_BACK_WRITEMASK */) {
2277
- return dv.getInt32(ptr, true);
2278
- }
2250
+ case this.DRAW_FRAMEBUFFER_BINDING:
2251
+ case this.READ_FRAMEBUFFER_BINDING: {
2252
+ const handle = dv.getInt32(ptr, true);
2253
+ if (handle === 0) return null;
2254
+ return this._fbHandles.get(handle) || null;
2255
+ }
2279
2256
 
2280
- const singleIntParams = [
2281
- 0x0B74, // DEPTH_FUNC
2282
- 0x0B92, // STENCIL_FUNC
2283
- 0x0B93, // STENCIL_VALUE_MASK
2284
- 0x0B97, // STENCIL_REF
2285
- 0x8800, // STENCIL_BACK_FUNC
2286
- 0x8CA4, // STENCIL_BACK_VALUE_MASK
2287
- 0x8CA3, // STENCIL_BACK_REF
2288
- 0x0B94, // STENCIL_FAIL
2289
- 0x0B95, // STENCIL_PASS_DEPTH_FAIL
2290
- 0x0B96, // STENCIL_PASS_DEPTH_PASS
2291
- 0x8801, // STENCIL_BACK_FAIL
2292
- 0x8802, // STENCIL_BACK_PASS_DEPTH_FAIL
2293
- 0x8803, // STENCIL_BACK_PASS_DEPTH_PASS
2294
- ];
2257
+ case this.RENDERBUFFER_BINDING: {
2258
+ const handle = dv.getInt32(ptr, true);
2259
+ if (handle === 0) return null;
2260
+ return this._rbHandles.get(handle) || null;
2261
+ }
2295
2262
 
2296
- if (singleIntParams.includes(pname)) {
2297
- return dv.getInt32(ptr, true);
2263
+ case this.MAX_DRAW_BUFFERS:
2264
+ case this.MAX_COLOR_ATTACHMENTS:
2265
+ case this.MAX_VERTEX_ATTRIBS:
2266
+ case this.STENCIL_WRITEMASK:
2267
+ case this.STENCIL_BACK_WRITEMASK:
2268
+ case this.DEPTH_FUNC:
2269
+ case this.STENCIL_FUNC:
2270
+ case this.STENCIL_VALUE_MASK:
2271
+ case this.STENCIL_REF:
2272
+ case this.STENCIL_BACK_FUNC:
2273
+ case this.STENCIL_BACK_VALUE_MASK:
2274
+ case this.STENCIL_BACK_REF:
2275
+ case this.STENCIL_FAIL:
2276
+ case this.STENCIL_PASS_DEPTH_FAIL:
2277
+ case this.STENCIL_PASS_DEPTH_PASS:
2278
+ case this.STENCIL_BACK_FAIL:
2279
+ case this.STENCIL_BACK_PASS_DEPTH_FAIL:
2280
+ case this.STENCIL_BACK_PASS_DEPTH_PASS:
2281
+ return dv.getInt32(ptr, true);
2282
+
2283
+ case this.DEPTH_WRITEMASK:
2284
+ return dv.getUint8(ptr) !== 0;
2285
+
2286
+ default:
2287
+ if (pname >= this.DRAW_BUFFER0 && pname <= this.DRAW_BUFFER7) {
2288
+ return dv.getInt32(ptr, true);
2289
+ }
2298
2290
  }
2299
2291
 
2300
2292
  throw new Error(`getParameter for ${pname} not implemented`);
package/webgl2.debug.wasm CHANGED
Binary file
package/webgl2.wasm CHANGED
Binary file