| <!DOCTYPE html><!-- webkit-test-runner [ experimental:WebGPUEnabled=true ] --> |
| <meta charset=utf-8> |
| <title>Create GPUDevices from various options.</title> |
| <body> |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| <script> |
| promise_test(async () => { |
| const defaultAdapter = await navigator.gpu.requestAdapter(); |
| const device = await defaultAdapter.requestDevice(); |
| |
| assert_true(device instanceof GPUDevice, "Default device successfully created."); |
| }, "Create the default device."); |
| |
| promise_test(async () => { |
| const lowPowerAdapter = await navigator.gpu.requestAdapter({ powerPreference: "low-power" }); |
| const device = await lowPowerAdapter.requestDevice(); |
| |
| assert_true(device instanceof GPUDevice, "Device successfully created using low-power option."); |
| }, "Create a device with a low-power option."); |
| |
| promise_test(async () => { |
| const highPerfAdapter = await navigator.gpu.requestAdapter({ powerPreference: "high-performance" }); |
| const device = await highPerfAdapter.requestDevice(); |
| |
| assert_true(device instanceof GPUDevice, "Device successfully created using high-performance option."); |
| }, "Create a device with a high-performance option."); |
| </script> |
| </body> |