Skip to content

Shader uniforms not updated when using an array of values #5670

@telinc1

Description

@telinc1

Version

  • Phaser Version: 3.54

Description

When updating a shader's uniform using arrays of values (e.g. set4fv instead of set4f, or any of the matrix methods), the uniform will not actually be updated. This causes #5660 (and perhaps other issues?).

All uniform setters, both on WebGLPipelines and WebGLShaders, call the lower-level setUniform2/3/4 methods to update the values. These methods check for identity between the old and the new values, which is a good optimization when using scalar values. For arrays, however, if the same object is passed in, the uniform isn't updated even if the values in the array are the different.

This has been an issue since 3.50. I'd assumed this was intended, but I'm no longer sure considering Phaser gets confused by it, too. In the case of #5660, a setMatrix3fv call gets ignored.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions