Skip to content

Commit f01dd8c

Browse files
Fix function visualizer
1 parent 025187e commit f01dd8c

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

apps/typegpu-docs/src/examples/rendering/function-visualizer/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const computePointsFn = (x: number) => {
8383

8484
const createComputePipeline = (exprCode: string) => {
8585
return root
86-
.with(functionExprSlot, tgpu['~unstable'].rawCodeSnippet(exprCode, d.f32, 'runtime'))
86+
.with(functionExprSlot, tgpu['~unstable'].rawCodeSnippet(`(${exprCode})`, d.f32, 'runtime'))
8787
.createGuardedComputePipeline(computePointsFn);
8888
};
8989

apps/typegpu-docs/tests/individual-example-tests/function-visualizer.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe('function visualizer example', () => {
3434
@group(0) @binding(1) var<uniform> propertiesUniform: Properties;
3535
3636
fn interpolatedFunction(x: f32) -> f32 {
37-
return x;
37+
return (x);
3838
}
3939
4040
@group(1) @binding(0) var<storage, read_write> lineVertices: array<vec2f>;
@@ -68,7 +68,7 @@ describe('function visualizer example', () => {
6868
@group(0) @binding(1) var<uniform> propertiesUniform: Properties;
6969
7070
fn interpolatedFunction(x: f32) -> f32 {
71-
return cos(x*5)/3-x;
71+
return (cos(x*5)/3-x);
7272
}
7373
7474
@group(1) @binding(0) var<storage, read_write> lineVertices: array<vec2f>;
@@ -102,7 +102,7 @@ describe('function visualizer example', () => {
102102
@group(0) @binding(1) var<uniform> propertiesUniform: Properties;
103103
104104
fn interpolatedFunction(x: f32) -> f32 {
105-
return x*sin(log(abs(x)));
105+
return (x*sin(log(abs(x))));
106106
}
107107
108108
@group(1) @binding(0) var<storage, read_write> lineVertices: array<vec2f>;

0 commit comments

Comments
 (0)