{"id":15387010,"url":"https://github.com/gkjohnson/webgl-gpu-power-estimation","last_synced_at":"2025-11-13T22:53:11.262Z","repository":{"id":42216961,"uuid":"164184057","full_name":"gkjohnson/webgl-gpu-power-estimation","owner":"gkjohnson","description":"Utility for estimating the power of the GPU in the browser using WebGL debug parameters.","archived":false,"fork":false,"pushed_at":"2024-06-11T11:34:44.000Z","size":2655,"stargazers_count":51,"open_issues_count":12,"forks_count":6,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-08-13T06:34:20.344Z","etag":null,"topics":["browser","estimate","gpu","graphics","hardware","javascript","webgl"],"latest_commit_sha":null,"homepage":"https://gkjohnson.github.io/webgl-gpu-power-estimation/example/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gkjohnson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-05T05:11:38.000Z","updated_at":"2025-07-05T14:25:35.000Z","dependencies_parsed_at":"2023-02-01T08:01:25.850Z","dependency_job_id":"483d9b4c-7080-4052-9613-d86fbc3dd3d6","html_url":"https://github.com/gkjohnson/webgl-gpu-power-estimation","commit_stats":{"total_commits":120,"total_committers":4,"mean_commits":30.0,"dds":0.125,"last_synced_commit":"e8cba866bc8f74bbec87df241303e73357275d32"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/gkjohnson/webgl-gpu-power-estimation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gkjohnson%2Fwebgl-gpu-power-estimation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gkjohnson%2Fwebgl-gpu-power-estimation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gkjohnson%2Fwebgl-gpu-power-estimation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gkjohnson%2Fwebgl-gpu-power-estimation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gkjohnson","download_url":"https://codeload.github.com/gkjohnson/webgl-gpu-power-estimation/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gkjohnson%2Fwebgl-gpu-power-estimation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284304462,"owners_count":26982161,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-13T02:00:06.582Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["browser","estimate","gpu","graphics","hardware","javascript","webgl"],"created_at":"2024-10-01T14:51:21.577Z","updated_at":"2025-11-13T22:53:11.234Z","avatar_url":"https://github.com/gkjohnson.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# webgl-gpu-power-estimation\n\nCatering a 3d web-based experience to the power of a target platform is difficult with such a small amount of information available about the current graphics hardware. This utility aims to provide performance information about the current hardware by guessing the type of graphics hardware using webgl `UNMASKED_RENDERER_WEBGL` parameter and looking it up in a provided list of hardware.\n\nSee your hardware info [here](https://gkjohnson.github.io/webgl-gpu-power-estimation/example/)!\n\n## Example Data Information\n\nData used in the example is for demonstration purposes. See the [webgl-gpu-power-estimation-data](https://github.com/gkjohnson/webgl-gpu-power-estimation-data/) repo for more information.\n\n## Matching the Graphics Hardware Name\n\nThe values from `UNMASKED_RENDERER_WEBGL` are irregular and relatively unpredictable. To find the corresponding hardware in the database list we\n\n- Check if there is a version number in the current GPU hardware name.\n- Filter the database of GPUs to those that include that version number (or to those that have no version number if none was found).\n- From that list pick the hardware the has the most matching tokens between the names.\n\n## Installation\n\nThe package can be installed using npm via the Github repo by adding this to the package.json dependencies. See [here] for more information.\n\n```js\n\"webgl-gpu-power-estimation\": \"gkjohnson/webgl-gpu-power-estimation@\u003crelease\u003e\"\n```\n\n## Use\n\n```js\nimport { getDetailedInfo, getBasicInfo } from 'gpu-power-estimate';\n\nfetch( './path/to/database.json' )\n  .then( res =\u003e res.json() )\n  .then( database =\u003e {\n\n    // get the hardware information\n    const canvas = document.createElement( 'canvas' );\n    const gl = canvas.getContext( 'webgl' );\n    const basicInfo = getBasicInfo( gl );\n    const detailedInfo = getDetailedInfo( database, gl );\n\n    // scale the application\n    const capability = detailedInfo ? detailedInfo.performance : 0;\n    if ( capability \u003e 6000 ) {\n\n      // initialize highest fidelity scene\n\n    } else if ( capability \u003e 3000 ) {\n\n      // initialize moderately complex scene\n\n    } else {\n\n      // initialize simplified scene\n\n    }\n\n  } );\n\n```\n\n## API\n\n### getBasicInfo\n```js\ngetBasicInfo( context = null : WebGLContext ) : Object | null\n```\n\nReturns some basic info about the hardware based on the `WEBGL_debug_renderer_info` extension or `null` if it's unavailable.\n\nIf the context is not provided then a temporary one will be created.\n\n```js\n{\n  // The full graphics hardware\n  name,\n\n  // A guess as to whether or not the hardware is integrated graphics\n  integrated,\n\n  // The raw unmasked fields returned from the extension\n  unmasked: { vendor, renderer }\n\n}\n```\n\n### getDetailedInfo\n\n```js\ngetDetailedInfo(\n  database : Object,\n  contextOrCard = null : WebGLContext | string\n) : Object | null\n```\n\nReturns more detailed hardware information based on the information in the provided database. The database is expected to be an object where the keys are the names of graphics hardware and the values are objects with detail information.\n\nThe `database` argument is expected to be an object with GPU names as key entries and an object of detailed information as a result. The value of the closest matching key will be returned.\n\nIf a WebGL context _or_ card name to search is not provided then a temporary context will be created.\n\n### Caveats\n\nFor privacy reasons the availability of the `UNMASKED_RENDERER_WEBGL` parameter may be disabled in which case no estimate can be provided.\n\n## References\n- Infomation on the WebGL debug extension\n  - https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_debug_renderer_info\n\n- Blog with information about the extension and sampling of possible values\n  - http://codeflow.org/entries/2016/feb/10/webgl_debug_renderer_info-extension-survey-results/\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgkjohnson%2Fwebgl-gpu-power-estimation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgkjohnson%2Fwebgl-gpu-power-estimation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgkjohnson%2Fwebgl-gpu-power-estimation/lists"}