2 Copyright (c) 2020 The Khronos Group Inc.
3 Use of this source code is governed by an MIT-style license that can be
4 found in the LICENSE.txt file.
10 <meta charset=
"utf-8">
11 <title>Verify (uint(int)
>> 31) works correctly (Adreno driver bug)
</title>
12 <link rel=
"stylesheet" href=
"../../resources/js-test-style.css"/>
13 <script src=
"../../js/js-test-pre.js"></script>
14 <script src=
"../../js/webgl-test-utils.js"></script>
17 <canvas id=
"canvas" width=
"2" height=
"2"> </canvas>
18 <div id=
"description"></div>
19 <div id=
"console"></div>
20 <script id=
"vshader-uint-1" type=
"x-shader/x-vertex">#version
300 es
22 flat out highp uint uvalue;
23 uniform highp int ivalue;
26 gl_Position = vec4(aPosition,
1);
27 uvalue = uint(ivalue)
>> 31u;
30 <script id=
"fshader-uint-1" type=
"x-shader/x-fragment">#version
300 es
31 flat in highp uint uvalue;
32 out highp vec4 myFragColor;
36 myFragColor = vec4(
1.0,
0.0,
0.0,
1.0);
38 myFragColor = vec4(
0.0,
0.0,
0.0,
1.0);
42 <script id=
"vshader-simple" type=
"x-shader/x-vertex">#version
300 es
46 gl_Position = vec4(aPosition,
1);
49 <script id=
"fshader-uint-2" type=
"x-shader/x-fragment">#version
300 es
50 uniform highp int ivalue;
51 out highp vec4 myFragColor;
54 uint uvalue = uint(ivalue)
>> 31u;
57 myFragColor = vec4(
1.0,
0.0,
0.0,
1.0);
59 myFragColor = vec4(
0.0,
0.0,
0.0,
1.0);
63 <script type=
"application/javascript">
65 description(
"Verify (uint(int) >> 31) works correctly");
67 var wtu = WebGLTestUtils;
69 var gl = wtu.create3DContext(
"canvas", undefined,
2);
71 testFailed(
"context does not exist");
74 wtu.setupUnitQuad(gl);
77 { vshader:
"vshader-uint-1", fshader:
"fshader-uint-1", desc:
"vertex shader uint" },
78 { vshader:
"vshader-simple", fshader:
"fshader-uint-2", desc:
"fragment shader uint" },
81 for (var idx =
0; idx < testCases.length; ++idx) {
82 var test = testCases[idx];
85 var program = wtu.setupProgram(gl, [test.vshader, test.fshader], [
"aPosition"]);
87 testFailed(
"Fail to set up program");
89 var uniformLoc = gl.getUniformLocation(program, 'ivalue');
90 gl.uniform1i(uniformLoc, -
1);
92 wtu.checkCanvas(gl, [
255,
0,
0,
255]);
93 gl.deleteProgram(program);
94 wtu.glErrorShouldBe(gl, gl.NO_ERROR,
"Should be no errors from testing");
102 var successfullyParsed = true;
104 <script src=
"../../js/js-test-post.js"></script>