13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*------------------------------------------------------------------------- 23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * drawElements Quality Program OpenGL ES 2.0 Module 33c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * ------------------------------------------------- 43c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 53c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Copyright 2014 The Android Open Source Project 63c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 73c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Licensed under the Apache License, Version 2.0 (the "License"); 83c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * you may not use this file except in compliance with the License. 93c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * You may obtain a copy of the License at 103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * http://www.apache.org/licenses/LICENSE-2.0 123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Unless required by applicable law or agreed to in writing, software 143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * distributed under the License is distributed on an "AS IS" BASIS, 153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * See the License for the specific language governing permissions and 173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * limitations under the License. 183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*! 203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \file 213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief Random shader tests. 223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "es2fRandomShaderTests.hpp" 253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glsRandomShaderCase.hpp" 263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deStringUtil.hpp" 273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 283c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp 293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 303c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace gles2 313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 323c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace Functional 333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 353c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace 363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 383c827367444ee418f129b2c238299f49d3264554Jarkko Poyrygls::RandomShaderCase* createRandomShaderCase (Context& context, const char* description, const rsg::ProgramParameters& baseParams, deUint32 seed, bool vertex, bool fragment) 393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry rsg::ProgramParameters params = baseParams; 413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.seed = seed; 433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.vertexParameters.randomize = vertex; 443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.fragmentParameters.randomize = fragment; 453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return new gls::RandomShaderCase(context.getTestContext(), context.getRenderContext(), de::toString(seed).c_str(), description, params); 473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 493c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass BasicExpressionGroup : public TestCaseGroup 503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 513c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry BasicExpressionGroup (Context& context) 533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : TestCaseGroup(context, "basic_expression", "Basic arithmetic expressions") 543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void init (void) 583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry rsg::ProgramParameters params; 603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* vertexGroup = new tcu::TestCaseGroup(m_testCtx, "vertex", "Vertex-only tests"); 623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(vertexGroup); 633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* fragmentGroup = new tcu::TestCaseGroup(m_testCtx, "fragment", "Fragment-only tests"); 653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(fragmentGroup); 663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* combinedGroup = new tcu::TestCaseGroup(m_testCtx, "combined", "Combined tests"); 683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(combinedGroup); 693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int seed = 0; seed < 100; seed++) 713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry vertexGroup->addChild(createRandomShaderCase(m_context, "Random expressions in vertex shader", params, seed, true, false)); 733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry fragmentGroup->addChild(createRandomShaderCase(m_context, "Random expressions in fragment shader", params, seed, false, true)); 743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry combinedGroup->addChild(createRandomShaderCase(m_context, "Random expressions in vertex and fragment shaders", params, seed, true, true)); 753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 793c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass ScalarConversionGroup : public TestCaseGroup 803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 813c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ScalarConversionGroup (Context& context) 833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : TestCaseGroup(context, "scalar_conversion", "Scalar conversions") 843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void init (void) 883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry rsg::ProgramParameters params; 903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.useScalarConversions = true; 913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* vertexGroup = new tcu::TestCaseGroup(m_testCtx, "vertex", "Vertex-only tests"); 933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(vertexGroup); 943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* fragmentGroup = new tcu::TestCaseGroup(m_testCtx, "fragment", "Fragment-only tests"); 963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(fragmentGroup); 973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* combinedGroup = new tcu::TestCaseGroup(m_testCtx, "combined", "Combined tests"); 993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(combinedGroup); 1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int seed = 0; seed < 100; seed++) 1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry vertexGroup->addChild(createRandomShaderCase(m_context, "Scalar conversions in vertex shader", params, seed, true, false)); 1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry fragmentGroup->addChild(createRandomShaderCase(m_context, "Scalar conversions in fragment shader", params, seed, false, true)); 1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry combinedGroup->addChild(createRandomShaderCase(m_context, "Scalar conversions in vertex and fragment shaders", params, seed, true, true)); 1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass SwizzleGroup : public TestCaseGroup 1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry SwizzleGroup (Context& context) 1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : TestCaseGroup(context, "swizzle", "Vector swizzles") 1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void init (void) 1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry rsg::ProgramParameters params; 1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.useScalarConversions = true; 1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.useSwizzle = true; 1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* vertexGroup = new tcu::TestCaseGroup(m_testCtx, "vertex", "Vertex-only tests"); 1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(vertexGroup); 1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* fragmentGroup = new tcu::TestCaseGroup(m_testCtx, "fragment", "Fragment-only tests"); 1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(fragmentGroup); 1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int seed = 0; seed < 50; seed++) 1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry vertexGroup->addChild(createRandomShaderCase(m_context, "Vector swizzles in vertex shader", params, seed, true, false)); 1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry fragmentGroup->addChild(createRandomShaderCase(m_context, "Vector swizzles in fragment shader", params, seed, false, true)); 1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass ComparisonOpsGroup : public TestCaseGroup 1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ComparisonOpsGroup (Context& context) 1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : TestCaseGroup(context, "comparison_ops", "Comparison operators") 1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void init (void) 1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry rsg::ProgramParameters params; 1493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.useScalarConversions = true; 1503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.useComparisonOps = true; 1513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* vertexGroup = new tcu::TestCaseGroup(m_testCtx, "vertex", "Vertex-only tests"); 1533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(vertexGroup); 1543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* fragmentGroup = new tcu::TestCaseGroup(m_testCtx, "fragment", "Fragment-only tests"); 1563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(fragmentGroup); 1573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int seed = 0; seed < 50; seed++) 1593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry vertexGroup->addChild(createRandomShaderCase(m_context, "Comparison operators in vertex shader", params, seed, true, false)); 1613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry fragmentGroup->addChild(createRandomShaderCase(m_context, "Comparison operators in fragment shader", params, seed, false, true)); 1623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 1653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1663c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass ConditionalsGroup : public TestCaseGroup 1673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1683c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 1693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ConditionalsGroup (Context& context) 1703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : TestCaseGroup(context, "conditionals", "Conditional control flow (if-else)") 1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void init (void) 1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry rsg::ProgramParameters params; 1773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.useScalarConversions = true; 1783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.useSwizzle = true; 1793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.useComparisonOps = true; 1803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.useConditionals = true; 1813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.vertexParameters.maxStatementDepth = 4; 1823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.vertexParameters.maxStatementsPerBlock = 5; 1833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.fragmentParameters.maxStatementDepth = 4; 1843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.fragmentParameters.maxStatementsPerBlock = 5; 1853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* vertexGroup = new tcu::TestCaseGroup(m_testCtx, "vertex", "Vertex-only tests"); 1873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(vertexGroup); 1883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* fragmentGroup = new tcu::TestCaseGroup(m_testCtx, "fragment", "Fragment-only tests"); 1903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(fragmentGroup); 1913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* combinedGroup = new tcu::TestCaseGroup(m_testCtx, "combined", "Combined tests"); 1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(combinedGroup); 1943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int seed = 0; seed < 100; seed++) 1963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry vertexGroup->addChild(createRandomShaderCase(m_context, "Conditional control flow in vertex shader", params, seed, true, false)); 1983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry fragmentGroup->addChild(createRandomShaderCase(m_context, "Conditional control flow in fragment shader", params, seed, false, true)); 1993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry combinedGroup->addChild(createRandomShaderCase(m_context, "Conditional control flow in vertex and fragment shaders", params, seed, true, true)); 2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 2033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2043c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass TrigonometricGroup : public TestCaseGroup 2053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2063c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 2073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TrigonometricGroup (Context& context) 2083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : TestCaseGroup(context, "trigonometric", "Trigonometric built-in functions") 2093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void init (void) 2133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry rsg::ProgramParameters params; 2153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.useScalarConversions = true; 2163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.useSwizzle = true; 2173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.trigonometricBaseWeight = 4.0f; 2183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* vertexGroup = new tcu::TestCaseGroup(m_testCtx, "vertex", "Vertex-only tests"); 2203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(vertexGroup); 2213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* fragmentGroup = new tcu::TestCaseGroup(m_testCtx, "fragment", "Fragment-only tests"); 2233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(fragmentGroup); 2243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int seed = 0; seed < 100; seed++) 2263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry vertexGroup->addChild(createRandomShaderCase(m_context, "Trigonometric ops in vertex shader", params, seed, true, false)); 2283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry fragmentGroup->addChild(createRandomShaderCase(m_context, "Trigonometric ops in fragment shader", params, seed, false, true)); 2293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 2323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2333c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass ExponentialGroup : public TestCaseGroup 2343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2353c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 2363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ExponentialGroup (Context& context) 2373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : TestCaseGroup(context, "exponential", "Exponential built-in functions") 2383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void init (void) 2423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry rsg::ProgramParameters params; 2443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.useScalarConversions = true; 2453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.useSwizzle = true; 2463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.exponentialBaseWeight = 4.0f; 2473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* vertexGroup = new tcu::TestCaseGroup(m_testCtx, "vertex", "Vertex-only tests"); 2493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(vertexGroup); 2503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* fragmentGroup = new tcu::TestCaseGroup(m_testCtx, "fragment", "Fragment-only tests"); 2523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(fragmentGroup); 2533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int seed = 0; seed < 100; seed++) 2553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry vertexGroup->addChild(createRandomShaderCase(m_context, "Exponential ops in vertex shader", params, seed, true, false)); 2573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry fragmentGroup->addChild(createRandomShaderCase(m_context, "Exponential ops in fragment shader", params, seed, false, true)); 2583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 2613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2623c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass TextureGroup : public TestCaseGroup 2633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2643c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 2653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TextureGroup (Context& context) 2663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : TestCaseGroup(context, "texture", "Texture lookups") 2673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void init (void) 2713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry rsg::ProgramParameters params; 2733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.useScalarConversions = true; 2743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.useSwizzle = true; 2753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.vertexParameters.texLookupBaseWeight = 10.0f; 2763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.vertexParameters.useTexture2D = true; 2773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.vertexParameters.useTextureCube = true; 2783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.fragmentParameters.texLookupBaseWeight = 10.0f; 2793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.fragmentParameters.useTexture2D = true; 2803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.fragmentParameters.useTextureCube = true; 2813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* vertexGroup = new tcu::TestCaseGroup(m_testCtx, "vertex", "Vertex-only tests"); 2833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(vertexGroup); 2843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* fragmentGroup = new tcu::TestCaseGroup(m_testCtx, "fragment", "Fragment-only tests"); 2863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(fragmentGroup); 2873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Do only 50 vertex cases and 150 fragment cases. 2893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int seed = 0; seed < 50; seed++) 2903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry vertexGroup->addChild(createRandomShaderCase(m_context, "Texture lookups in vertex shader", params, seed, true, false)); 2913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int seed = 0; seed < 150; seed++) 2933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry fragmentGroup->addChild(createRandomShaderCase(m_context, "Texture lookups in fragment shader", params, seed, false, true)); 2943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 2963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2973c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass AllFeaturesGroup : public TestCaseGroup 2983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2993c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 3003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry AllFeaturesGroup (Context& context) 3013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : TestCaseGroup(context, "all_features", "All features enabled") 3023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void init (void) 3063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry rsg::ProgramParameters params; 3083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.useScalarConversions = true; 3093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.useSwizzle = true; 3103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.useComparisonOps = true; 3113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.useConditionals = true; 3123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.trigonometricBaseWeight = 1.0f; 3133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.exponentialBaseWeight = 1.0f; 3143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.vertexParameters.maxStatementDepth = 4; 3163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.vertexParameters.maxStatementsPerBlock = 7; 3173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.vertexParameters.maxExpressionDepth = 7; 3183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.vertexParameters.maxCombinedVariableScalars = 64; 3193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.fragmentParameters.maxStatementDepth = 4; 3203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.fragmentParameters.maxStatementsPerBlock = 7; 3213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.fragmentParameters.maxExpressionDepth = 7; 3223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.fragmentParameters.maxCombinedVariableScalars = 64; 3233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.fragmentParameters.texLookupBaseWeight = 4.0f; // \note Texture lookups are enabled for fragment shaders only. 3253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.fragmentParameters.useTexture2D = true; 3263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry params.fragmentParameters.useTextureCube = true; 3273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* vertexGroup = new tcu::TestCaseGroup(m_testCtx, "vertex", "Vertex-only tests"); 3293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(vertexGroup); 3303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* fragmentGroup = new tcu::TestCaseGroup(m_testCtx, "fragment", "Fragment-only tests"); 3323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(fragmentGroup); 3333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int seed = 0; seed < 100; seed++) 3353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry vertexGroup->addChild(createRandomShaderCase(m_context, "Texture lookups in vertex shader", params, seed, true, false)); 3373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry fragmentGroup->addChild(createRandomShaderCase(m_context, "Texture lookups in fragment shader", params, seed, false, true)); 3383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 3413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // anonymous 3433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3443c827367444ee418f129b2c238299f49d3264554Jarkko PoyryRandomShaderTests::RandomShaderTests (Context& context) 3453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : TestCaseGroup(context, "random", "Random shaders") 3463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 3473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 3483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3493c827367444ee418f129b2c238299f49d3264554Jarkko PoyryRandomShaderTests::~RandomShaderTests (void) 3503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 3513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 3523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3533c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace 3543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 3553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // anonymous 3573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3583c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid RandomShaderTests::init (void) 3593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 3603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new BasicExpressionGroup (m_context)); 3613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new ScalarConversionGroup (m_context)); 3623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new SwizzleGroup (m_context)); 3633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new ComparisonOpsGroup (m_context)); 3643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new ConditionalsGroup (m_context)); 3653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new TrigonometricGroup (m_context)); 3663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new ExponentialGroup (m_context)); 3673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new TextureGroup (m_context)); 3683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(new AllFeaturesGroup (m_context)); 3693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 3703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // Functional 3723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // gles2 3733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp 374