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

Unreachable control flow instructions lead to wrong image produced #76

Open
0152la opened this issue Jul 4, 2017 · 0 comments
Open

Comments

@0152la
Copy link
Collaborator

0152la commented Jul 4, 2017

[Shaders, screenshots, error log, reproduction steps, platform info, etc.] [ZIP]

Recipient:

recipient image

Variant:

variant image

In order to swap between the recipient and the variant shaders, comment/uncomment line 3. The colour is set in line 29 (green) or 30 (red). Line 29 should be unreachable, as the value returned in bar() should always be 1. However, in the variant, line 21 is reachable. This should be impossible, considering there is a continue being executed right before it, in line 16. The binary file shows that the compiler optimizes this to a single incorrect instruction, which directly sets the colours.

In order to run the shader, download and build the get-image-glsl tool. get_image_glfw will be built in ./out/<platform>/install/bin/. Then, ensure that the .frag and .json files are in the same directory, then run on a CLI:
$ /path/to/get_image_glfw variant.frag
The produced image will be saved to output.png by default. The binary can be obtained by passing --dump_bin <output_file>. Further options available to give to the get_image tool can be seen by passing the -h flag.

This issue was observed on:

  • Nvidia GTX770, driver version 384.76, Windows 10
  • Nvidia GTX980M, driver version 382.53, Windows 10
  • Nvidia Titan, driver version 381.22, Ubuntu 14.04
  • Nvidia GT630, driver version 381.22, Ubuntu 16.04

The issue was also checked on the GTX770 machine on Firefox and Edge, but did not present itself (i.e. the expected red image was produced with both recipient and variant).

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

1 participant