### Most appropriate sub-area of p5.js? - [ ] Accessibility - [ ] Color - [ ] Core/Environment/Rendering - [ ] Data - [ ] DOM - [ ] Events - [ ] Image - [ ] IO - [ ] Math - [ ] Typography - [ ] Utilities - [x] WebGL - [ ] WebGPU - [ ] p5.strands - [ ] Build process - [ ] Unit testing - [ ] Internationalization - [ ] Friendly errors - [ ] Other (specify if possible) ### p5.js version 2.3.0 ### Web browser and version Not browser-specific — the missing code path is in p5's source, so this reproduces in any WebGL-capable browser. ### Operating system Not OS-specific (same reason). ### Steps to reproduce this ### Steps to reproduce 1. Create a WebGL shader that declares a `uniform mat2`. 2. Set that uniform from sketch code with `setUniform(...)`. 3. Observe: **no error and no warning**, but the value never reaches the shader — the uniform stays at the GL default (zero matrix). The identical pattern with a `mat3` or `mat4` uniform works. ### Minimal illustration > The definitive evidence is the source analysis below — this snippet just shows the symptom. ```js let s; function setup() { createCanvas(100, 100, WEBGL); s = createFilterShader(` precision highp float; uniform mat2 uM; void main() { // diagonal of uM drives the red & green channels gl_FragColor = vec4(uM[0][0], uM[1][1], 0.0, 1.0); } `); } function draw() { s.setUniform('uM', [1.0, 0.0, 0.0, 1.0]); // identity filter(s); // Expected: yellow (uM uploaded as identity -> 1,1,0) // Actual: black (uM never uploaded -> stays at the 0 matrix -> 0,0,0) } ``` ### Root cause The root cause is in `src/webgl/utils.js`. The `setUniform` switch handles `FLOAT_MAT3` (line 226, via `gl.uniformMatrix3fv`) and `FLOAT_MAT4` (line 229, via `gl.uniformMatrix4fv`), but there is **no `case gl.FLOAT_MAT2` and no `default:` branch** — the switch ends with `//@todo complete all types` at line 327. A `mat2` uniform falls straight through and is never uploaded. A repo-wide check confirms this is structural, not a one-off miss: `gl.uniformMatrix2fv` — the WebGL call required to upload a 2×2 matrix — appears **zero times anywhere in `src/`**, while `uniformMatrix3fv` and `uniformMatrix4fv` each appear once. So there is no code path on which a `mat2` uniform could reach the GPU. `getWebGLUniformMetadata` likewise omits `FLOAT_MAT2` from its `isArray` classification (around lines 360–369), consistent with `mat2` never having been wired up. ### WebGL vs WebGPU For contrast (as motivation, not the core claim): the **WebGPU** backend handles square `mat2`. In `src/webgpu/p5.RendererWebGPU.js` it parses the matrix dimension generically (~line 2174) and maps `mat2x2<f32>` (line 3103), and throws a clear `Non-square matrices not implemented yet` for non-square (line 2172). So `mat2` works in WebGPU but silently does nothing in WebGL — and where WebGPU at least fails loudly on what it doesn't support, WebGL fails silently. (Non-square matrices are out of scope here; WebGPU's explicit throw shows that's separately tracked.) ### Possible approaches (would like maintainer direction before implementing) 1. Add the missing `FLOAT_MAT2` case (`gl.uniformMatrix2fv`) to the switch and to the `isArray` classification — completing the `//@todo`. 2. Or, if full `mat2` support isn't wanted yet, emit a friendly warning for currently-unsupported uniform types instead of silently no-op'ing, in keeping with p5's friendly-error approach. Happy to fix this myself once an approach is agreed on @ksen0 @davepagurek !