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