WebVR: Add explicit precision to all shaders to avoid Mali GPU crash

Desktop / Chromium - klausw [chromium.org] - 20 April 2017 17:57 EDT

On Mali GPUs as used on Samsung S7 and other devices, precision qualifiers are mandatory in GLSL shaders, there's no default. This causes a browser crash due to failing shader compilation:

chromium: [FATAL:vr_shell_renderer.cc(246)] Check failed: fragment_shader_handle. Error compiling shader: 0:1: S0032: no default precision defined for variable 'v_TexCoordinate'

To fix this, add explicit "mediump" to all shaders.

Also update the v_TexCoordinate precision in vertex shaders to be "highp" to match the fragment shader. In practice this doesn't currently make a difference since the vertex coordinate values used are just 0, 0.5, or 1, all of which can be precisely represented in a mediump, but it seems cleaner to keep this consistent.

BUG=713516

Review-Url: https://codereview.chromium.org/2833823002 Cr-Commit-Position: refs/heads/master@{#466153}

577ecb1 WebVR: Add explicit precision to all shaders to avoid Mali GPU crash
chrome/browser/android/vr_shell/mailbox_to_surface_bridge.cc | 3 ++-
chrome/browser/android/vr_shell/vr_shell_renderer.cc | 7 ++++++-
2 files changed, 8 insertions(+), 2 deletions(-)

Upstream: git.chromium.org


  • Share