Skip to content

Commit cd2e29f

Browse files
committed
test: update hook signatures in framebuffer and missing frag files
1 parent 24828a0 commit cd2e29f

File tree

5 files changed

+18
-16
lines changed

5 files changed

+18
-16
lines changed

src/webgpu/shaders/material.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -416,9 +416,9 @@ fn main(input: FragmentInput) -> @location(0) vec4<f32> {
416416
inputs.emissiveMaterial
417417
);
418418
419-
var outColor = HOOK_getFinalColor(
420-
HOOK_combineColors(components), input.vTexCoord
421-
);
419+
var outColor = HOOK_getFinalColor(
420+
HOOK_combineColors(components), input.vTexCoord
421+
);
422422
outColor = vec4<f32>(outColor.rgb * outColor.a, outColor.a);
423423
HOOK_afterFragment();
424424
return outColor;

test/unit/visual/cases/webgl.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,19 +1135,18 @@ visualSuite('WebGL', function() {
11351135
});
11361136

11371137
visualTest('texCoord is available in getFinalColor', (p5, screenshot) => {
1138-
p5.createCanvas(50, 50, p5.WEBGL);
1139-
const shader = p5.baseColorShader().modify(() => {
1140-
getFinalColor((color) => {
1141-
color = [texCoord[0], texCoord[1], 0, 1];
1142-
return color;
1138+
p5.createCanvas(50, 50, p5.WEBGL);
1139+
const shader = p5.baseColorShader().modify(() => {
1140+
p5.finalColor.begin();
1141+
p5.finalColor.set([p5.finalColor.texCoord, 0, 1]);
1142+
p5.finalColor.end();
1143+
}, { p5 });
1144+
p5.background(0);
1145+
p5.shader(shader);
1146+
p5.noStroke();
1147+
p5.plane(50, 50);
1148+
screenshot();
11431149
});
1144-
});
1145-
p5.background(0);
1146-
p5.shader(shader);
1147-
p5.noStroke();
1148-
p5.plane(50, 50);
1149-
screenshot();
1150-
});
11511150

11521151
visualSuite('auto-return for shader hooks', () => {
11531152
visualTest('auto-returns input struct when return is omitted', (p5, screenshot) => {
390 Bytes
Loading
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"numScreenshots": 1
3+
}

test/unit/webgl/p5.Shader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ suite('p5.Shader', function() {
318318
uniforms: {
319319
'sampler2D myTex': null
320320
},
321-
'vec4 getFinalColor': `(vec4 c) {
321+
'vec4 getFinalColor': `(vec4 c, vec2 texCoord) {
322322
return getTexture(myTex, vec2(0.,0.));
323323
}`
324324
});

0 commit comments

Comments
 (0)