[BUG] [GLSL] [Nexus Player] Unreachable return statements cause garbage

The fragment shader files, screenshots, reproduction steps and platform info are available here:
https://github.com/mc-imperial/shader-compiler-bugs/issues/48

Adding unreachable return statements to this GLSL fragment shader leads to garbage in the rendered image. See the screenshots.

You can even reproduce this on the Nexus Player via WebGL:
http://htmlpreview.github.io/?https://github.com/mc-imperial/shader-compiler-bugs/blob/master/nexus-player/wrong_images/large-v100-0f417c9b0a03750c_inv_variant_27/webgl_viewer_recipient.html
http://htmlpreview.github.io/?https://github.com/mc-imperial/shader-compiler-bugs/blob/master/nexus-player/wrong_images/large-v100-0f417c9b0a03750c_inv_variant_27/webgl_viewer_variant.html

Hi Paul,

thank you for reporting this. We could reproduce the problem on the nexus player here in the office. I’ll try to check it on a device with more recent drivers. If it still fails I’ll forward it to the appropriate people.

bests,
Marton

Thanks Marton. Please let us know how you get on. Will you be testing on an internal (private) device? We also have an Asus Zenpad 3S 10 we can test on in case that has more recent drivers. Or perhaps we should get the image for the Nexus Player that has Vulkan support (if that has more recent drivers)?

Hi Paul,

we tried this on a Nexus Player with the latest drivers, the image corruption seems to be gone.
I attached a screenshot, let me know if it looks ok.
Yes, it’s an internal device with the latest drivers.
No, the latest official Nexus Player image still only has 1.6 drivers.

bests,
Marton

Thanks Marton. As long as both the recipient and variant shaders produce a similar image, then the bug is fixed :slight_smile:
In this case, I assume the bug is probably fixed, although comparing both images is the easiest way to know for sure.

Just to confirm: the latest official Nexus Player image is build NMF26J. But I understand we can request an image with Vulkan drivers via pvrsupport.imgtec.com. I assume this technically has “newer” drivers, but maybe the same OpenGL driver code? I just wanted to check whether any image we can request would have newer OpenGL drivers. So we can report bugs that are useful to you.

Also: you mention 1.6 drivers. Is there a good way to check the version number of the drivers on the Nexus Player? I think we can get root access if that helps.

By the way, this work is part of a research project for fuzzing GLSL compilers at Imperial College London, UK. Our tool, GLFuzz, produces fragment shaders that are likely to expose bugs in GLSL compilers and then reduces/simplifies the buggy shaders so they are suitable for use in bug reports. We are fuzzing many different vendors’ GLSL compilers and reporting the bugs to the vendors to help them improve their compilers and to demonstrate the effectiveness of our techniques. Some vendors are keen to integrate our tool into their testing infrastructure, which is exciting for us. Hopefully this explains why we are really keen to use the latest drivers! :slight_smile:

Hi Paul,

Unfortunately you can only update your drivers on your stock Nexus Player if you flash a new system image provided by Google. Since the part where the drivers are stored is read-only and encrypted you can’t upgrade your driver directly without installing a new system image.

The latest system image from Google contains the latest publicly available drivers.

You can check the drivers version number easily using AIDA64.

I must say this is an awesome work! It sounds very exciting. :slight_smile:

Even thought you won’t be able to use the latest drivers, you can still use the current one and you can still report the bugs. We’ll try to replicate them using the latest drivers and if they are still an issue we’ll forward it to the appropriate people (and the bugs will get fixed of course).
We really appreciate these bug reports, keep them coming :slight_smile:

bests,
Marton