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 (true ? 1.0 : 1.0) + vec4(1.0); 31 return gl_FragCoord.y < resolution.y / 2.0 ? a > b : a < b; 32} 33void main() 34{ 35 float data[10]; 36 for( 37 int i = 0; 38 i < 10; 39 i ++ 40 ) 41 { 42 data[i] = float(10 - i) * injectionSwitch.y; 43 } 44 for( 45 int i = 0; 46 i < 9; 47 i ++ 48 ) 49 { 50 for( 51 int j = 0; 52 j < 10; 53 j ++ 54 ) 55 { 56 if(j < i + 1) 57 { 58 continue; 59 } 60 bool doSwap = checkSwap(data[i], data[j]); 61 if(doSwap) 62 { 63 float temp = data[i]; 64 data[i] = data[j]; 65 data[j] = temp; 66 } 67 } 68 } 69 if(gl_FragCoord.x < resolution.x / 2.0) 70 { 71 gl_FragColor = vec4(data[0] / 10.0, data[5] / 10.0, data[9] / 10.0, 1.0); 72 } 73 else 74 { 75 gl_FragColor = vec4(data[5] / 10.0, data[9] / 10.0, data[0] / 10.0, 1.0); 76 } 77} 78