Add mat2 uniform support to WebGL setUniform, fixing silent no-op (#8…#8978
Conversation
Continuous ReleaseCDN linkPublished PackagesCommit hash: db05648 Previous deploymentsThis is an automated message. |
davepagurek
left a comment
There was a problem hiding this comment.
Thanks, this is good to go I think! Are you also interested in looking into p5.strands support for matrices? Currently we don't support them, so we resort to hacks like this:
p5.js/src/core/p5.Renderer3D.js
Lines 1929 to 1943 in 5743cb5
If that's of interest, it'll help simplify the above snippet and help tie into @perminder-17's work on a transformation API in p5.strands, so we'd appreciate the help! A start would be to make an issue for it.
|
@all-contributors please add @harshiltewari2004 for code |
|
@harshiltewari2004 already contributed before to code |
|
Thanks @davepagurek! Yes, I'd be glad to look into strands matrix support — that hack is a great motivating example. I'll open an issue to lay out the problem and a proposed approach so we can settle scope before any code. Since this ties into @perminder-17's transformation API work, I'll tag him there too so we can make sure the direction lines up rather than overlapping. |
Resolves #8939
Changes
FLOAT_MAT2case to thesetUniformswitch insrc/webgl/utils.js(gl.uniformMatrix2fv), mirroring the existingmat3/mat4 cases — completing part of the
//@todoFLOAT_MAT2to theisArrayclassification ingetWebGLUniformMetadata, so mat2 uniforms take the array path inp5.Shader's value caching
createFilterShaderwith auniform mat2driving the fragment color from the matrix diagonal). Verified the test
fails on unfixed code and passes with the fix.
Note: there was previously no direct setUniform test coverage for matrix
uniforms of any size, in either backend — this test establishes the pattern.
mat2 remains untested on the WebGPU side (where it already works); happy to
add a WGSL counterpart in a follow-up if wanted.
While verifying with a full test run, I hit an intermittent failure in
Typography > textWeight > can control non-variable fonts— unrelated tothis change (2D-mode test, no path to the modified code; passes repeatedly
in isolation on this branch). It loads its font from Google Fonts at test
time, which is the likely flake source.
PR Checklist
npm run lintpasses