e06f72424d6952c2f16b86baa7074528beb46be3
[WebKit-https.git] / LayoutTests / webgpu / whlsl / use-undefined-variable-2.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../js/webgpu-functions.js"></script>
5 <script src="../../resources/js-test-pre.js"></script>
6 </head>
7 <body>
8 <script>
9 const shaderSource = `
10 [numthreads(1, 1, 1)]
11 compute void computeShader(device float[] buffer : register(u0), float3 threadID : SV_DispatchThreadID) {
12     float4 vec = float4(x,x,x,x);
13 }
14 `;
15
16 async function start() {
17     const adapter = await navigator.gpu.requestAdapter();
18     const device = await adapter.requestDevice();
19
20     const shaderModule = device.createShaderModule({code: shaderSource, isWHLSL: true});
21     const computeStage = {module: shaderModule, entryPoint: "computeShader"};
22
23     const bindGroupLayoutDescriptor = {bindings: [{binding: 0, visibility: 7, type: "storage-buffer"}]};
24     const bindGroupLayout = device.createBindGroupLayout(bindGroupLayoutDescriptor);
25     const pipelineLayoutDescriptor = {bindGroupLayouts: [bindGroupLayout]};
26     const pipelineLayout = device.createPipelineLayout(pipelineLayoutDescriptor);
27
28     const computePipelineDescriptor = {computeStage, layout: pipelineLayout};
29     const computePipeline = device.createComputePipeline(computePipelineDescriptor);
30 }
31
32 window.jsTestIsAsync = true;
33 getBasicDevice().then(function(device) {
34     start(device).then(function() {
35         testPassed("");
36         finishJSTest();
37     }, function() {
38         testFailed("");
39         finishJSTest();
40     });
41 }, function() {
42     testPassed("");
43     finishJSTest();
44 });
45 </script>
46 <script src="../../resources/js-test-post.js"></script>
47 </body>
48 </html>