Add a runtime-disabled dialog element skeleton
[WebKit-https.git] / LayoutTests / webgpu / whlsl / null-array-ref.html
1 <!DOCTYPE html>
2 <html>
3 <meta charset=utf-8>
4 <meta name="timeout" content="long">
5 <title>Test loops.</title>
6 <script src="js/test-harness.js"></script>
7 <script src="../js/webgpu-functions.js"></script>
8 <script src="../../resources/testharness.js"></script>
9 <script src="../../resources/testharnessreport.js"></script>
10 <script>
11 const whlslTests = {};
12
13 whlslTests.dereferenceDefaultNullArrayRef = async () =>
14 {
15     let program = `
16         int foo()
17         {
18             thread int[] p;
19             return p[0];
20         }
21     `;
22     assert_equals(await callIntFunction(program, "foo", []), 0);
23 }
24
25 whlslTests.defaultInitializedNullArrayRefIntLiteral = async () =>
26 {
27     let program = `
28         int foo()
29         {
30             thread int[] p = null;
31             return p[0];
32         }
33     `;
34     assert_equals(await callIntFunction(program, "foo", []), 0);
35 }
36
37 whlslTests.passNullToPtrMonomorphicArrayRef = async () =>
38 {
39     let program = `
40         int foo(thread int[] ptr)
41         {
42             return ptr[0u];
43         }
44         int bar()
45         {
46             return foo(null);
47         }
48     `;
49     assert_equals(await callIntFunction(program, "bar", []), 0);
50 }
51
52 whlslTests.loadNull = async () =>
53 {
54     await checkFail(
55         `
56             void sink(thread int* x) { }
57             void foo() { sink(*null); }
58         `);
59 }
60
61 runTests(whlslTests);
62 </script>
63 </html>
64