Add get hardware info helper
This commit is contained in:
parent
763952de21
commit
30296409ac
1 changed files with 19 additions and 0 deletions
19
src/graphics/graphics-library/helper/get-hardware-info.ts
Normal file
19
src/graphics/graphics-library/helper/get-hardware-info.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
import { UniversalRenderingContext } from '../universal-rendering-context';
|
||||||
|
import { tryEnableExtension } from './enable-extension';
|
||||||
|
|
||||||
|
export const getHardwareInfo = (
|
||||||
|
gl: UniversalRenderingContext
|
||||||
|
): { vendor: string; renderer: string } | null => {
|
||||||
|
const debugInfo = tryEnableExtension(gl, 'WEBGL_debug_renderer_info');
|
||||||
|
if (debugInfo) {
|
||||||
|
const vendor = gl.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL);
|
||||||
|
const renderer = gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);
|
||||||
|
|
||||||
|
return {
|
||||||
|
vendor,
|
||||||
|
renderer,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
};
|
||||||
Loading…
Add table
Add a link
Reference in a new issue