Created
February 4, 2020 06:13
-
-
Save dcerisano/5bb7c3da428c2f216d2cd9ecd2291cb4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <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