Most appropriate sub-area of p5.js?
p5.js version
2.3.2 / main at aa192a2
Web browser and version
Chromium (Vitest browser mode; exact version not recorded)
Operating system
Fedora Linux
Steps to reproduce this
In the existing test/unit/webgl/p5.Shader.js harness, render this shader:
myp5.createCanvas(100, 50, myp5.WEBGL);
const testShader = myp5.baseMaterialShader().modify(
() => {
myp5.getPixelInputs(inputs => {
let color = myp5.float(0.2) + inputs.texCoord.x * 0.2;
const saved = color;
if (inputs.texCoord.x > 0.5) {
// Leave color unchanged.
} else {
color = color + 0.3;
}
inputs.color = [saved, color, 0, 1];
return inputs;
});
},
{ myp5 }
);
myp5.noStroke();
myp5.shader(testShader);
myp5.plane(myp5.width, myp5.height);
Check myp5.get(25, 25) and myp5.get(75, 25).
- Left: expected RGB approximately
[64, 140, 0], actual [140, 140, 0].
- Right: expected and actual
[89, 89, 0].
saved should retain its earlier value, but the else branch overwrites it. The generated GLSL uses T0 for both values and outputs vec4(T0, T0, 0, 1).
Reproduced on aa192a2d8. The relevant codegen is unchanged at 93c7ddbb by source comparison; I haven't rerun it there.
Most appropriate sub-area of p5.js?
p5.js version
2.3.2 / main at aa192a2
Web browser and version
Chromium (Vitest browser mode; exact version not recorded)
Operating system
Fedora Linux
Steps to reproduce this
In the existing
test/unit/webgl/p5.Shader.jsharness, render this shader:Check
myp5.get(25, 25)andmyp5.get(75, 25).[64, 140, 0], actual[140, 140, 0].[89, 89, 0].savedshould retain its earlier value, but the else branch overwrites it. The generated GLSL usesT0for both values and outputsvec4(T0, T0, 0, 1).Reproduced on
aa192a2d8. The relevant codegen is unchanged at93c7ddbbby source comparison; I haven't rerun it there.