Skip to content

Instantly share code, notes, and snippets.

@dcerisano
Created February 4, 2020 06:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcerisano/5bb7c3da428c2f216d2cd9ecd2291cb4 to your computer and use it in GitHub Desktop.
Save dcerisano/5bb7c3da428c2f216d2cd9ecd2291cb4 to your computer and use it in GitHub Desktop.
/// <reference types="@webgpu/types" />
import { assert } from '../util/index.js';
let impl = require(`/home/dcerisano/git/webgpu/generated/0.0.1/linux/build/Release/addon-linux.node`);
export function getGPU(): GPU {
if (impl) {
return impl;
}
assert(
typeof navigator !== 'undefined' && navigator.gpu !== undefined,
'No WebGPU implementation found'
);
impl = navigator.gpu;
return impl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment