REGRESSION: ( r246394 ) webgpu/whlsl-buffer-fragment.html and webgpu/whlsl-buffer...
[WebKit-https.git] / LayoutTests / webgpu / pipeline-layouts.html
1 <!DOCTYPE html><!-- webkit-test-runner [ experimental:WebGPUEnabled=true ] -->
2 <meta charset=utf-8>
3 <title>Create GPUBindGroupLayout.</title>
4 <body>
5 <script src="js/webgpu-functions.js"></script>
6 <script src="../resources/testharness.js"></script>
7 <script src="../resources/testharnessreport.js"></script>
8 <script>
9 function createBindGroupLayoutBinding() {
10     return {
11         binding: 0,
12         visibility: GPUShaderStageBit.FRAGMENT | GPUShaderStageBit.VERTEX,
13         type: "storage-buffer"
14     };
15 }
16
17 test(() => {
18     const bindGroupLayoutDescriptor = { bindings: [createBindGroupLayoutBinding()] };
19     assert_not_equals(bindGroupLayoutDescriptor.bindings[0].visibility & GPUShaderStageBit.FRAGMENT, 0);
20     assert_not_equals(bindGroupLayoutDescriptor.bindings[0].visibility & GPUShaderStageBit.VERTEX, 0);
21     assert_equals(bindGroupLayoutDescriptor.bindings[0].type, "storage-buffer");
22 }, "Create a basic GPUBindGroupLayoutDescriptor."); 
23
24 promise_test(() => {
25     return getBasicDevice().then(function(device) {
26         const bindGroupLayout = device.createBindGroupLayout({ bindings: [createBindGroupLayoutBinding()] });
27         assert_true(bindGroupLayout instanceof GPUBindGroupLayout, "createBindGroupLayout returned a GPUBindGroupLayout");
28
29         const pipelineLayout = device.createPipelineLayout({ bindGroupLayouts: [bindGroupLayout] });
30         assert_true(pipelineLayout instanceof GPUPipelineLayout, "createPipelineLayout returned a GPUPipelineLayout");
31     }, function() {
32     });
33 }, "Create a basic GPUPipelineLayout wtih a GPUDevice.");
34 </script>
35 </body>