Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: conformance/misc/shader-precision-format.html

Issue 41503006: Add ToT WebGL conformance tests : part 8 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/webgl/sdk/tests/
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
## -0,0 +1 ##
+LF
\ No newline at end of property
OLDNEW
(Empty)
1 <!--
2
3 /*
4 ** Copyright (c) 2012 The Khronos Group Inc.
5 **
6 ** Permission is hereby granted, free of charge, to any person obtaining a
7 ** copy of this software and/or associated documentation files (the
8 ** "Materials"), to deal in the Materials without restriction, including
9 ** without limitation the rights to use, copy, modify, merge, publish,
10 ** distribute, sublicense, and/or sell copies of the Materials, and to
11 ** permit persons to whom the Materials are furnished to do so, subject to
12 ** the following conditions:
13 **
14 ** The above copyright notice and this permission notice shall be included
15 ** in all copies or substantial portions of the Materials.
16 **
17 ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
24 */
25
26 -->
27 <!DOCTYPE html>
28 <html>
29 <head>
30 <meta charset="utf-8">
31 <title>WebGL shader precision format test.</title>
32 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
33 <script src="../../resources/js-test-pre.js"></script>
34 <script src="../resources/webgl-test.js"> </script>
35 <script src="../resources/webgl-test-utils.js"> </script>
36 </head>
37 <body>
38 <canvas id="canvas" width="2" height="2" style="width: 40px; height: 40px;"></ca nvas>
39 <div id="description"></div>
40 <div id="console"></div>
41 <script>
42 "use strict";
43 var wtu = WebGLTestUtils;
44 description(document.title);
45 debug("Tests that WebGLShaderPrecisionFormat class and getShaderPrecisionFormat work.");
46 debug("");
47 var gl = wtu.create3DContext("canvas");
48
49 function verifyShaderPrecisionFormat(shadertype, precisiontype) {
50 shouldBeTrue('gl.getShaderPrecisionFormat(' + shadertype + ', ' +
51 precisiontype + ') instanceof WebGLShaderPrecisionFormat');
52 }
53
54 debug("");
55 debug("Test that getShaderPrecisionFormat returns a WebGLShaderPrecisionFormat o bject.");
56 debug("");
57
58 verifyShaderPrecisionFormat('gl.VERTEX_SHADER', 'gl.LOW_FLOAT');
59 verifyShaderPrecisionFormat('gl.VERTEX_SHADER', 'gl.MEDIUM_FLOAT');
60 verifyShaderPrecisionFormat('gl.VERTEX_SHADER', 'gl.HIGH_FLOAT');
61 verifyShaderPrecisionFormat('gl.VERTEX_SHADER', 'gl.LOW_INT');
62 verifyShaderPrecisionFormat('gl.VERTEX_SHADER', 'gl.MEDIUM_INT');
63 verifyShaderPrecisionFormat('gl.VERTEX_SHADER', 'gl.HIGH_INT');
64 verifyShaderPrecisionFormat('gl.FRAGMENT_SHADER', 'gl.LOW_FLOAT');
65 verifyShaderPrecisionFormat('gl.FRAGMENT_SHADER', 'gl.MEDIUM_FLOAT');
66 verifyShaderPrecisionFormat('gl.FRAGMENT_SHADER', 'gl.HIGH_FLOAT');
67 verifyShaderPrecisionFormat('gl.FRAGMENT_SHADER', 'gl.LOW_INT');
68 verifyShaderPrecisionFormat('gl.FRAGMENT_SHADER', 'gl.MEDIUM_INT');
69 verifyShaderPrecisionFormat('gl.FRAGMENT_SHADER', 'gl.HIGH_INT');
70
71 debug("");
72 debug("Test that getShaderPrecisionFormat throws an error with invalid parameter s.");
73 debug("");
74
75 shouldGenerateGLError(gl, gl.INVALID_ENUM, 'gl.getShaderPrecisionFormat(gl.HIGH_ INT, gl.VERTEX_SHADER)');
76
77 debug("");
78 debug("Test that WebGLShaderPrecisionFormat values are sensible.");
79 debug("");
80
81 // The minimum values are from OpenGL ES Shading Language spec, section 4.5.
82
83 var shaderPrecisionFormat = gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.LOW _FLOAT);
84 shouldBeTrue('shaderPrecisionFormat.rangeMin >= 1');
85 shouldBeTrue('shaderPrecisionFormat.rangeMax >= 1');
86 shouldBeTrue('shaderPrecisionFormat.precision >= 8');
87
88 shaderPrecisionFormat = gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.MEDIUM_ FLOAT);
89 shouldBeTrue('shaderPrecisionFormat.rangeMin >= 14');
90 shouldBeTrue('shaderPrecisionFormat.rangeMax >= 14');
91 shouldBeTrue('shaderPrecisionFormat.precision >= 10');
92
93 shaderPrecisionFormat = gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.HIGH_FL OAT);
94 shouldBeTrue('shaderPrecisionFormat.rangeMin >= 62');
95 shouldBeTrue('shaderPrecisionFormat.rangeMax >= 62');
96 shouldBeTrue('shaderPrecisionFormat.precision >= 16');
97
98 shaderPrecisionFormat = gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.LOW_INT );
99 shouldBeTrue('shaderPrecisionFormat.rangeMin >= 8');
100 shouldBeTrue('shaderPrecisionFormat.rangeMax >= 8');
101 shouldBeTrue('shaderPrecisionFormat.precision == 0');
102
103 shaderPrecisionFormat = gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.MEDIUM_ INT);
104 shouldBeTrue('shaderPrecisionFormat.rangeMin >= 10');
105 shouldBeTrue('shaderPrecisionFormat.rangeMax >= 10');
106 shouldBeTrue('shaderPrecisionFormat.precision == 0');
107
108 shaderPrecisionFormat = gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.HIGH_IN T);
109 shouldBeTrue('shaderPrecisionFormat.rangeMin >= 16');
110 shouldBeTrue('shaderPrecisionFormat.rangeMax >= 16');
111 shouldBeTrue('shaderPrecisionFormat.precision == 0');
112
113 var shaderPrecisionFormat = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.L OW_FLOAT);
114 shouldBeTrue('shaderPrecisionFormat.rangeMin >= 1');
115 shouldBeTrue('shaderPrecisionFormat.rangeMax >= 1');
116 shouldBeTrue('shaderPrecisionFormat.precision >= 8');
117
118 shaderPrecisionFormat = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.MEDIU M_FLOAT);
119 shouldBeTrue('shaderPrecisionFormat.rangeMin >= 14');
120 shouldBeTrue('shaderPrecisionFormat.rangeMax >= 14');
121 shouldBeTrue('shaderPrecisionFormat.precision >= 10');
122
123 shaderPrecisionFormat = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.LOW_I NT);
124 shouldBeTrue('shaderPrecisionFormat.rangeMin >= 8');
125 shouldBeTrue('shaderPrecisionFormat.rangeMax >= 8');
126 shouldBeTrue('shaderPrecisionFormat.precision == 0');
127
128 shaderPrecisionFormat = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.MEDIU M_INT);
129 shouldBeTrue('shaderPrecisionFormat.rangeMin >= 10');
130 shouldBeTrue('shaderPrecisionFormat.rangeMax >= 10');
131 shouldBeTrue('shaderPrecisionFormat.precision == 0');
132
133 debug("");
134 debug("Test optional highp support in fragment shaders.");
135 debug("");
136
137 shaderPrecisionFormat = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_ FLOAT);
138 shouldBeTrue('(shaderPrecisionFormat.rangeMin == 0 && shaderPrecisionFormat.rang eMax == 0 && shaderPrecisionFormat.precision == 0) || (shaderPrecisionFormat.ran geMin >= 62 && shaderPrecisionFormat.rangeMax >= 62 && shaderPrecisionFormat.pre cision >= 16)');
139
140 shaderPrecisionFormat = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_ INT);
141 shouldBeTrue('(shaderPrecisionFormat.rangeMin == 0 && shaderPrecisionFormat.rang eMax == 0 && shaderPrecisionFormat.precision == 0) || (shaderPrecisionFormat.ran geMin >= 16 && shaderPrecisionFormat.rangeMax >= 16 && shaderPrecisionFormat.pre cision == 0)');
142
143 debug("");
144 debug("Test that getShaderPrecisionFormat returns the same thing every call.");
145 debug("");
146
147 shaderPrecisionFormat = gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.LOW_FLO AT);
148 var shaderPrecisionFormat2 = gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.LO W_FLOAT);
149 shouldBeTrue('shaderPrecisionFormat.rangeMin == shaderPrecisionFormat2.rangeMin' );
150 shouldBeTrue('shaderPrecisionFormat.rangeMax == shaderPrecisionFormat2.rangeMax' );
151 shouldBeTrue('shaderPrecisionFormat.precision == shaderPrecisionFormat2.precisio n');
152
153 finishTest();
154 </script>
155
156 </body>
157 </html>
158
159
OLDNEW
« no previous file with comments | « conformance/misc/object-deletion-behaviour.html ('k') | conformance/misc/type-conversion-test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698