Skip to content

Commit b050aa3

Browse files
committed
fix: add missing semicolons in GLSL and WGSL compilation functions
1 parent 46dbafa commit b050aa3

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

src/compute-engine/compilation/glsl-target.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export class GLSLTarget extends GPUShaderTarget {
6868
.split('\n')
6969
.map((l) => ` ${l}`)
7070
.join('\n');
71-
return `${returnType} ${functionName}(${params}) {\n${indented};\n}`;
71+
return `${returnType} ${functionName}(${params}) {\n${indented}\n}`;
7272
}
7373
return `${returnType} ${functionName}(${params}) {
7474
return ${body};

src/compute-engine/compilation/gpu-target.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ function compileGPUSumProduct(
160160
`for (${indexDecl} = ${lowerStr}; ${index} <= ${upperStr}; ${index}++) {`,
161161
` ${acc} ${op}= ${body};`,
162162
`}`,
163-
`return ${acc}`,
163+
`return ${acc};`,
164164
];
165165
return lines.join('\n');
166166
}
@@ -2008,7 +2008,7 @@ export abstract class GPUShaderTarget implements LanguageTarget<Expression> {
20082008
if (stmts.length === 0) return '';
20092009
const last = stmts.length - 1;
20102010
stmts[last] = `return ${stmts[last]}`;
2011-
return stmts.join(';\n');
2011+
return stmts.join(';\n') + ';';
20122012
},
20132013
...options,
20142014
};

src/compute-engine/compilation/wgsl-target.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export class WGSLTarget extends GPUShaderTarget {
102102
.join('\n');
103103
return `fn ${functionName}(${params}) -> ${toWGSLType(
104104
returnType
105-
)} {\n${indented};\n}`;
105+
)} {\n${indented}\n}`;
106106
}
107107
return `fn ${functionName}(${params}) -> ${toWGSLType(returnType)} {
108108
return ${body};

test/compute-engine/compile-glsl.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ describe('GLSL COMPILATION', () => {
269269
expect(code).toMatchInlineSnapshot(`
270270
float a;
271271
a = cos(t);
272-
return a + 1.0
272+
return a + 1.0;
273273
`);
274274
});
275275

@@ -288,7 +288,7 @@ describe('GLSL COMPILATION', () => {
288288
float b;
289289
a = sin(x);
290290
b = cos(x);
291-
return a + b
291+
return a + b;
292292
`);
293293
});
294294

test/compute-engine/compile-wgsl.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ describe('WGSL COMPILATION', () => {
325325
expect(code).toMatchInlineSnapshot(`
326326
var a: f32;
327327
a = cos(t);
328-
return a + 1.0
328+
return a + 1.0;
329329
`);
330330
});
331331

@@ -344,7 +344,7 @@ describe('WGSL COMPILATION', () => {
344344
var b: f32;
345345
a = sin(x);
346346
b = cos(x);
347-
return a + b
347+
return a + b;
348348
`);
349349
});
350350

0 commit comments

Comments
 (0)