| <canvas id="a"></canvas> |
| <canvas id="b"></canvas> |
| <script> |
| if (window.testRunner) |
| window.testRunner.dumpAsText(); |
| |
| function run() |
| { |
| const out = document.querySelector("p"); |
| let result = ""; |
| |
| if (!window.internals) { |
| out.innerText = "Test requires internals."; |
| return; |
| } |
| |
| const canvasA = document.getElementById("a"); |
| const glA = canvasA.getContext("webgl"); |
| const requested = internals.requestedGPU(glA); |
| let defaultValue = "OK"; |
| if (requested != "default" && requested != "low-power") |
| defaultValue = "Unexpected"; |
| |
| result += `Default: ${defaultValue}<br>`; |
| |
| const canvasB = document.getElementById("b"); |
| const glB = canvasB.getContext("webgl", {xrCompatible: true}) |
| |
| result += `XR Compatible (should be high-performance): ${internals.requestedGPU(glB)}<br>`; |
| |
| out.innerHTML = result; |
| } |
| |
| window.addEventListener("load", run, false); |
| </script> |
| <p></p> |