webgl2 1.3.2 → 1.3.3

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,53 @@
4
4
 
5
5
  | File | Lines Covered | Lines Missed | Total Lines | Coverage |
6
6
  |---|---|---|---|---:|
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% 🟢 |
7
+ | src/coverage.rs | 14 | 5 | 19 | 73.68% 🟡 |
8
+ | src/decompiler/ast.rs | 2 | 4 | 6 | 33.33% 🟡 |
9
+ | src/decompiler/emitter.rs | 27 | 4 | 31 | 87.10% 🟢 |
10
10
  | src/decompiler/lifter.rs | 6 | 2 | 8 | 75.00% 🟡 |
11
- | src/decompiler/parser.rs | 2 | 1 | 3 | 66.67% 🟡 |
11
+ | src/decompiler/mod.rs | 1 | 0 | 1 | 100.00% 🟢 |
12
+ | src/decompiler/parser.rs | 3 | 2 | 5 | 60.00% 🟡 |
12
13
  | 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% 🟢 |
14
+ | src/error.rs | 31 | 6 | 37 | 83.78% 🟢 |
15
+ | src/lib.rs | 151 | 331 | 482 | 31.33% 🟠 |
16
+ | src/naga_wasm_backend/backend.rs | 153 | 30 | 183 | 83.61% 🟢 |
16
17
  | src/naga_wasm_backend/call_lowering.rs | 9 | 3 | 12 | 75.00% 🟡 |
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% 🟡 |
18
+ | src/naga_wasm_backend/control_flow.rs | 41 | 27 | 68 | 60.29% 🟡 |
19
+ | src/naga_wasm_backend/debug/stub.rs | 11 | 13 | 24 | 45.83% 🟠 |
20
+ | src/naga_wasm_backend/expressions.rs | 270 | 147 | 417 | 64.75% 🟡 |
20
21
  | src/naga_wasm_backend/function_abi.rs | 19 | 5 | 24 | 79.17% 🟡 |
21
- | src/naga_wasm_backend/functions/prep.rs | 5 | 0 | 5 | 100.00% 🟢 |
22
- | src/naga_wasm_backend/functions/registry.rs | 6 | 0 | 6 | 100.00% 🟢 |
23
- | src/naga_wasm_backend/memory_layout.rs | 15 | 1 | 16 | 93.75% 🟢 |
22
+ | src/naga_wasm_backend/functions/prep.rs | 4 | 0 | 4 | 100.00% 🟢 |
23
+ | src/naga_wasm_backend/functions/registry.rs | 5 | 0 | 5 | 100.00% 🟢 |
24
+ | src/naga_wasm_backend/memory_layout.rs | 12 | 0 | 12 | 100.00% 🟢 |
24
25
  | src/naga_wasm_backend/mod.rs | 7 | 0 | 7 | 100.00% 🟢 |
25
26
  | 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
- | src/wasm_gl_emu/framebuffer.rs | 1 | 0 | 1 | 100.00% 🟢 |
29
- | src/wasm_gl_emu/rasterizer.rs | 17 | 41 | 58 | 29.31% 🟠 |
30
- | src/wasm_gl_emu/transfer.rs | 0 | 2 | 2 | 0.00% 🟡 |
27
+ | src/naga_wasm_backend/types.rs | 23 | 6 | 29 | 79.31% 🟡 |
28
+ | src/wasm_gl_emu/device.rs | 4 | 1 | 5 | 80.00% 🟢 |
29
+ | src/wasm_gl_emu/framebuffer.rs | 2 | 0 | 2 | 100.00% 🟢 |
30
+ | src/wasm_gl_emu/rasterizer.rs | 19 | 42 | 61 | 31.15% 🟠 |
31
+ | src/wasm_gl_emu/transfer.rs | 0 | 3 | 3 | 0.00% 🟡 |
31
32
  | 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% 🟢 |
33
+ | src/webgl2_context/drawing.rs | 29 | 0 | 29 | 100.00% 🟢 |
34
+ | src/webgl2_context/ephemeral.rs | 4 | 0 | 4 | 100.00% 🟢 |
35
+ | src/webgl2_context/registry.rs | 9 | 0 | 9 | 100.00% 🟢 |
36
+ | src/webgl2_context/shaders.rs | 139 | 21 | 160 | 86.88% 🟢 |
37
+ | src/webgl2_context/state.rs | 3 | 0 | 3 | 100.00% 🟢 |
37
38
  | 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% 🟢 |
39
+ | src/webgl2_context/types.rs | 43 | 18 | 61 | 70.49% 🟡 |
40
+ | src/webgpu/adapter.rs | 6 | 1 | 7 | 85.71% 🟢 |
41
+ | src/webgpu/backend.rs | 63 | 19 | 82 | 76.83% 🟡 |
42
+ | src/webgpu/bind_group.rs | 2 | 0 | 2 | 100.00% 🟢 |
42
43
  | src/webgpu/buffer.rs | 1 | 2 | 3 | 33.33% 🟡 |
