blob: b3dcb6bfe550d5771779353c5d3a0968064f1061 [file] [log] [blame]
<!DOCTYPE html>
<html>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Test the WHLSL test harness.</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.makeArrayRefFromArrayRef = async () => {
await checkFail(
`
int bar(thread int[] ref)
{
return ref[0];
}
int baz(thread int[] ptr)
{
return bar(@ptr);
}
int foo()
{
int x = 48;
return baz(@x);
}
`);
}
whlslTests.makeArrayRefFromLocal = async () =>
{
let program = `
int bar(thread int[] ref)
{
return ref[0];
}
int foo()
{
int x = 48;
return bar(@x);
}
`;
assert_equals(await callIntFunction(program, "foo", []), 48);
}
whlslTests.makeArrayRefFromPointer = async () =>
{
let program = `
int bar(thread int[] ref)
{
return ref[0];
}
int baz(thread int* ptr)
{
return bar(@ptr);
}
int foo()
{
int x = 48;
return baz(&x);
}
`;
assert_equals(await callIntFunction(program, "foo", []), 48);
}
runTests(whlslTests);
</script>
</html>