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

Side by Side Diff: conformance/ogles/GL/mat/const_mat3_vert.vert

Issue 41993002: Add ToT WebGL conformance tests : part 9 (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
OLDNEW
(Empty)
1
2 /*
3 ** Copyright (c) 2012 The Khronos Group Inc.
4 **
5 ** Permission is hereby granted, free of charge, to any person obtaining a
6 ** copy of this software and/or associated documentation files (the
7 ** "Materials"), to deal in the Materials without restriction, including
8 ** without limitation the rights to use, copy, modify, merge, publish,
9 ** distribute, sublicense, and/or sell copies of the Materials, and to
10 ** permit persons to whom the Materials are furnished to do so, subject to
11 ** the following conditions:
12 **
13 ** The above copyright notice and this permission notice shall be included
14 ** in all copies or substantial portions of the Materials.
15 **
16 ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20 ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
23 */
24
25
26 attribute vec4 gtf_Vertex;
27 uniform mat4 gtf_ModelViewProjectionMatrix;
28 varying vec4 color;
29
30 #define ERROR_EPSILON 0.1
31
32 void main (void)
33 {
34 float x;
35 // Declare a constant 3 by 3 matrix with unique elements.
36 const mat3 a = mat3( 1.0, 2.0, 4.0, // 1.0 8.0 64.0
37 8.0, 16.0, 32.0, // 2.0 16.0 128.0
38 64.0, 128.0, 256.0); // 4.0 32.0 256.0
39
40 // Check each element.
41 bool elms = true;
42 if(a[0][0] != 1.0) elms = false;
43 if(a[0][1] != 2.0) elms = false;
44 if(a[0][2] != 4.0) elms = false;
45 if(a[1][0] != 8.0) elms = false;
46 if(a[1][1] != 16.0) elms = false;
47 if(a[1][2] != 32.0) elms = false;
48 if(a[2][0] != 64.0) elms = false;
49 if(a[2][1] != 128.0) elms = false;
50 if(a[2][2] != 256.0) elms = false;
51
52 // Add up each row.
53 bool rows = true;
54 x = a[0][0] + a[1][0] + a[2][0];
55 if( x < 73.0-ERROR_EPSILON || x > 73.0+ERROR_EPSILON ) rows = false;
56 x = a[0][1] + a[1][1] + a[2][1];
57 if(x < 146.0-ERROR_EPSILON || x > 146.0+ERROR_EPSILON ) rows = false;
58 x = a[0][2] + a[1][2] + a[2][2];
59 if(x < 292.0-ERROR_EPSILON || x > 292.0+ERROR_EPSILON ) rows = false;
60
61 // Add up each column.
62 bool cols = true;
63 x = a[0][0] + a[0][1] + a[0][2];
64 if( x < 7.0-ERROR_EPSILON || x > 7.0+ERROR_EPSILON ) cols = false;
65 x = a[1][0] + a[1][1] + a[1][2];
66 if(x < 56.0-ERROR_EPSILON || x > 56.0+ERROR_EPSILON) cols = false;
67 x = a[2][0] + a[2][1] + a[2][2];
68 if(x < 448.0-ERROR_EPSILON || x > 448.0+ERROR_EPSILON) cols = false;
69
70 // Check if all of the operations were successful.
71 float gray = elms && rows && cols ? 1.0 : 0.0;
72
73 // Assign the varying variable color.
74 color = vec4(gray, gray, gray, 1.0);
75
76 // Transform the vertex position.
77 gl_Position = gtf_ModelViewProjectionMatrix * gtf_Vertex;
78 }
79
OLDNEW
« no previous file with comments | « conformance/ogles/GL/mat/const_mat3_frag.frag ('k') | conformance/ogles/GL/mat/const_mat4_copy_frag.frag » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698