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

Side by Side Diff: conformance/ogles/GL/mat/mat3_copy_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, 2 months 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 3 by 3 matrix with unique elements.
36 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 // Copy the matrix to another non-const matrix.
41 mat3 b = a;
42
43 // Check each element of the copy.
44 bool elms = true;
45 if(b[0][0] != 1.0) elms = false;
46 if(b[0][1] != 2.0) elms = false;
47 if(b[0][2] != 4.0) elms = false;
48 if(b[1][0] != 8.0) elms = false;
49 if(b[1][1] != 16.0) elms = false;
50 if(b[1][2] != 32.0) elms = false;
51 if(b[2][0] != 64.0) elms = false;
52 if(b[2][1] != 128.0) elms = false;
53 if(b[2][2] != 256.0) elms = false;
54
55 // Add up each row of the copy.
56 bool rows = true;
57 x = b[0][0] + b[1][0] + b[2][0];
58 if( x < 73.0-ERROR_EPSILON || x > 73.0+ERROR_EPSILON ) rows = false;
59 x = b[0][1] + b[1][1] + b[2][1];
60 if(x < 146.0-ERROR_EPSILON || x > 146.0+ERROR_EPSILON ) rows = false;
61 x = b[0][2] + b[1][2] + b[2][2];
62 if(x < 292.0-ERROR_EPSILON || x > 292.0+ERROR_EPSILON ) rows = false;
63
64 // Add up each column of the copy.
65 bool cols = true;
66 x = b[0][0] + b[0][1] + b[0][2];
67 if( x < 7.0-ERROR_EPSILON || x > 7.0+ERROR_EPSILON ) cols = false;
68 x = b[1][0] + b[1][1] + b[1][2];
69 if(x < 56.0-ERROR_EPSILON || x > 56.0+ERROR_EPSILON) cols = false;
70 x = b[2][0] + b[2][1] + b[2][2];
71 if(x < 448.0-ERROR_EPSILON || x > 448.0+ERROR_EPSILON) cols = false;
72
73 // Check if all of the operations were successful.
74 float gray = elms && rows && cols ? 1.0 : 0.0;
75
76 // Assign the varying variable color.
77 color = vec4(gray, gray, gray, 1.0);
78
79 // Transform the vertex position.
80 gl_Position = gtf_ModelViewProjectionMatrix * gtf_Vertex;
81 }
82
OLDNEW
« no previous file with comments | « conformance/ogles/GL/mat/mat3_copy_frag.frag ('k') | conformance/ogles/GL/mat/mat3_float_frag.frag » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698