Skip to content

Add mat2 uniform support to WebGL setUniform, fixing silent no-op (#8…#8978

Open
harshiltewari2004 wants to merge 1 commit into
processing:mainfrom
harshiltewari2004:webgl-mat2-uniform-support
Open

Add mat2 uniform support to WebGL setUniform, fixing silent no-op (#8…#8978
harshiltewari2004 wants to merge 1 commit into
processing:mainfrom
harshiltewari2004:webgl-mat2-uniform-support

Conversation

@harshiltewari2004

Copy link
Copy Markdown
Contributor

Resolves #8939

Changes

  • Added the missing FLOAT_MAT2 case to the setUniform switch in
    src/webgl/utils.js (gl.uniformMatrix2fv), mirroring the existing
    mat3/mat4 cases — completing part of the //@todo
  • Added FLOAT_MAT2 to the isArray classification in
    getWebGLUniformMetadata, so mat2 uniforms take the array path in
    p5.Shader's value caching
  • Added a visual regression test (createFilterShader with a uniform mat2
    driving 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 to
this 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 lint passes
  • [Inline reference] is included / updated — N/A, no documented API change
  • [Unit tests] are included / updated

@p5-bot

p5-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

Continuous Release

CDN link

Published Packages

Commit hash: db05648

Previous deployments

This is an automated message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[p5.js 2.0+ Bug Report]:WebGL silently ignores mat2 shader uniforms (no error, no warning)

1 participant