| <!DOCTYPE html> |
| <html> |
| <script src="js/webgpu-functions.js"></script> |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| <script> |
| const shaderCode = ` |
| vertex float4 vertex_main(uint vid : SV_VertexID) : SV_Position |
| { |
| float4 v; |
| switch (vid) { |
| case 0: |
| v = float4(-1, 1, 0, 1); |
| break; |
| case 1: |
| v = float4(-1, -1, 0, 1); |
| break; |
| case 2: |
| v = float4(1, 1, 0, 1); |
| break; |
| default: |
| v = float4(1, -1, 0, 1); |
| break; |
| } |
| return v; |
| } |
| |
| fragment float4 fragment_main() : SV_Target 0 |
| { |
| return float4(0.0, 1.0, 0.0, 1.0); |
| } |
| ` |
| |
| promise_test(() => { |
| return getBasicDevice().then(function(device) { |
| const shaderModule = device.createShaderModule({ code: shaderCode }); |
| |
| const layoutBinding = { binding: 0, visibility: GPUShaderStage.VERTEX, type: "storage-buffer" }; |
| const bindGroupLayout = device.createBindGroupLayout({ bindings: [layoutBinding] }); |
| const pipelineLayout = device.createPipelineLayout({ bindGroupLayouts: [bindGroupLayout] }); |
| |
| const pipeline = createBasicPipeline(shaderModule, device, null, pipelineLayout); |
| assert_true(pipeline instanceof GPURenderPipeline, "Successfully created GPURenderPipeline"); |
| }, function() { |
| }); |
| }, "Create basic GPURenderPipeline"); |
| </script> |
| </html> |