| <!DOCTYPE html><!-- webkit-test-runner [ experimental:WebGPUEnabled=true ] --> |
| <meta charset=utf-8> |
| <title>Create GPUBindGroupLayout.</title> |
| <body> |
| <script src="js/webgpu-functions.js"></script> |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| <script> |
| function createBindGroupLayoutBinding() { |
| return { |
| binding: 0, |
| visibility: GPUShaderStageBit.FRAGMENT | GPUShaderStageBit.VERTEX, |
| type: "storage-buffer" |
| }; |
| } |
| |
| test(() => { |
| const bindGroupLayoutDescriptor = { bindings: [createBindGroupLayoutBinding()] }; |
| assert_not_equals(bindGroupLayoutDescriptor.bindings[0].visibility & GPUShaderStageBit.FRAGMENT, 0); |
| assert_not_equals(bindGroupLayoutDescriptor.bindings[0].visibility & GPUShaderStageBit.VERTEX, 0); |
| assert_equals(bindGroupLayoutDescriptor.bindings[0].type, "storage-buffer"); |
| }, "Create a basic GPUBindGroupLayoutDescriptor."); |
| |
| promise_test(async () => { |
| const device = await getBasicDevice(); |
| const bindGroupLayout = device.createBindGroupLayout({ bindings: [createBindGroupLayoutBinding()] }); |
| assert_true(bindGroupLayout instanceof GPUBindGroupLayout, "createBindGroupLayout returned a GPUBindGroupLayout"); |
| |
| const pipelineLayout = device.createPipelineLayout({ bindGroupLayouts: [bindGroupLayout] }); |
| assert_true(pipelineLayout instanceof GPUPipelineLayout, "createPipelineLayout returned a GPUPipelineLayout"); |
| }, "Create a basic GPUPipelineLayout wtih a GPUDevice."); |
| </script> |
| </body> |