| <!DOCTYPE html> |
| <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: GPUShaderStage.FRAGMENT | GPUShaderStage.VERTEX, |
| type: "storage-buffer" |
| }; |
| } |
| |
| test(() => { |
| const bindGroupLayoutDescriptor = { bindings: [createBindGroupLayoutBinding()] }; |
| assert_not_equals(bindGroupLayoutDescriptor.bindings[0].visibility & GPUShaderStage.FRAGMENT, 0); |
| assert_not_equals(bindGroupLayoutDescriptor.bindings[0].visibility & GPUShaderStage.VERTEX, 0); |
| assert_equals(bindGroupLayoutDescriptor.bindings[0].type, "storage-buffer"); |
| }, "Create a basic GPUBindGroupLayoutDescriptor."); |
| |
| promise_test(() => { |
| return getBasicDevice().then(function(device) { |
| 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"); |
| }, function() { |
| }); |
| }, "Create a basic GPUPipelineLayout wtih a GPUDevice."); |
| </script> |
| </body> |