es3fBuiltinPrecisionTests.js (3325B)
1 /*------------------------------------------------------------------------- 2 * drawElements Quality Program OpenGL ES 3.0 Module 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 *//*! 20 * \file 21 * \brief Tests for precision and range of GLSL builtins and types. 22 *//*--------------------------------------------------------------------*/ 23 'use strict'; 24 goog.provide('functional.gles3.es3fBuiltinPrecisionTests'); 25 goog.require('framework.common.tcuTestCase'); 26 goog.require('framework.opengl.gluShaderProgram'); 27 goog.require('modules.shared.glsBuiltinPrecisionTests'); 28 29 goog.scope(function() { 30 31 var es3fBuiltinPrecisionTests = functional.gles3.es3fBuiltinPrecisionTests; 32 var glsBuiltinPrecisionTests = modules.shared.glsBuiltinPrecisionTests; 33 var tcuTestCase = framework.common.tcuTestCase; 34 var gluShaderProgram = framework.opengl.gluShaderProgram; 35 36 /** 37 * @param {*} context 38 * @param {number} caseId test case Id 39 * @return {tcuTestCase.DeqpTest} 40 */ 41 es3fBuiltinPrecisionTests.createBuiltinPrecisionTests = function(context, caseId) { 42 /** @type {tcuTestCase.DeqpTest} */ 43 var group = tcuTestCase.newTest('precision', 'Builtin precision tests'); 44 45 /** @type {Array<gluShaderProgram.shaderType>} */ var shaderTypes = []; 46 var es3Cases = glsBuiltinPrecisionTests.createES3BuiltinCases(caseId); 47 48 shaderTypes.push(gluShaderProgram.shaderType.VERTEX); 49 shaderTypes.push(gluShaderProgram.shaderType.FRAGMENT); 50 51 glsBuiltinPrecisionTests.addBuiltinPrecisionTests(es3Cases, shaderTypes, group); 52 return group; 53 }; 54 55 /** 56 * Create and execute the test cases 57 * @param {WebGL2RenderingContext} context 58 * @param {number} caseId test case Id 59 */ 60 es3fBuiltinPrecisionTests.run = function(context, caseId) { 61 gl = context; 62 // Set up root Test 63 var state = tcuTestCase.runner; 64 65 var test = es3fBuiltinPrecisionTests.createBuiltinPrecisionTests(context, caseId); 66 var testName = test.fullName(); 67 var testDescription = test.getDescription() === undefined ? '' : test.getDescription(); 68 69 state.testName = testName; 70 state.setRoot(test); 71 //Set up name and description of this test series. 72 setCurrentTestName(testName); 73 description(testDescription); 74 75 try { 76 //Create test cases 77 test.init(); 78 //Run test cases 79 tcuTestCase.runTestCases(); 80 } catch (err) { 81 bufferedLogToConsole('Exception: ' + err); 82 testFailedOptions('Failed to es3fAttribLocationTests.run tests', false); 83 tcuTestCase.runner.terminate(); 84 } 85 }; 86 87 });