Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve shader attribute precision on mobile devices #2096

Closed
lucaswoj opened this issue Feb 9, 2016 · 6 comments
Closed

Improve shader attribute precision on mobile devices #2096

lucaswoj opened this issue Feb 9, 2016 · 6 comments

Comments

@lucaswoj
Copy link
Contributor

lucaswoj commented Feb 9, 2016

There are two outstanding bugs related to poorly calibrated shader attribute precision on mobile devices (#2055, #2060 and #2020)

@kristfal kindly provided a PR (#2091) with one potential solution to the problem.

We should all take a step back and come up with our ideal blue-sky solution to the problem. Should we

  • keep adding highp annotations to the shader source when bugs are reported
  • design a "smarter" (than this) shader attribute precision rewriting algorithm
  • other?

cc @kristfal @ansis @kkaefer @jfirebaugh

@jfirebaugh
Copy link
Contributor

Previously: #1852, #750.

I think we should use highp universally and unconditionally in vertex shaders. There appears to be little or no downside to doing so.

For fragment shaders, it's more complicated. Do we know of any cases where our fragment shaders produce incorrect results on mobile with mediump?

@ansis
Copy link
Contributor

ansis commented Feb 9, 2016

I think we should use highp universally and unconditionally in vertex shaders. There appears to be little or no downside to doing so.

For fragment shaders, it's more complicated. Do we know of any cases where our fragment shaders produce incorrect results on mobile with mediump?

This sounds right to me. I don't think there are any cases we need high precision in fragment shaders.

@lucaswoj
Copy link
Contributor Author

Naively switching most shader attributes to highp has led to many rendering errors on desktop devices, even though they claim highp support

        var isHighpSupported = (
            context.getShaderPrecisionFormat &&
            context.getShaderPrecisionFormat(type, context.HIGH_FLOAT).precision > 0
        );

Do we want to continue restricting highp use to mobile devices?

@jfirebaugh
Copy link
Contributor

Naively switching most shader attributes to highp has led to many rendering errors on desktop devices

Can you elaborate on this?

@lucaswoj
Copy link
Contributor Author

In my prototype branch, #2117, circles and lines fail to render in the browser and in headless testing. I'm not yet sure what the underlying cause is.

@ansis
Copy link
Contributor

ansis commented Feb 25, 2016

done #2096

@ansis ansis closed this as completed Feb 25, 2016
ChrisLoer added a commit that referenced this issue May 4, 2017
… in:

#2096
Change some variable names from camel-case to underscore-separated.
ChrisLoer added a commit that referenced this issue Sep 18, 2018
Fixes issue #7247: heights over 65,536 meters don't render on some devices.
See discussion in issue #2096.
ChrisLoer added a commit that referenced this issue Sep 18, 2018
Fixes issue #7247: heights over 65,536 meters don't render on some devices.
See discussion in issue #2096.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants