Bug 1935611 - Fix libyuv/libpng link failed for loongarch64. r=glandium,tnikkel,ng
[gecko.git] / dom / webgpu / mochitest / test_compilation_message_pos.html
blobedfdb205a347277613eb51a9986e69bfc32fe695
1 <!doctype html>
2 <html>
3 <head>
4 <meta charset="utf-8" />
5 <script src="/tests/SimpleTest/SimpleTest.js"></script>
6 <link rel="stylesheet" href="/tests/SimpleTest/test.css" />
7 </head>
8 <body>
9 <script>
10 ok(
11 SpecialPowers.getBoolPref("dom.webgpu.enabled"),
12 "Pref should be enabled."
15 async function testBody() {
16 const adapter = await navigator.gpu.requestAdapter();
17 const device = await adapter.requestDevice();
19 device.pushErrorScope("validation");
20 const shaderModule = device.createShaderModule({
21 // `?` is invalid, and we want to see if the offset will be right with the kitten emoji
22 // before it.
23 code: "/*🐈🐈🐈🐈🐈🐈🐈*/?",
24 });
26 const error = await device.popErrorScope();
27 ok(error, "expected error from invalid shader");
28 is(error.message, "Shader module creation failed: Parsing error");
30 const compilationInfo = await shaderModule.getCompilationInfo();
31 is(compilationInfo.messages.length, 1);
33 const { length, lineNum, linePos, message, offset } =
34 compilationInfo.messages[0];
35 is(length, 1);
36 is(lineNum, 1);
37 is(linePos, 19);
38 is(
39 message,
41 Shader '' parsing error: expected global item ('struct', 'const', 'var', 'alias', ';', 'fn') or the end of the file, found '?'
42 ┌─ wgsl:1:12
43
44 1 │ /*🐈🐈🐈🐈🐈🐈🐈*/?
45 │ ^ expected global item ('struct', 'const', 'var', 'alias', ';', 'fn') or the end of the file
49 is(offset, 18);
52 SimpleTest.waitForExplicitFinish();
53 testBody()
54 .catch(e => ok(false, "Unhandled exception " + e))
55 .finally(() => SimpleTest.finish());
56 </script>
57 </body>
58 </html>