blob: e5756f3927074441ac4bc3a7cd84e1bd796881be [file] [log] [blame]
<!DOCTYPE html>
<html>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Lots of local variables.</title>
<script src="js/test-harness.js"></script>
<script src="../js/webgpu-functions.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
const whlslTests = {};
whlslTests.lotsOfLocalVariables = async () =>
{
let src = "int sum() {\n";
src += " int i = 0;\n";
let target = 0;
const numVars = 50;
for (let i = 0; i < numVars; i++) {
src += ` i = ${i};\n`;
src += ` int V${i} = (i + 3) * (i + 3);\n`;
target += (i + 3) * (i + 3);
}
src += " int result = 0;\n";
for (let i = 0; i < numVars; i++) {
src += ` result += V${i};\n`;
}
src += " return result;\n";
src += "}";
let program = src;
assert_equals(await callIntFunction(program, "sum", []), target);
}
runTests(whlslTests);
</script>
</html>