Skip to content

Commit 90ecf68

Browse files
committed
Fix varying variables not being added
1 parent abb82c7 commit 90ecf68

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/webgpu/p5.RendererWebGPU.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1818,12 +1818,12 @@ function rendererWebGPU(p5, fn) {
18181818
}
18191819

18201820
// Find the input parameter name from the main function signature (anchored to start)
1821-
const inputMatch = postMain.match(/^\s*\((\w+):\s*\w+\)/);
1821+
const inputMatch = main.match(/fn main\s*\((\w+):\s*\w+\)/);
18221822
if (inputMatch) {
18231823
const inputVarName = inputMatch[1];
18241824
initStatements = initStatements.replace(/INPUT_VAR/g, inputVarName);
18251825
// Insert after the main function parameter but before any other code (anchored to start)
1826-
postMain = postMain.replace(/^(\s*\(\w+:\s*\w+\)\s*[^{]*\{)/, `$1\n${initStatements}`);
1826+
postMain = initStatements + postMain;
18271827
}
18281828
}
18291829
}

0 commit comments

Comments
 (0)