struct-constructor-highp-bug.html (1416B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>Struct constructor highp bug.</title> 6 <link rel="stylesheet" href="../../../resources/js-test-style.css"/> 7 <script src="../../../js/js-test-pre.js"></script> 8 <script src="../../../js/webgl-test-utils.js"></script> 9 <script src="../../../js/glsl-conformance-test.js"></script> 10 </head> 11 <body> 12 <div id="description"></div> 13 <div id="console"></div> 14 <script id="fshader" type="x-shader/x-fragment"> 15 #ifdef GL_FRAGMENT_PRECISION_HIGH 16 precision highp float; 17 #else 18 precision mediump float; 19 #endif 20 21 struct Test { 22 vec3 color; 23 }; 24 25 void main() { 26 vec3 color = vec3( 0.0, 1.0, 0.0 ); 27 Test test = Test( color ); 28 gl_FragColor = vec4( test.color, 1.0 ); 29 } 30 </script> 31 32 <script type="application/javascript"> 33 "use strict"; 34 description("Struct constructors should evaluate properly."); 35 debug("Regression test for Three.js bug worked around in <a href='https://github.com/mrdoob/three.js/pull/7556'>https://github.com/mrdoob/three.js/pull/7556</a> that reproduced on Nexus 4 and 5 (Adreno 320 and 330)."); 36 debug("When high precision is used in the fragment shader on these devices, bugs occur in evaluation of structs' constructors. Thanks to Mr. doob for the reduced test case."); 37 38 GLSLConformanceTester.runRenderTests([ 39 { 40 fShaderId: 'fshader', 41 fShaderSuccess: true, 42 linkSuccess: true, 43 passMsg: "Struct contstructor evaluation" 44 } 45 ]); 46 47 </script> 48 49 </body> 50 </html>