| <!DOCTYPE html> |
| <html> |
| <meta charset=utf-8> |
| <meta name="timeout" content="long"> |
| <title>bad swizzle.</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.cantTakeAddressOfSwizzle = async () => { |
| await checkFail(` |
| void foo() { |
| int2 v; |
| thread int* x = &v.x; |
| } |
| `); |
| |
| await checkFail(` |
| void foo() { |
| int2 v; |
| thread int2* x = &v.xy; |
| } |
| `); |
| }; |
| |
| whlslTests.cantAssignRvalueSwizzle = async () => { |
| await checkFail(` |
| int2 x() { |
| int2 v; |
| return v; |
| } |
| void foo() { |
| x().xy = int2(10, 20); |
| } |
| `); |
| }; |
| |
| runTests(whlslTests); |
| </script> |
| </html> |