WebGL shader precision formats
Reads float and integer precision ranges the GPU shader units support.
In one line
Can check how precise your graphics chip maths is, to guess your chip family
Reads float and integer precision ranges the GPU shader units support.
Mobile GPUs report different mediump and highp precision, so the numbers separate desktop, Apple, Adreno, Mali and PowerVR families.
What it can and can't do
What the user does: Nothing. It happens when the page loads
It can
- Check number precision limits in the graphics chip
- Tell desktop, Apple, Adreno, Mali and PowerVR families apart
- Add that clue to a device profile
It cannot
- Ask permission first
- See your files
- Show you anything on screen
- Name your exact device by itself
Browser support
| Browser | Status | First version | Released | Note |
|---|---|---|---|---|
| Chrome | Supported | 9 | 2011-02-03 | None |
| Edge | Supported | 79 | 2020-01-15 | None |
| Firefox | Supported | 4 | 2011-03-22 | None |
| Safari | Supported | 8 | 2014-10-16 | None |
| Safari on iPhone | Supported | 8 | 2014-09-17 | None |
| Chrome on Android | Supported | 9 | Not listed | None |
| Samsung Internet | Supported | 5.0 | 2016-12-15 | None |
How a site asks for it
| API | gl.getShaderPrecisionFormat(shaderType, precisionType) |
| How access is granted | none |
| What the user sees | Not listed |
| Needs a secure context (HTTPS) | No |
| Needs a user gesture | No |
| How long it lasts | Not listed |
| How to take it back | Not listed |
| Inside an iframe | Not listed |
Typical flow
- Call getShaderPrecisionFormat for VERTEX and FRAGMENT x LOW, MEDIUM, HIGH x FLOAT, INT
Data you get
What comes back: 12 triples (rangeMin, rangeMax, precision)
Shape: list
| Field | Type | Unit | Range | Precision |
|---|---|---|---|---|
rangeMin | integer | exponent | 0 to 127 | exact |
precision | integer | bits | 0 to 23 | exact |
Technical limits
- Low entropy alone; useful to pin GPU family
The story
What it is
A script reads the number ranges your graphics chip supports for floats and integers.
For you
You never see it. Your browser reports how exactly your graphics chip can handle numbers. Phones and laptops differ, so the answers are a small clue about your device.
For makers
Game and graphics code needs this to avoid visual glitches on weaker chips. Fingerprinting tools add it to a bundle, because it cleanly separates mobile and desktop graphics.
Where you see it
| Type | Example | Apps |
|---|---|---|
| games | A browser game uses lower precision on phones to run faster, after checking what the chip supports. | None named |
| creative | A web photo editor with filters picks the right math so colors do not band on older phones. | None named |
| maps | A web map draws smooth shading only if the chip supports high precision numbers. | Mapbox |
| security | A fraud tool checks that the reported graphics type matches the device model. | None named |
| ads | A tracker adds the precision numbers to the graphics part of a device ID. | None named |
| developer | A graphics developer logs these numbers to understand why a shader looks broken on one phone. | None named |
| ar-vr | A web based AR viewer checks precision before it enables advanced lighting. | Sketchfab |
Risks
- Reveals chip class
- Adds to a device ID
What the platform says
- MDN: getShaderPrecisionFormat. Reports the range and precision a graphics chip supports for numbers used in shaders.
Good uses and abuse
Legitimate uses
- Choose shader variants
Known abuse
- Component of composite fingerprints
Scores
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 2 of 5 | How revealing the data is |
| Utility | 1 of 5 | How useful it is to honest apps |
| Friction | 0 of 5 | How much the user has to do |
| Fingerprint bits | 2 | Rough identifying entropy, when known |
Related capabilities
Related
- WebGL parameters and extensions. Can see your graphics card model, limits and which 3D features it supports
Sources
How well checked: Based on official documentation.