• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#version 100
2
3// Copyright Alastair F. Donaldson and Hugues Evrard, Imperial College London, 2017
4// Defect found using GLFuzz - https://www.graphicsfuzz.com/
5//
6// Gives wrong image on:
7// NVIDIA SHIELD Android TV
8// Model number: P2571
9// GL_VERSION: OpenGL ES 3.2 NVIDIA 361.00
10// GL_VENDOR: NVIDIA Corporation
11// GL_RENDERER: NVIDIA Tegra
12// Android version: 7.0
13
14#ifdef GL_ES
15#ifdef GL_FRAGMENT_PRECISION_HIGH
16precision highp float;
17precision highp int;
18#else
19precision mediump float;
20precision mediump int;
21#endif
22#endif
23
24uniform vec2 injectionSwitch;
25
26uniform vec2 resolution;
27
28bool checkSwap(float a, float b)
29{
30    return gl_FragCoord.y < resolution.y / 2.0 ? a > b : a < b;
31}
32void main()
33{
34    float data[10];
35    for(
36        int i = 0;
37        i < 10;
38        i ++
39    )
40        {
41            data[i] = float(10 - i) * injectionSwitch.y;
42        }
43    for(
44        int i = 0;
45        i < 9;
46        i ++
47    )
48        {
49            for(
50                int j = 0;
51                j < 10;
52                j ++
53            )
54                {
55                    if(j < i + 1)
56                        {
57                            if(false)
58                                {
59                                    continue;
60                                }
61                            continue;
62                            discard;
63                        }
64                    bool doSwap = checkSwap(data[i], data[j]);
65                    if(doSwap)
66                        {
67                            float temp = data[i];
68                            data[i] = data[j];
69                            data[j] = temp;
70                        }
71                }
72        }
73    if(gl_FragCoord.x < resolution.x / 2.0)
74        {
75            gl_FragColor = vec4(data[0] / 10.0, data[5] / 10.0, data[9] / 10.0, 1.0);
76        }
77    else
78        {
79            gl_FragColor = vec4(data[5] / 10.0, data[9] / 10.0, data[0] / 10.0, 1.0);
80        }
81}
82