We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent abb82c7 commit 90ecf68Copy full SHA for 90ecf68
1 file changed
src/webgpu/p5.RendererWebGPU.js
@@ -1818,12 +1818,12 @@ function rendererWebGPU(p5, fn) {
1818
}
1819
1820
// Find the input parameter name from the main function signature (anchored to start)
1821
- const inputMatch = postMain.match(/^\s*\((\w+):\s*\w+\)/);
+ const inputMatch = main.match(/fn main\s*\((\w+):\s*\w+\)/);
1822
if (inputMatch) {
1823
const inputVarName = inputMatch[1];
1824
initStatements = initStatements.replace(/INPUT_VAR/g, inputVarName);
1825
// 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}`);
+ postMain = initStatements + postMain;
1827
1828
1829
0 commit comments