43
- | src/webgpu/command.rs | 7 | 5 | 12 | 58.33% 🟡 |
44
+ | src/webgpu/command.rs | 5 | 6 | 11 | 45.45% 🟠 |
44
45
  | 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% 🟡** |
46
+ | src/webgpu/texture.rs | 8 | 3 | 11 | 72.73% 🟡 |
47
+ | **Total** | **1240** | **703** | **1943** | **63.82% 🟡** |
47
48
 
48
49
  ## Top Missed Files
49
50
 
50
51
  | File | Lines Missed | Illustrative Line | Coverage |
51
52
  |---|---|---|---:|
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% 🟡 |
53
+ | src/lib.rs | 331/482 | [1994] `depth_write_enabled: u32,` | 31.33% 🟠 |
54
+ | src/naga_wasm_backend/expressions.rs | 147/417 | [1135] `if let Some(handle) = found_global {` | 64.75% 🟡 |
55
+ | src/wasm_gl_emu/rasterizer.rs | 42/61 | [370] `match eq {` | 31.15% 🟠 |
56
+ | src/naga_wasm_backend/backend.rs | 30/183 | [497] `func.instruction(&Instruction::End);` | 83.61% 🟢 |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webgl2",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
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",
@@ -135,6 +135,17 @@ export class WasmWebGL2RenderingContext {
135
135
  SAMPLER_2D = 0x8B5E;
136
136
  SAMPLER_3D = 0x8B5F;
137
137
  SAMPLER_CUBE = 0x8B60;
138
+ // Texture units (GL_TEXTURE0 .. GL_TEXTURE7)
139
+ TEXTURE0 = 0x84C0;
140
+ TEXTURE1 = 0x84C1;
141
+ TEXTURE2 = 0x84C2;
142
+ TEXTURE3 = 0x84C3;
143
+ TEXTURE4 = 0x84C4;
144
+ TEXTURE5 = 0x84C5;
145
+ TEXTURE6 = 0x84C6;
146
+ TEXTURE7 = 0x84C7;
147
+ // Max combined texture image units
148
+ MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D;
138
149
  ACTIVE_UNIFORMS = 0x8B86;
139
150
  ACTIVE_ATTRIBUTES = 0x8B89;
140
151
  VIEWPORT = 0x0BA2;
@@ -2219,6 +2230,15 @@ export class WasmWebGL2RenderingContext {
2219
2230
  throw new Error('wasm_ctx_get_parameter not found');
2220
2231
  }
2221
2232
 
2233
+ // Some parameters (like MAX_COMBINED_TEXTURE_IMAGE_UNITS) may not be
2234
+ // implemented in the WASM context. Provide sane defaults to keep test
2235
+ // harnesses running without requiring a full GL backend.
2236
+ if (pname === this.MAX_COMBINED_TEXTURE_IMAGE_UNITS) {
2237
+ // Provide at least 8 texture units which is sufficient for the kernels
2238
+ // used in the test suite.
2239
+ return 8;
2240
+ }
2241
+
2222
2242
  const ptr = ex.wasm_ctx_get_parameter(this._ctxHandle, pname);
2223
2243
  if (ptr === 0) {
2224
2244
  return null;
@@ -2317,6 +2337,26 @@ export class WasmWebGL2RenderingContext {
2317
2337
  const ex = this._instance.exports;
2318
2338
  return ex.wasm_ctx_is_texture(this._ctxHandle, tex._handle) !== 0;
2319
2339
  }
2340
+
2341
+ // Partial implementation of clearBufferfv. The full WebGL2 specification
2342
+ // supports multiple buffers; for the test harness we only need to clear
2343
+ // the first color attachment (drawbuffer 0) with a float color value.
2344
+ clearBufferfv(target, drawbuffer, values) {
2345
+ this._assertNotDestroyed();
2346
+ // Only support clearing color buffer for now.
2347
+ if (target !== this.COLOR) {
2348
+ throw new Error('clearBufferfv only supports COLOR target in this implementation');
2349
+ }
2350
+ // drawbuffer is typically 0 for these kernels
2351
+ if (drawbuffer !== 0) {
2352
+ throw new Error('clearBufferfv only supports drawbuffer 0 in this implementation');
2353
+ }
2354
+ // values is expected to be a Float32Array or array-like with 4 components.
2355
+ const v = values instanceof Float32Array ? values : new Float32Array(values);
2356
+ // Use existing clearColor / clear path which the WASM backend supports.
2357
+ this.clearColor(v[0], v[1], v[2], v[3]);
2358
+ this.clear(this.COLOR_BUFFER_BIT);
2359
+ }
2320
2360
  isFramebuffer(fb) {
2321
2361
  this._assertNotDestroyed();
2322
2362
  if (!fb || typeof fb !== 'object' || !(fb instanceof WasmWebGLFramebuffer)) return false;
package/webgl2.debug.wasm CHANGED
Binary file
package/webgl2.wasm CHANGED
Binary file