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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/webgl/webgl-sharedarraybuffer.html

Issue 2815793002: [SharedArrayBuffer] Add "AllowShared" extended attribute, used for WebGL (Closed)
Patch Set: merge HEAD Created 3 years, 8 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/IDLExtendedAttributes.md » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../resources/testharness.js"></script>
5 <script src="../../../resources/testharnessreport.js"></script>
6 <script src="resources/webgl-test.js"></script>
7 <script src="resources/webgl-test-utils.js"></script>
8 </head>
9 <body>
10 <script>
11 if (window.SharedArrayBuffer) {
12 var canvas = document.createElement("canvas");
13 var gl;
14 for (var name of ['webgl2', 'webgl']) {
15 try {
16 gl = canvas.getContext(name);
17 } catch(e) {
18 }
19 if (gl)
20 break;
21 }
22 var has_webgl2 = name == 'webgl2';
23
24 if (gl) {
25 // Nearly all of the tests below are invalid (e.g. will set the GL error),
26 // but we don't really care; we just want to ensure that passing a
27 // SharedArrayBuffer view is allowed and doesn't throw.
28 var sab = new SharedArrayBuffer(16);
29 var u8array = new Uint8Array(sab);
30 var i32array = new Int32Array(sab);
31 var u32array = new Uint32Array(sab);
32 var f32array = new Float32Array(sab);
33
34 var vs = "attribute float a; uniform float u; void main() {}";
35 var fs = "precision mediump float; void main() {}";
36 var program = WebGLTestUtils.loadProgram(gl, vs, fs);
37 var uniform = gl.getUniformLocation(program, 'u');
38 var attribute = gl.getAttribLocation(program, 'a');
39
40 test(() => {
41 gl.bufferData(gl.ARRAY_BUFFER, u8array, gl.STATIC_DRAW);
42 if (has_webgl2) {
43 gl.bufferData(gl.ARRAY_BUFFER, u8array, gl.STATIC_DRAW, 0, 1);
44 }
45 }, "bufferData");
46
47 test(() => {
48 gl.compressedTexImage2D(gl.TEXTURE_2D, 0, 0, 1, 1, 0, u8array);
49 if (has_webgl2) {
50 gl.compressedTexImage2D(gl.TEXTURE_2D, 0, 0, 1, 1, 0, u8array, 0);
51 }
52 }, "compressedTexImage2D");
53
54 test(() => {
55 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 0, 1, 1, 0, 0, u8array);
56 if (has_webgl2) {
57 gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 0, 1, 1, 0, 0, u8array, 0);
58 }
59 }, "compressedTexSubImage2D");
60
61 test(() => {
62 gl.readPixels(0, 0, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, u8array);
63 if (has_webgl2) {
64 gl.readPixels(0, 0, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, u8array, 0);
65 }
66 }, "readPixels");
67
68 test(() => {
69 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA,
70 gl.UNSIGNED_BYTE, u8array);
71 if (has_webgl2) {
72 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA,
73 gl.UNSIGNED_BYTE, u8array, 0);
74 }
75 }, "texImage2D");
76
77 test(() => {
78 gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE,
79 u8array);
80 if (has_webgl2) {
81 gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 1, 1, gl.RGBA,
82 gl.UNSIGNED_BYTE, u8array, 0);
83 }
84 }, "texSubImage2D");
85
86 test(() => {
87 gl.uniformMatrix2fv(uniform, false, f32array);
88 }, "uniformMatrix2fv");
89
90 test(() => {
91 gl.uniformMatrix3fv(uniform, false, f32array);
92 }, "uniformMatrix3fv");
93
94 test(() => {
95 gl.uniformMatrix4fv(uniform, false, f32array);
96 }, "uniformMatrix4fv");
97
98 test(() => {
99 gl.vertexAttrib1fv(attribute, f32array);
100 }, "vertexAttrib1fv");
101
102 test(() => {
103 gl.vertexAttrib2fv(attribute, f32array);
104 }, "vertexAttrib2fv");
105
106 test(() => {
107 gl.vertexAttrib3fv(attribute, f32array);
108 }, "vertexAttrib3fv");
109
110 test(() => {
111 gl.vertexAttrib4fv(attribute, f32array);
112 }, "vertexAttrib4fv");
113
114 if (has_webgl2) {
115 test(() => {
116 gl.bufferSubData(gl.ARRAY_BUFFER, 0, u8array, 0, 1);
117 }, "bufferSubData");
118
119 test(() => {
120 gl.getBufferSubData(gl.ARRAY_BUFFER, 0, u8array);
121 }, "getBufferSubData");
122
123 test(() => {
124 gl.compressedTexImage3D(gl.TEXTURE_3D, 0, 0, 1, 1, 1, 0, u8array);
125 }, "compressedTexImage3D");
126
127 test(() => {
128 gl.compressedTexSubImage3D(gl.TEXTURE_3D, 0, 0, 1, 1, 1, 0, 0, 0,
129 u8array);
130 }, "compressedTexSubImage3D");
131
132 test(() => {
133 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGBA, 1, 1, 1, 0, 0,
134 gl.UNSIGNED_BYTE, u8array);
135 gl.texImage3D(gl.TEXTURE_3D, 0, gl.RGBA, 1, 1, 1, 0, 0,
136 gl.UNSIGNED_BYTE, u8array, 0);
137 }, "texImage3D");
138
139 test(() => {
140 gl.texSubImage3D(gl.TEXTURE_3D, 0, 0, 0, 0, 1, 1, 1, gl.RGBA,
141 gl.UNSIGNED_BYTE, u8array);
142 }, "texSubImage3D");
143
144 test(() => {
145 gl.uniformMatrix2x3fv(uniform, false, f32array);
146 }, "uniformMatrix2x3fv");
147
148 test(() => {
149 gl.uniformMatrix3x2fv(uniform, false, f32array);
150 }, "uniformMatrix3x2fv");
151
152 test(() => {
153 gl.uniformMatrix2x4fv(uniform, false, f32array);
154 }, "uniformMatrix2x4fv");
155
156 test(() => {
157 gl.uniformMatrix4x2fv(uniform, false, f32array);
158 }, "uniformMatrix4x2fv");
159
160 test(() => {
161 gl.uniformMatrix3x4fv(uniform, false, f32array);
162 }, "uniformMatrix3x4fv");
163
164 test(() => {
165 gl.uniformMatrix4x3fv(uniform, false, f32array);
166 }, "uniformMatrix4x3fv");
167
168 test(() => {
169 gl.vertexAttribI4iv(attribute, i32array);
170 }, "vertexAttribI4iv");
171
172 test(() => {
173 gl.vertexAttribI4uiv(attribute, u32array);
174 }, "vertexAttribI4uiv");
175
176 test(() => {
177 gl.clearBufferiv(gl.COLOR, 0, i32array);
178 }, "clearBufferiv");
179
180 test(() => {
181 gl.clearBufferuiv(gl.COLOR, 0, u32array);
182 }, "clearBufferuiv");
183
184 test(() => {
185 gl.clearBufferfv(gl.COLOR, 0, f32array);
186 }, "clearBufferfv");
187 }
188 }
189 }
190 done();
191 </script>
192 </body>
193 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/IDLExtendedAttributes.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698