Backed out changeset 7272b7396c78 (bug 1932758) for causing fenix debug failures...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / deqp / functional / gles3 / es3fShaderApiTests.js
blob2768f0325bc456967213115bda1b5b4784a1d79a
1 /*-------------------------------------------------------------------------
2  * drawElements Quality Program OpenGL ES Utilities
3  * ------------------------------------------------
4  *
5  * Copyright 2014 The Android Open Source Project
6  *
7  * Licensed under the Apache License, Version 2.0 (the 'License');
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an 'AS IS' BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
21 'use strict';
22 goog.provide('functional.gles3.es3fShaderApiTests');
23 goog.require('framework.common.tcuTestCase');
24 goog.require('framework.delibs.debase.deRandom');
25 goog.require('framework.delibs.debase.deString');
26 goog.require('framework.opengl.gluShaderProgram');
27 goog.require('functional.gles3.es3fApiCase');
29 goog.scope(function() {
30 var es3fShaderApiTests = functional.gles3.es3fShaderApiTests;
31 var tcuTestCase = framework.common.tcuTestCase;
32 var es3fApiCase = functional.gles3.es3fApiCase;
33 var gluShaderProgram = framework.opengl.gluShaderProgram;
34 var deRandom = framework.delibs.debase.deRandom;
35 var deString = framework.delibs.debase.deString;
37 /** @type {WebGL2RenderingContext} */ var gl;
39 var setParentClass = function(child, parent) {
40     child.prototype = Object.create(parent.prototype);
41     child.prototype.constructor = child;
44 var getSimpleShaderSource = function(shaderType) {
45     var simpleVertexShaderSource =
46         '#version 300 es\n' +
47         'void main (void)\n' +
48         '{\n' +
49         ' gl_Position = vec4(0.0);\n' +
50         '}\n';
52     var simpleFragmentShaderSource =
53         '#version 300 es\n' +
54         'layout(location = 0) out mediump vec4 o_fragColor;\n' +
55         'void main (void)\n' +
56         '{\n' +
57         ' o_fragColor = vec4(0.0);\n' +
58         '}\n';
60     switch (shaderType) {
61         case gluShaderProgram.shaderType.VERTEX:
62             return simpleVertexShaderSource;
63         case gluShaderProgram.shaderType.FRAGMENT:
64             return simpleFragmentShaderSource;
65         default:
66             throw new Error('Invalid shader type');
67     }
70 /**
71  * @constructor
72  * @extends {es3fApiCase.ApiCase}
73  * @param {string} name
74  * @param {string} description
75  * @param {gluShaderProgram.shaderType} shaderType
76  */
77 es3fShaderApiTests.CreateShaderCase = function(name, description, shaderType) {
78     es3fApiCase.ApiCase.call(this, name, description, gl);
79     this.m_shaderType = shaderType;
82 setParentClass(es3fShaderApiTests.CreateShaderCase, es3fApiCase.ApiCase);
84 es3fShaderApiTests.CreateShaderCase.prototype.test = function() {
85     var shaderObject = gl.createShader(gluShaderProgram.getGLShaderType(gl, this.m_shaderType));
86     this.check(shaderObject != null);
87     gl.deleteShader(shaderObject);
90 /**
91  * @constructor
92  * @extends {es3fApiCase.ApiCase}
93  * @param {string} name
94  * @param {string} description
95  * @param {gluShaderProgram.shaderType} shaderType
96  */
97 es3fShaderApiTests.CompileShaderCase = function(name, description, shaderType) {
98     es3fApiCase.ApiCase.call(this, name, description, gl);
99     this.m_shaderType = shaderType;
102 setParentClass(es3fShaderApiTests.CompileShaderCase, es3fApiCase.ApiCase);
104 es3fShaderApiTests.CompileShaderCase.prototype.checkCompileStatus = function(shader) {
105     var status = /** @type {boolean} */ (gl.getShaderParameter(shader, gl.COMPILE_STATUS));
106     return status;
109 es3fShaderApiTests.CompileShaderCase.prototype.test = function() {
110     var shaderObject = gl.createShader(gluShaderProgram.getGLShaderType(gl, this.m_shaderType));
111     var shaderSource = getSimpleShaderSource(this.m_shaderType);
113     this.check(shaderObject != null);
115     gl.shaderSource(shaderObject, shaderSource);
116     gl.compileShader(shaderObject);
118     this.check(this.checkCompileStatus(shaderObject));
120     gl.deleteShader(shaderObject);
124  * @constructor
125  * @extends {es3fApiCase.ApiCase}
126  * @param {string} name
127  * @param {string} description
128  * @param {gluShaderProgram.shaderType} shaderType
129  */
130 es3fShaderApiTests.ShaderSourceReplaceCase = function(name, description, shaderType) {
131     es3fApiCase.ApiCase.call(this, name, description, gl);
132     this.m_shaderType = shaderType;
135 setParentClass(es3fShaderApiTests.ShaderSourceReplaceCase, es3fApiCase.ApiCase);
137 es3fShaderApiTests.ShaderSourceReplaceCase.prototype.generateFirstSource = function() {
138     return getSimpleShaderSource(this.m_shaderType);
141 es3fShaderApiTests.ShaderSourceReplaceCase.prototype.generateSecondSource = function() {
142     var source = '#version 300 es\n' +
143                  'precision mediump float;\n';
145     if (this.m_shaderType == gluShaderProgram.shaderType.FRAGMENT)
146         source += 'layout(location = 0) out mediump vec4 o_fragColor;\n';
148     source += 'void main()\n'+
149             '{\n'+
150             ' float variable = 1.0f;\n';
152     if (this.m_shaderType == gluShaderProgram.shaderType.VERTEX) source += ' gl_Position = vec4(variable);\n';
153     else if (this.m_shaderType == gluShaderProgram.shaderType.FRAGMENT) source += ' o_fragColor = vec4(variable);\n';
155     source += '}\n';
157     return source;
160 es3fShaderApiTests.ShaderSourceReplaceCase.prototype.test = function() {
161     var shaderObject = gl.createShader(gluShaderProgram.getGLShaderType(gl, this.m_shaderType));
162     var firstSource = this.generateFirstSource();
163     var secondSource = this.generateSecondSource();
165     this.check(shaderObject != null);
167     gl.shaderSource(shaderObject, firstSource);
168     this.check(firstSource == gl.getShaderSource(shaderObject));
170     gl.shaderSource(shaderObject, secondSource);
171     this.check(secondSource == gl.getShaderSource(shaderObject));
173     gl.deleteShader(shaderObject);
177  * @constructor
178  */
179 es3fShaderApiTests.SourceGenerator = function() {};
182  * @param {gluShaderProgram.shaderType} shaderType
183  * @return {string}
184  */
185 es3fShaderApiTests.SourceGenerator.prototype.next = function(shaderType) {
186     throw new Error('Virtual function. Please override');
190  * @param {gluShaderProgram.shaderType} shaderType
191  * @return {boolean}
192  */
193 es3fShaderApiTests.SourceGenerator.prototype.finished = function(shaderType) {
194     throw new Error('Virtual function. Please override');
198  * @constructor
199  * @extends {es3fShaderApiTests.SourceGenerator}
200  */
201 es3fShaderApiTests.ConstantShaderGenerator = function(rnd) {
202     es3fShaderApiTests.SourceGenerator.call(this);
203     this.m_rnd = rnd;
206 setParentClass(es3fShaderApiTests.ConstantShaderGenerator, es3fShaderApiTests.SourceGenerator);
208 es3fShaderApiTests.SourceGenerator.prototype.next = function(shaderType) {
209     var value = this.m_rnd.getFloat(0.0, 1.0);
210     var outputName = (shaderType == gluShaderProgram.shaderType.VERTEX) ? 'gl_Position' : 'o_fragColor';
212     var out = '#version 300 es\n';
214     if (shaderType == gluShaderProgram.shaderType.FRAGMENT)
215         out += 'layout(location = 0) out mediump vec4 o_fragColor;\n';
217     out += 'void main (void)\n';
218     out += '{\n';
219     out += ' ' + outputName + ' = vec4(' + value + ');\n';
220     out += '}\n';
222     return out;
225 es3fShaderApiTests.SourceGenerator.prototype.finished = function(shaderType) {
226     return false;
229 // Shader allocation utility
232  * @constructor
233  * @param {es3fShaderApiTests.SourceGenerator} generator
234  */
235 es3fShaderApiTests.ShaderAllocator = function(generator) {
236     this.m_srcGen = generator;
237     this.m_shaders = {};
241  * @param {gluShaderProgram.shaderType} shaderType
242  */
243 es3fShaderApiTests.ShaderAllocator.prototype.createShader = function(shaderType) {
244     var shader = new gluShaderProgram.Shader(gl, shaderType);
245     this.m_shaders[shaderType] = shader;
246     this.setSource(shaderType);
247     return shader;
251  * @param {gluShaderProgram.shaderType} shaderType
252  */
253 es3fShaderApiTests.ShaderAllocator.prototype.deleteShader = function(shaderType) {
254     this.m_shaders[shaderType].destroy();
255     this.m_shaders[shaderType] = null;
259  * @param {gluShaderProgram.shaderType} shaderType
260  */
261 es3fShaderApiTests.ShaderAllocator.prototype.setSource = function(shaderType) {
262     var source = this.m_srcGen.next(shaderType);
263     this.m_shaders[shaderType].setSources(source);
267  * @param {gluShaderProgram.shaderType} shaderType
268  */
269 es3fShaderApiTests.ShaderAllocator.prototype.get = function(shaderType) {
270     return this.m_shaders[shaderType];
273 // Base class for simple program API tests
276  * @constructor
277  * @extends {es3fApiCase.ApiCase}
278  * @param {string} name
279  * @param {string} description
280  */
281 es3fShaderApiTests.SimpleProgramCase = function(name, description) {
282     es3fApiCase.ApiCase.call(this, name, description, gl);
283     this.m_vertShader = null;
284     this.m_fragShader = null;
285     this.m_program = null;
288 setParentClass(es3fShaderApiTests.SimpleProgramCase, es3fApiCase.ApiCase);
290 es3fShaderApiTests.SimpleProgramCase.prototype.compileShaders = function() {
291     var vertSource = getSimpleShaderSource(gluShaderProgram.shaderType.VERTEX);
292     var fragSource = getSimpleShaderSource(gluShaderProgram.shaderType.FRAGMENT);
294     var vertShader = gl.createShader(gl.VERTEX_SHADER);
295     var fragShader = gl.createShader(gl.FRAGMENT_SHADER);
297     this.check(vertShader != null);
298     this.check(fragShader != null);
300     gl.shaderSource(vertShader, vertSource);
301     gl.compileShader(vertShader);
303     gl.shaderSource(fragShader, fragSource);
304     gl.compileShader(fragShader);
306     this.m_vertShader = vertShader;
307     this.m_fragShader = fragShader;
310 es3fShaderApiTests.SimpleProgramCase.prototype.linkProgram = function() {
311     var program = gl.createProgram();
313     this.check(program != null);
315     gl.attachShader(program, this.m_vertShader);
316     gl.attachShader(program, this.m_fragShader);
318     gl.linkProgram(program);
320     this.m_program = program;
323 es3fShaderApiTests.SimpleProgramCase.prototype.cleanup = function() {
324     gl.deleteShader(this.m_vertShader);
325     gl.deleteShader(this.m_fragShader);
326     gl.deleteProgram(this.m_program);
330  * @constructor
331  * @extends {es3fShaderApiTests.SimpleProgramCase}
332  * @param {string} name
333  * @param {string} description
334  */
335 es3fShaderApiTests.DeleteShaderCase = function(name, description) {
336     es3fShaderApiTests.SimpleProgramCase.call(this, name, description);
339 setParentClass(es3fShaderApiTests.DeleteShaderCase, es3fShaderApiTests.SimpleProgramCase);
341 es3fShaderApiTests.DeleteShaderCase.prototype.checkDeleteStatus = function(shader) {
342     var status = /** @type {boolean} */ (gl.getShaderParameter(shader, gl.DELETE_STATUS));
343     return status;
346 es3fShaderApiTests.DeleteShaderCase.prototype.deleteShaders = function() {
347     gl.deleteShader(this.m_vertShader);
348     gl.deleteShader(this.m_fragShader);
351 es3fShaderApiTests.DeleteShaderCase.prototype.test = function() {
352     this.compileShaders();
353     this.linkProgram();
355     this.deleteShaders();
357     this.check(this.checkDeleteStatus(this.m_vertShader) && this.checkDeleteStatus(this.m_fragShader));
359     gl.deleteProgram(this.m_program);
361     this.check(!(gl.isShader(this.m_vertShader) || gl.isShader(this.m_fragShader)));
365  * @constructor
366  * @extends {es3fShaderApiTests.SimpleProgramCase}
367  * @param {string} name
368  * @param {string} description
369  */
370 es3fShaderApiTests.LinkVertexFragmentCase = function(name, description) {
371     es3fShaderApiTests.SimpleProgramCase.call(this, name, description);
374 setParentClass(es3fShaderApiTests.LinkVertexFragmentCase, es3fShaderApiTests.SimpleProgramCase);
376 es3fShaderApiTests.LinkVertexFragmentCase.prototype.checkLinkStatus = function(program) {
377     var status = /** @type {boolean} */ (gl.getProgramParameter(program, gl.LINK_STATUS));
378     return status;
381 es3fShaderApiTests.LinkVertexFragmentCase.prototype.test = function() {
382     this.compileShaders();
383     this.linkProgram();
385     this.check(this.checkLinkStatus(this.m_program), 'Fail, expected LINK_STATUS to be TRUE.');
387     this.cleanup();
390 // Base class for program state persistence cases
393  * @constructor
394  * @extends {es3fApiCase.ApiCase}
395  * @param {string} name
396  * @param {string} description
397  * @param {gluShaderProgram.shaderType} shaderType
398  */
399 es3fShaderApiTests.ProgramStateCase = function(name, description, shaderType) {
400     es3fApiCase.ApiCase.call(this, name, description, gl);
401     this.m_shaderType = shaderType;
402     this.m_rnd = new deRandom.Random(deString.deStringHash(name) ^ 0x713de0ca);
405 setParentClass(es3fShaderApiTests.ProgramStateCase, es3fApiCase.ApiCase);
408  * @param {gluShaderProgram.Program} program
409  * @param {es3fShaderApiTests.ShaderAllocator} shaders
410  */
411 es3fShaderApiTests.ProgramStateCase.prototype.buildProgram = function(program, shaders) {
412     var vertShader = shaders.createShader(gluShaderProgram.shaderType.VERTEX);
413     var fragShader = shaders.createShader(gluShaderProgram.shaderType.FRAGMENT);
415     vertShader.compile();
416     fragShader.compile();
418     program.attachShader(vertShader.getShader());
419     program.attachShader(fragShader.getShader());
420     program.link();
424  * @param {gluShaderProgram.Program} program
425  * @param {gluShaderProgram.ProgramInfo} reference
426  */
427 es3fShaderApiTests.ProgramStateCase.prototype.verify = function(program, reference) {
428     var programInfo = program.getInfo();
429     this.check(programInfo.linkOk, 'Fail, link status may only change as a result of linking');
431     this.check(programInfo.linkTimeUs == reference.linkTimeUs, 'Fail, reported link time changed.');
433     this.check(programInfo.infoLog == reference.infoLog, 'Fail, program infolog changed.');
436 es3fShaderApiTests.ProgramStateCase.prototype.test = function() {
437     var sourceGen = new es3fShaderApiTests.ConstantShaderGenerator(this.m_rnd);
439     var shaders = new es3fShaderApiTests.ShaderAllocator(sourceGen);
440     var program = new gluShaderProgram.Program(gl);
442     this.buildProgram(program, shaders);
444     if (program.getLinkStatus()) {
445         var programInfo = program.getInfo();
447         this.executeForProgram(program, shaders);
449         this.verify(program, programInfo);
451     } else{
452         this.check(false, "Fail, couldn't link program.");
453     }
458  * @constructor
459  * @extends {es3fShaderApiTests.ProgramStateCase}
460  * @param {string} name
461  * @param {string} description
462  * @param {gluShaderProgram.shaderType} shaderType
463  */
464 es3fShaderApiTests.ProgramStateDetachShaderCase = function(name, description, shaderType) {
465     es3fShaderApiTests.ProgramStateCase.call(this, name, description, shaderType);
468 setParentClass(es3fShaderApiTests.ProgramStateDetachShaderCase, es3fShaderApiTests.ProgramStateCase);
470 es3fShaderApiTests.ProgramStateDetachShaderCase.prototype.executeForProgram = function(program, shaders) {
471     var caseShader = shaders.get(this.m_shaderType);
472     program.detachShader(caseShader.getShader());
476  * @constructor
477  * @extends {es3fShaderApiTests.ProgramStateCase}
478  * @param {string} name
479  * @param {string} description
480  * @param {gluShaderProgram.shaderType} shaderType
481  */
482 es3fShaderApiTests.ProgramStateReattachShaderCase = function(name, description, shaderType) {
483     es3fShaderApiTests.ProgramStateCase.call(this, name, description, shaderType);
486 setParentClass(es3fShaderApiTests.ProgramStateReattachShaderCase, es3fShaderApiTests.ProgramStateCase);
488 es3fShaderApiTests.ProgramStateReattachShaderCase.prototype.executeForProgram = function(program, shaders) {
489     var caseShader = shaders.get(this.m_shaderType);
490     program.detachShader(caseShader.getShader());
491     program.attachShader(caseShader.getShader());
495  * @constructor
496  * @extends {es3fShaderApiTests.ProgramStateCase}
497  * @param {string} name
498  * @param {string} description
499  * @param {gluShaderProgram.shaderType} shaderType
500  */
501 es3fShaderApiTests.ProgramStateDeleteShaderCase = function(name, description, shaderType) {
502     es3fShaderApiTests.ProgramStateCase.call(this, name, description, shaderType);
505 setParentClass(es3fShaderApiTests.ProgramStateDeleteShaderCase, es3fShaderApiTests.ProgramStateCase);
507 es3fShaderApiTests.ProgramStateDeleteShaderCase.prototype.executeForProgram = function(program, shaders) {
508     var caseShader = shaders.get(this.m_shaderType);
509     program.detachShader(caseShader.getShader());
510     shaders.deleteShader(this.m_shaderType);
514  * @constructor
515  * @extends {es3fShaderApiTests.ProgramStateCase}
516  * @param {string} name
517  * @param {string} description
518  * @param {gluShaderProgram.shaderType} shaderType
519  */
520 es3fShaderApiTests.ProgramStateReplaceShaderCase = function(name, description, shaderType) {
521     es3fShaderApiTests.ProgramStateCase.call(this, name, description, shaderType);
524 setParentClass(es3fShaderApiTests.ProgramStateReplaceShaderCase, es3fShaderApiTests.ProgramStateCase);
526 es3fShaderApiTests.ProgramStateReplaceShaderCase.prototype.executeForProgram = function(program, shaders) {
527     var caseShader = shaders.get(this.m_shaderType);
528     program.detachShader(caseShader.getShader());
529     shaders.deleteShader(this.m_shaderType);
530     program.attachShader(shaders.createShader(this.m_shaderType).getShader());
534  * @constructor
535  * @extends {es3fShaderApiTests.ProgramStateCase}
536  * @param {string} name
537  * @param {string} description
538  * @param {gluShaderProgram.shaderType} shaderType
539  */
540 es3fShaderApiTests.ProgramStateRecompileShaderCase = function(name, description, shaderType) {
541     es3fShaderApiTests.ProgramStateCase.call(this, name, description, shaderType);
544 setParentClass(es3fShaderApiTests.ProgramStateRecompileShaderCase, es3fShaderApiTests.ProgramStateCase);
546 es3fShaderApiTests.ProgramStateRecompileShaderCase.prototype.executeForProgram = function(program, shaders) {
547     var caseShader = shaders.get(this.m_shaderType);
548     caseShader.compile();
552  * @constructor
553  * @extends {es3fShaderApiTests.ProgramStateCase}
554  * @param {string} name
555  * @param {string} description
556  * @param {gluShaderProgram.shaderType} shaderType
557  */
558 es3fShaderApiTests.ProgramStateReplaceSourceCase = function(name, description, shaderType) {
559     es3fShaderApiTests.ProgramStateCase.call(this, name, description, shaderType);
562 setParentClass(es3fShaderApiTests.ProgramStateReplaceSourceCase, es3fShaderApiTests.ProgramStateCase);
564 es3fShaderApiTests.ProgramStateReplaceSourceCase.prototype.executeForProgram = function(program, shaders) {
565     var caseShader = shaders.get(this.m_shaderType);
566     shaders.setSource(this.m_shaderType);
567     caseShader.compile();
571 * @constructor
572 * @extends {tcuTestCase.DeqpTest}
574 es3fShaderApiTests.ShaderApiTests = function() {
575     tcuTestCase.DeqpTest.call(this, 'shader_api', 'Shader API Cases');
578 es3fShaderApiTests.ShaderApiTests.prototype = Object.create(tcuTestCase.DeqpTest.prototype);
579 es3fShaderApiTests.ShaderApiTests.prototype.constructor = es3fShaderApiTests.ShaderApiTests;
581 es3fShaderApiTests.ShaderApiTests.prototype.init = function() {
582     // create and delete shaders
583     var createDeleteGroup = new tcuTestCase.DeqpTest('create_delete', 'glCreateShader() tests');
584     this.addChild(createDeleteGroup);
586     createDeleteGroup.addChild(new es3fShaderApiTests.CreateShaderCase('create_vertex_shader', 'Create vertex shader object', gluShaderProgram.shaderType.VERTEX));
587     createDeleteGroup.addChild(new es3fShaderApiTests.CreateShaderCase('create_fragment_shader', 'Create fragment shader object', gluShaderProgram.shaderType.FRAGMENT));
589     createDeleteGroup.addChild(new es3fShaderApiTests.DeleteShaderCase('delete_vertex_fragment', 'Delete vertex shader and fragment shader'));
591     // compile and link
592     var compileLinkGroup = new tcuTestCase.DeqpTest('compile_link', 'Compile and link tests');
593     this.addChild(compileLinkGroup);
595     compileLinkGroup.addChild(new es3fShaderApiTests.CompileShaderCase('compile_vertex_shader', 'Compile vertex shader', gluShaderProgram.shaderType.VERTEX));
596     compileLinkGroup.addChild(new es3fShaderApiTests.CompileShaderCase('compile_fragment_shader', 'Compile fragment shader', gluShaderProgram.shaderType.FRAGMENT));
598     compileLinkGroup.addChild(new es3fShaderApiTests.LinkVertexFragmentCase('link_vertex_fragment', 'Link vertex and fragment shaders'));
600     // shader source
601     var shaderSourceGroup = new tcuTestCase.DeqpTest('shader_source', 'glShaderSource() tests');
602     this.addChild(shaderSourceGroup);
603     shaderSourceGroup.addChild(new es3fShaderApiTests.ShaderSourceReplaceCase('replace_source_vertex', 'Replace source code of vertex shader', gluShaderProgram.shaderType.VERTEX));
604     shaderSourceGroup.addChild(new es3fShaderApiTests.ShaderSourceReplaceCase('replace_source_fragment', 'Replace source code of fragment shader', gluShaderProgram.shaderType.FRAGMENT));
606     // link status and infolog
607     var linkStatusGroup = new tcuTestCase.DeqpTest('program_state', 'Program state persistence tests');
608     this.addChild(linkStatusGroup);
610     linkStatusGroup.addChild(new es3fShaderApiTests.ProgramStateDetachShaderCase('detach_shader_vertex', 'detach vertex shader', gluShaderProgram.shaderType.VERTEX));
611     linkStatusGroup.addChild(new es3fShaderApiTests.ProgramStateReattachShaderCase('reattach_shader_vertex', 'reattach vertex shader', gluShaderProgram.shaderType.VERTEX));
612     linkStatusGroup.addChild(new es3fShaderApiTests.ProgramStateDeleteShaderCase('delete_shader_vertex', 'delete vertex shader', gluShaderProgram.shaderType.VERTEX));
613     linkStatusGroup.addChild(new es3fShaderApiTests.ProgramStateReplaceShaderCase('replace_shader_vertex', 'replace vertex shader object', gluShaderProgram.shaderType.VERTEX));
614     linkStatusGroup.addChild(new es3fShaderApiTests.ProgramStateRecompileShaderCase('recompile_shader_vertex', 'recompile vertex shader', gluShaderProgram.shaderType.VERTEX));
615     linkStatusGroup.addChild(new es3fShaderApiTests.ProgramStateReplaceSourceCase('replace_source_vertex', 'replace vertex shader source', gluShaderProgram.shaderType.VERTEX));
617     linkStatusGroup.addChild(new es3fShaderApiTests.ProgramStateDetachShaderCase('detach_shader_fragment', 'detach fragment shader', gluShaderProgram.shaderType.FRAGMENT));
618     linkStatusGroup.addChild(new es3fShaderApiTests.ProgramStateReattachShaderCase('reattach_shader_fragment', 'reattach fragment shader', gluShaderProgram.shaderType.FRAGMENT));
619     linkStatusGroup.addChild(new es3fShaderApiTests.ProgramStateDeleteShaderCase('delete_shader_fragment', 'delete fragment shader', gluShaderProgram.shaderType.FRAGMENT));
620     linkStatusGroup.addChild(new es3fShaderApiTests.ProgramStateReplaceShaderCase('replace_shader_fragment', 'replace fragment shader object', gluShaderProgram.shaderType.FRAGMENT));
621     linkStatusGroup.addChild(new es3fShaderApiTests.ProgramStateRecompileShaderCase('recompile_shader_fragment', 'recompile fragment shader', gluShaderProgram.shaderType.FRAGMENT));
622     linkStatusGroup.addChild(new es3fShaderApiTests.ProgramStateReplaceSourceCase('replace_source_fragment', 'replace fragment shader source', gluShaderProgram.shaderType.FRAGMENT));
627 * Run test
628 * @param {WebGL2RenderingContext} context
630 es3fShaderApiTests.run = function(context) {
631     gl = context;
632     //Set up Test Root parameters
633     var state = tcuTestCase.runner;
634     state.setRoot(new es3fShaderApiTests.ShaderApiTests());
636     //Set up name and description of this test series.
637     setCurrentTestName(state.testCases.fullName());
638     description(state.testCases.getDescription());
640     try {
641         //Run test cases
642         tcuTestCase.runTestCases();
643     }
644     catch (err) {
645         testFailedOptions('Failed to es3fShaderApiTests.run tests', false);
646         tcuTestCase.runner.terminate();
647     }