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 Drawing tests. 223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "es2sDrawTests.hpp" 253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glsDrawTest.hpp" 263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuRenderTarget.hpp" 273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deRandom.hpp" 283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deStringUtil.hpp" 293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deUniquePtr.hpp" 303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwEnums.hpp" 323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <set> 343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 353c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp 363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 373c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace gles2 383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 393c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace Stress 403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 413c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace 423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 443c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic void genBasicSpec (gls::DrawTestSpec& spec, gls::DrawTestSpec::DrawMethod method) 453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.apiType = glu::ApiType::es(2,0); 473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.primitive = gls::DrawTestSpec::PRIMITIVE_TRIANGLES; 483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.primitiveCount = 5; 493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.drawMethod = method; 503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.indexType = gls::DrawTestSpec::INDEXTYPE_LAST; 513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.indexPointerOffset = 0; 523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.indexStorage = gls::DrawTestSpec::STORAGE_LAST; 533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.first = 0; 543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.indexMin = 0; 553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.indexMax = 0; 563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.instanceCount = 1; 573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.attribs.resize(2); 593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.attribs[0].inputType = gls::DrawTestSpec::INPUTTYPE_FLOAT; 613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.attribs[0].outputType = gls::DrawTestSpec::OUTPUTTYPE_VEC2; 623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.attribs[0].storage = gls::DrawTestSpec::STORAGE_BUFFER; 633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.attribs[0].usage = gls::DrawTestSpec::USAGE_STATIC_DRAW; 643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.attribs[0].componentCount = 4; 653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.attribs[0].offset = 0; 663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.attribs[0].stride = 0; 673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.attribs[0].normalize = false; 683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.attribs[0].instanceDivisor = 0; 693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.attribs[0].useDefaultAttribute = false; 703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.attribs[1].inputType = gls::DrawTestSpec::INPUTTYPE_FLOAT; 723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.attribs[1].outputType = gls::DrawTestSpec::OUTPUTTYPE_VEC2; 733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.attribs[1].storage = gls::DrawTestSpec::STORAGE_BUFFER; 743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.attribs[1].usage = gls::DrawTestSpec::USAGE_STATIC_DRAW; 753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.attribs[1].componentCount = 2; 763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.attribs[1].offset = 0; 773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.attribs[1].stride = 0; 783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.attribs[1].normalize = false; 793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.attribs[1].instanceDivisor = 0; 803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.attribs[1].useDefaultAttribute = false; 813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 833c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass IndexGroup : public TestCaseGroup 843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 853c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry IndexGroup (Context& context, const char* name, const char* descr, gls::DrawTestSpec::DrawMethod drawMethod); 873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~IndexGroup (void); 883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void init (void); 903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 913c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::DrawMethod m_method; 933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 953c827367444ee418f129b2c238299f49d3264554Jarkko PoyryIndexGroup::IndexGroup (Context& context, const char* name, const char* descr, gls::DrawTestSpec::DrawMethod drawMethod) 963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : TestCaseGroup (context, name, descr) 973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_method (drawMethod) 983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1013c827367444ee418f129b2c238299f49d3264554Jarkko PoyryIndexGroup::~IndexGroup (void) 1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid IndexGroup::init (void) 1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry struct IndexTest 1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::Storage storage; 1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::IndexType type; 1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry bool aligned; 1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int offsets[3]; 1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const IndexTest tests[] = 1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { gls::DrawTestSpec::STORAGE_USER, gls::DrawTestSpec::INDEXTYPE_BYTE, true, { 0, 1, -1 } }, 1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { gls::DrawTestSpec::STORAGE_USER, gls::DrawTestSpec::INDEXTYPE_SHORT, true, { 0, 2, -1 } }, 1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { gls::DrawTestSpec::STORAGE_USER, gls::DrawTestSpec::INDEXTYPE_SHORT, false, { 1, 3, -1 } }, 1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { gls::DrawTestSpec::STORAGE_BUFFER, gls::DrawTestSpec::INDEXTYPE_BYTE, true, { 0, 1, -1 } }, 1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { gls::DrawTestSpec::STORAGE_BUFFER, gls::DrawTestSpec::INDEXTYPE_SHORT, true, { 0, 2, -1 } }, 1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { gls::DrawTestSpec::STORAGE_BUFFER, gls::DrawTestSpec::INDEXTYPE_SHORT, false, { 1, 3, -1 } }, 1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec spec; 1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* userPtrGroup = new tcu::TestCaseGroup(m_testCtx, "user_ptr", "user pointer"); 1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* unalignedUserPtrGroup = new tcu::TestCaseGroup(m_testCtx, "unaligned_user_ptr", "unaligned user pointer"); 1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* bufferGroup = new tcu::TestCaseGroup(m_testCtx, "buffer", "buffer"); 1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* unalignedBufferGroup = new tcu::TestCaseGroup(m_testCtx, "unaligned_buffer", "unaligned buffer"); 1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry genBasicSpec(spec, m_method); 1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry this->addChild(userPtrGroup); 1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry this->addChild(unalignedUserPtrGroup); 1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry this->addChild(bufferGroup); 1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry this->addChild(unalignedBufferGroup); 1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int testNdx = 0; testNdx < DE_LENGTH_OF_ARRAY(tests); ++testNdx) 1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const IndexTest& indexTest = tests[testNdx]; 1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* group = (indexTest.storage == gls::DrawTestSpec::STORAGE_USER) ? ((indexTest.aligned) ? (userPtrGroup) : (unalignedUserPtrGroup)) : ((indexTest.aligned) ? (bufferGroup) : (unalignedBufferGroup)); 1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const std::string name = std::string("index_") + gls::DrawTestSpec::indexTypeToString(indexTest.type); 1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const std::string desc = std::string("index ") + gls::DrawTestSpec::indexTypeToString(indexTest.type) + " in " + gls::DrawTestSpec::storageToString(indexTest.storage); 1493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry de::MovePtr<gls::DrawTest> test (new gls::DrawTest(m_testCtx, m_context.getRenderContext(), name.c_str(), desc.c_str())); 1503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.indexType = indexTest.type; 1523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.indexStorage = indexTest.storage; 1533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int iterationNdx = 0; iterationNdx < DE_LENGTH_OF_ARRAY(indexTest.offsets) && indexTest.offsets[iterationNdx] != -1; ++iterationNdx) 1553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const std::string iterationDesc = std::string("offset ") + de::toString(indexTest.offsets[iterationNdx]); 1573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.indexPointerOffset = indexTest.offsets[iterationNdx]; 1583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry test->addIteration(spec, iterationDesc.c_str()); 1593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (spec.isCompatibilityTest() == gls::DrawTestSpec::COMPATIBILITY_UNALIGNED_OFFSET || 1623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.isCompatibilityTest() == gls::DrawTestSpec::COMPATIBILITY_UNALIGNED_STRIDE) 1633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry group->addChild(test.release()); 1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1673c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass MethodGroup : public TestCaseGroup 1683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1693c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 1703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry MethodGroup (Context& context, const char* name, const char* descr, gls::DrawTestSpec::DrawMethod drawMethod); 1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~MethodGroup (void); 1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void init (void); 1743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 1763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::DrawMethod m_method; 1773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 1783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1793c827367444ee418f129b2c238299f49d3264554Jarkko PoyryMethodGroup::MethodGroup (Context& context, const char* name, const char* descr, gls::DrawTestSpec::DrawMethod drawMethod) 1803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : TestCaseGroup (context, name, descr) 1813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_method (drawMethod) 1823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1853c827367444ee418f129b2c238299f49d3264554Jarkko PoyryMethodGroup::~MethodGroup (void) 1863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1893c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid MethodGroup::init (void) 1903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const bool indexed = (m_method == gls::DrawTestSpec::DRAWMETHOD_DRAWELEMENTS) || (m_method == gls::DrawTestSpec::DRAWMETHOD_DRAWELEMENTS_INSTANCED) || (m_method == gls::DrawTestSpec::DRAWMETHOD_DRAWELEMENTS_RANGED); 1923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_ASSERT(indexed); 1943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_UNREF(indexed); 1953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry this->addChild(new IndexGroup(m_context, "indices", "Index tests", m_method)); 1973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1993c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass RandomGroup : public TestCaseGroup 2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2013c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry RandomGroup (Context& context, const char* name, const char* descr); 2033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ~RandomGroup (void); 2043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry void init (void); 2063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 2073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2083c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytemplate <int SIZE> 2093c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystruct UniformWeightArray 2103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry float weights[SIZE]; 2123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry UniformWeightArray (void) 2143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int i=0; i<SIZE; ++i) 2163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry weights[i] = 1.0f; 2173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 2193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2203c827367444ee418f129b2c238299f49d3264554Jarkko PoyryRandomGroup::RandomGroup (Context& context, const char* name, const char* descr) 2213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : TestCaseGroup (context, name, descr) 2223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2253c827367444ee418f129b2c238299f49d3264554Jarkko PoyryRandomGroup::~RandomGroup (void) 2263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2293c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid RandomGroup::init (void) 2303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const int numAttempts = 100; 2323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const int attribCounts[] = { 1, 2, 5 }; 2343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const float attribWeights[] = { 30, 10, 1 }; 2353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const int primitiveCounts[] = { 1, 5, 64 }; 2363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const float primitiveCountWeights[] = { 20, 10, 1 }; 2373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const int indexOffsets[] = { 0, 7, 13 }; 2383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const float indexOffsetWeights[] = { 20, 20, 1 }; 2393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const int firsts[] = { 0, 7, 13 }; 2403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const float firstWeights[] = { 20, 20, 1 }; 2413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const int offsets[] = { 0, 1, 5, 12 }; 2423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const float offsetWeights[] = { 50, 10, 10, 10 }; 2433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const int strides[] = { 0, 7, 16, 17 }; 2443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const float strideWeights[] = { 50, 10, 10, 10 }; 2453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::Primitive primitives[] = 2473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::PRIMITIVE_POINTS, 2493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::PRIMITIVE_TRIANGLES, 2503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::PRIMITIVE_TRIANGLE_FAN, 2513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::PRIMITIVE_TRIANGLE_STRIP, 2523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::PRIMITIVE_LINES, 2533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::PRIMITIVE_LINE_STRIP, 2543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::PRIMITIVE_LINE_LOOP 2553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 2563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const UniformWeightArray<DE_LENGTH_OF_ARRAY(primitives)> primitiveWeights; 2573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::DrawMethod drawMethods[] = 2593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::DRAWMETHOD_DRAWARRAYS, 2613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::DRAWMETHOD_DRAWELEMENTS, 2623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 2633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const UniformWeightArray<DE_LENGTH_OF_ARRAY(drawMethods)> drawMethodWeights; 2643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::IndexType indexTypes[] = 2663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::INDEXTYPE_BYTE, 2683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::INDEXTYPE_SHORT, 2693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 2703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const UniformWeightArray<DE_LENGTH_OF_ARRAY(indexTypes)> indexTypeWeights; 2713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::Storage storages[] = 2733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::STORAGE_USER, 2753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::STORAGE_BUFFER, 2763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 2773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const UniformWeightArray<DE_LENGTH_OF_ARRAY(storages)> storageWeights; 2783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::InputType inputTypes[] = 2803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::INPUTTYPE_FLOAT, 2823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::INPUTTYPE_FIXED, 2833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::INPUTTYPE_BYTE, 2843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::INPUTTYPE_SHORT, 2853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::INPUTTYPE_UNSIGNED_BYTE, 2863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::INPUTTYPE_UNSIGNED_SHORT 2873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 2883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const UniformWeightArray<DE_LENGTH_OF_ARRAY(inputTypes)> inputTypeWeights; 2893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::OutputType outputTypes[] = 2913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::OUTPUTTYPE_FLOAT, 2933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::OUTPUTTYPE_VEC2, 2943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::OUTPUTTYPE_VEC3, 2953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::OUTPUTTYPE_VEC4, 2963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 2973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const UniformWeightArray<DE_LENGTH_OF_ARRAY(outputTypes)> outputTypeWeights; 2983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::Usage usages[] = 3003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::USAGE_STATIC_DRAW, 3023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::USAGE_DYNAMIC_DRAW, 3033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::USAGE_STREAM_DRAW, 3043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 3053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const UniformWeightArray<DE_LENGTH_OF_ARRAY(usages)> usageWeights; 3063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const deUint32 blacklistedCases[]= 3083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3153, //!< extremely narrow triangle, results depend on sample positions 3103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 3113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::set<deUint32> insertedHashes; 3133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry size_t insertedCount = 0; 3143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int ndx = 0; ndx < numAttempts; ++ndx) 3163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry de::Random random(0xc551393 + ndx); // random does not depend on previous cases 3183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry int attributeCount = random.chooseWeighted<int, const int*, const float*>(DE_ARRAY_BEGIN(attribCounts), DE_ARRAY_END(attribCounts), attribWeights); 3203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec spec; 3213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.apiType = glu::ApiType::es(2,0); 3233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.primitive = random.chooseWeighted<gls::DrawTestSpec::Primitive> (DE_ARRAY_BEGIN(primitives), DE_ARRAY_END(primitives), primitiveWeights.weights); 3243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.primitiveCount = random.chooseWeighted<int, const int*, const float*> (DE_ARRAY_BEGIN(primitiveCounts), DE_ARRAY_END(primitiveCounts), primitiveCountWeights); 3253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.drawMethod = random.chooseWeighted<gls::DrawTestSpec::DrawMethod> (DE_ARRAY_BEGIN(drawMethods), DE_ARRAY_END(drawMethods), drawMethodWeights.weights); 3263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.indexType = random.chooseWeighted<gls::DrawTestSpec::IndexType> (DE_ARRAY_BEGIN(indexTypes), DE_ARRAY_END(indexTypes), indexTypeWeights.weights); 3273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.indexPointerOffset = random.chooseWeighted<int, const int*, const float*> (DE_ARRAY_BEGIN(indexOffsets), DE_ARRAY_END(indexOffsets), indexOffsetWeights); 3283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.indexStorage = random.chooseWeighted<gls::DrawTestSpec::Storage> (DE_ARRAY_BEGIN(storages), DE_ARRAY_END(storages), storageWeights.weights); 3293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.first = random.chooseWeighted<int, const int*, const float*> (DE_ARRAY_BEGIN(firsts), DE_ARRAY_END(firsts), firstWeights); 3303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.indexMin = 0; 3313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.indexMax = 0; 3323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.instanceCount = 0; 3333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // check spec is legal 3353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (!spec.valid()) 3363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry continue; 3373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int attrNdx = 0; attrNdx < attributeCount;) 3393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry bool valid; 3413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::AttributeSpec attribSpec; 3423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry attribSpec.inputType = random.chooseWeighted<gls::DrawTestSpec::InputType> (DE_ARRAY_BEGIN(inputTypes), DE_ARRAY_END(inputTypes), inputTypeWeights.weights); 3443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry attribSpec.outputType = random.chooseWeighted<gls::DrawTestSpec::OutputType> (DE_ARRAY_BEGIN(outputTypes), DE_ARRAY_END(outputTypes), outputTypeWeights.weights); 3453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry attribSpec.storage = random.chooseWeighted<gls::DrawTestSpec::Storage> (DE_ARRAY_BEGIN(storages), DE_ARRAY_END(storages), storageWeights.weights); 3463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry attribSpec.usage = random.chooseWeighted<gls::DrawTestSpec::Usage> (DE_ARRAY_BEGIN(usages), DE_ARRAY_END(usages), usageWeights.weights); 3473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry attribSpec.componentCount = random.getInt(1, 4); 3483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry attribSpec.offset = random.chooseWeighted<int, const int*, const float*>(DE_ARRAY_BEGIN(offsets), DE_ARRAY_END(offsets), offsetWeights); 3493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry attribSpec.stride = random.chooseWeighted<int, const int*, const float*>(DE_ARRAY_BEGIN(strides), DE_ARRAY_END(strides), strideWeights); 3503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry attribSpec.normalize = random.getBool(); 3513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry attribSpec.instanceDivisor = 0; 3523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry attribSpec.useDefaultAttribute = random.getBool(); 3533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // check spec is legal 3553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry valid = attribSpec.valid(spec.apiType); 3563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // we do not want interleaved elements. (Might result in some weird floating point values) 3583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (attribSpec.stride && attribSpec.componentCount * gls::DrawTestSpec::inputTypeSize(attribSpec.inputType) > attribSpec.stride) 3593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry valid = false; 3603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // try again if not valid 3623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (valid) 3633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.attribs.push_back(attribSpec); 3653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ++attrNdx; 3663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Do not collapse all vertex positions to a single positions 3703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (spec.primitive != gls::DrawTestSpec::PRIMITIVE_POINTS) 3713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.attribs[0].instanceDivisor = 0; 3723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Is render result meaningful? 3743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Only one vertex 3763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (spec.drawMethod == gls::DrawTestSpec::DRAWMETHOD_DRAWELEMENTS_RANGED && spec.indexMin == spec.indexMax && spec.primitive != gls::DrawTestSpec::PRIMITIVE_POINTS) 3773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry continue; 3783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (spec.attribs[0].useDefaultAttribute && spec.primitive != gls::DrawTestSpec::PRIMITIVE_POINTS) 3793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry continue; 3803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Triangle only on one axis 3823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (spec.primitive == gls::DrawTestSpec::PRIMITIVE_TRIANGLES || spec.primitive == gls::DrawTestSpec::PRIMITIVE_TRIANGLE_FAN || spec.primitive == gls::DrawTestSpec::PRIMITIVE_TRIANGLE_STRIP) 3833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (spec.attribs[0].componentCount == 1) 3853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry continue; 3863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (spec.attribs[0].outputType == gls::DrawTestSpec::OUTPUTTYPE_FLOAT || spec.attribs[0].outputType == gls::DrawTestSpec::OUTPUTTYPE_INT || spec.attribs[0].outputType == gls::DrawTestSpec::OUTPUTTYPE_UINT) 3873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry continue; 3883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (spec.drawMethod == gls::DrawTestSpec::DRAWMETHOD_DRAWELEMENTS_RANGED && (spec.indexMax - spec.indexMin) < 2) 3893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry continue; 3903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 3923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Add case 3943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 3953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deUint32 hash = spec.hash(); 3963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int attrNdx = 0; attrNdx < attributeCount; ++attrNdx) 3973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry hash = (hash << 2) ^ (deUint32)spec.attribs[attrNdx].hash(); 3983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (insertedHashes.find(hash) == insertedHashes.end() && 4003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::find(DE_ARRAY_BEGIN(blacklistedCases), DE_ARRAY_END(blacklistedCases), hash) == DE_ARRAY_END(blacklistedCases)) 4013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 4023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Only unaligned cases 4033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (spec.isCompatibilityTest() == gls::DrawTestSpec::COMPATIBILITY_UNALIGNED_OFFSET || 4043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry spec.isCompatibilityTest() == gls::DrawTestSpec::COMPATIBILITY_UNALIGNED_STRIDE) 4053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry this->addChild(new gls::DrawTest(m_testCtx, m_context.getRenderContext(), spec, de::toString(insertedCount).c_str(), spec.getDesc().c_str())); 4063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry insertedHashes.insert(hash); 4073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ++insertedCount; 4093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 4133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // anonymous 4153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4163c827367444ee418f129b2c238299f49d3264554Jarkko PoyryDrawTests::DrawTests (Context& context) 4173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : TestCaseGroup(context, "draw", "Drawing tests") 4183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 4193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 4203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4213c827367444ee418f129b2c238299f49d3264554Jarkko PoyryDrawTests::~DrawTests (void) 4223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 4233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 4243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4253c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid DrawTests::init (void) 4263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 4273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::TestCaseGroup* const unalignedGroup = new tcu::TestCaseGroup(m_testCtx, "unaligned_data", "Test with unaligned data"); 4283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry addChild(unalignedGroup); 4303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // .unaligned_data 4323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 4333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const gls::DrawTestSpec::DrawMethod basicMethods[] = 4343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 4353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // gls::DrawTestSpec::DRAWMETHOD_DRAWARRAYS, 4363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry gls::DrawTestSpec::DRAWMETHOD_DRAWELEMENTS, 4373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 4383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(basicMethods); ++ndx) 4403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 4413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::string name = gls::DrawTestSpec::drawMethodToString(basicMethods[ndx]); 4423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::string desc = gls::DrawTestSpec::drawMethodToString(basicMethods[ndx]); 4433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry unalignedGroup->addChild(new MethodGroup(m_context, name.c_str(), desc.c_str(), basicMethods[ndx])); 4453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Random 4483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry unalignedGroup->addChild(new RandomGroup(m_context, "random", "random draw commands.")); 4503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 4513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 4533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // Stress 4553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // gles2 4563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp 457