WebGPU.js 738 B

123456789101112131415161718192021222324252627282930313233
  1. class WebGPU {
  2. static isAvailable() {
  3. return ( navigator.gpu !== undefined );
  4. }
  5. static getErrorMessage() {
  6. const message = 'Your browser does not support <a href="https://gpuweb.github.io/gpuweb/" style="color:#000">WebGPU</a>.';
  7. const element = document.createElement( 'div' );
  8. element.id = 'webgpumessage';
  9. element.style.fontFamily = 'monospace';
  10. element.style.fontSize = '13px';
  11. element.style.fontWeight = 'normal';
  12. element.style.textAlign = 'center';
  13. element.style.background = '#fff';
  14. element.style.color = '#000';
  15. element.style.padding = '1.5em';
  16. element.style.width = '400px';
  17. element.style.margin = '5em auto 0';
  18. element.innerHTML = message;
  19. return element;
  20. }
  21. }
  22. export default WebGPU;