KhronosGroup / KhronosGroup/WebGL
It is not possible to render to a "standard definition" resolution
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 2.9k
- Forks
- 704
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 4
Description
Currently,
a) window.devicePixelRatio and CSS pixel coordinate units change based on browser's zoom level
b) it is not possible to query what the browser's zoom level is.
As a result, this means that it is not possible to render to fixed "standard definition" resolutions, because one cannot know what such standard definition scale is since it is affected by zoom.
Let's say that on a system with 3840x2160 display and with window.devicePixelRatio=2 when browser is zoomed in at 100%, a developer would like their WebGL page to render at whatever the standard definition is, in this case to 1920x1080. Developer's rationale is that their site is quite fillrate bound and that "standard definition" would be the reasonable approximation of low DPI content on screen. (It is not possible to query DPI settings in JavaScript, though even if it was, it would not quite directly resolve this). This is a reasonable ask since for example for games shipped on iPhone and iPad with the introduction of Retina class devices, developers would commonly choose whether to ship game as Retina-enabled that could run with the needed fillrate requirements, or to ship in the old non-Retina resolution with better framerate.
However it is not possible to know what this standard definition resolution actually is, CSS pixels and window.devicePixelRatio are affected by the browser's zoom level and the browser's zoom level is not observable.
If there was a window.devicePixelRatioAt100PercentZoom that reported what window.devicePixelRatio is if user has the browser set to 100% zoom level, and was immutable during zooming, then it would be possible for developers to compute a standard definition resolution for WebGL backbuffer size, and render to that instead. Has anything like this been discussed before?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the issue's window.devicePixelRatio and browser-zoom discussion, then consider how the proposed window.devicePixelRatioAt100PercentZoom would affect WebGL backbuffer sizing. Done would require a settled API decision and an agreed way for developers to compute a standard-definition resolution; no implementation files or tests are identified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- computer-graphics
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100