1*35238bceSAndroid Build Coastguard Worker #ifndef _GLSLONGSTRESSCASE_HPP 2*35238bceSAndroid Build Coastguard Worker #define _GLSLONGSTRESSCASE_HPP 3*35238bceSAndroid Build Coastguard Worker /*------------------------------------------------------------------------- 4*35238bceSAndroid Build Coastguard Worker * drawElements Quality Program OpenGL (ES) Module 5*35238bceSAndroid Build Coastguard Worker * ----------------------------------------------- 6*35238bceSAndroid Build Coastguard Worker * 7*35238bceSAndroid Build Coastguard Worker * Copyright 2014 The Android Open Source Project 8*35238bceSAndroid Build Coastguard Worker * 9*35238bceSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License"); 10*35238bceSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License. 11*35238bceSAndroid Build Coastguard Worker * You may obtain a copy of the License at 12*35238bceSAndroid Build Coastguard Worker * 13*35238bceSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0 14*35238bceSAndroid Build Coastguard Worker * 15*35238bceSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software 16*35238bceSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS, 17*35238bceSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18*35238bceSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and 19*35238bceSAndroid Build Coastguard Worker * limitations under the License. 20*35238bceSAndroid Build Coastguard Worker * 21*35238bceSAndroid Build Coastguard Worker *//*! 22*35238bceSAndroid Build Coastguard Worker * \file 23*35238bceSAndroid Build Coastguard Worker * \brief Parametrized, long-running stress case. 24*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/ 25*35238bceSAndroid Build Coastguard Worker 26*35238bceSAndroid Build Coastguard Worker #include "tcuDefs.hpp" 27*35238bceSAndroid Build Coastguard Worker #include "tcuTestCase.hpp" 28*35238bceSAndroid Build Coastguard Worker #include "tcuTexture.hpp" 29*35238bceSAndroid Build Coastguard Worker #include "tcuMatrix.hpp" 30*35238bceSAndroid Build Coastguard Worker #include "gluRenderContext.hpp" 31*35238bceSAndroid Build Coastguard Worker #include "gluShaderUtil.hpp" 32*35238bceSAndroid Build Coastguard Worker #include "glsTextureTestUtil.hpp" 33*35238bceSAndroid Build Coastguard Worker #include "deRandom.hpp" 34*35238bceSAndroid Build Coastguard Worker #include "deSharedPtr.hpp" 35*35238bceSAndroid Build Coastguard Worker 36*35238bceSAndroid Build Coastguard Worker #include <string> 37*35238bceSAndroid Build Coastguard Worker #include <vector> 38*35238bceSAndroid Build Coastguard Worker #include <map> 39*35238bceSAndroid Build Coastguard Worker 40*35238bceSAndroid Build Coastguard Worker namespace deqp 41*35238bceSAndroid Build Coastguard Worker { 42*35238bceSAndroid Build Coastguard Worker namespace gls 43*35238bceSAndroid Build Coastguard Worker { 44*35238bceSAndroid Build Coastguard Worker 45*35238bceSAndroid Build Coastguard Worker namespace LongStressCaseInternal 46*35238bceSAndroid Build Coastguard Worker { 47*35238bceSAndroid Build Coastguard Worker 48*35238bceSAndroid Build Coastguard Worker template <typename T> 49*35238bceSAndroid Build Coastguard Worker class GLObjectManager; 50*35238bceSAndroid Build Coastguard Worker class Program; 51*35238bceSAndroid Build Coastguard Worker class Buffer; 52*35238bceSAndroid Build Coastguard Worker class Texture; 53*35238bceSAndroid Build Coastguard Worker class DebugInfoRenderer; 54*35238bceSAndroid Build Coastguard Worker 55*35238bceSAndroid Build Coastguard Worker } // namespace LongStressCaseInternal 56*35238bceSAndroid Build Coastguard Worker 57*35238bceSAndroid Build Coastguard Worker struct VarSpec 58*35238bceSAndroid Build Coastguard Worker { 59*35238bceSAndroid Build Coastguard Worker union Value 60*35238bceSAndroid Build Coastguard Worker { 61*35238bceSAndroid Build Coastguard Worker float f[4 * 4]; // \note Matrices are stored in column major order. 62*35238bceSAndroid Build Coastguard Worker int i[4]; 63*35238bceSAndroid Build Coastguard Worker }; 64*35238bceSAndroid Build Coastguard Worker 65*35238bceSAndroid Build Coastguard Worker std::string name; 66*35238bceSAndroid Build Coastguard Worker glu::DataType type; 67*35238bceSAndroid Build Coastguard Worker Value minValue; 68*35238bceSAndroid Build Coastguard Worker Value maxValue; 69*35238bceSAndroid Build Coastguard Worker 70*35238bceSAndroid Build Coastguard Worker template <typename T> VarSpecdeqp::gls::VarSpec71*35238bceSAndroid Build Coastguard Worker VarSpec(const std::string &name_, const T &minValue_, const T &maxValue_) : name(name_) 72*35238bceSAndroid Build Coastguard Worker { 73*35238bceSAndroid Build Coastguard Worker set(minValue_, maxValue_); 74*35238bceSAndroid Build Coastguard Worker } 75*35238bceSAndroid Build Coastguard Worker 76*35238bceSAndroid Build Coastguard Worker template <typename T> VarSpecdeqp::gls::VarSpec77*35238bceSAndroid Build Coastguard Worker VarSpec(const std::string &name_, const T &value) : name(name_) 78*35238bceSAndroid Build Coastguard Worker { 79*35238bceSAndroid Build Coastguard Worker set(value, value); 80*35238bceSAndroid Build Coastguard Worker } 81*35238bceSAndroid Build Coastguard Worker setdeqp::gls::VarSpec82*35238bceSAndroid Build Coastguard Worker void set(float minValue_, float maxValue_) 83*35238bceSAndroid Build Coastguard Worker { 84*35238bceSAndroid Build Coastguard Worker type = glu::TYPE_FLOAT; 85*35238bceSAndroid Build Coastguard Worker minValue.f[0] = minValue_; 86*35238bceSAndroid Build Coastguard Worker maxValue.f[0] = maxValue_; 87*35238bceSAndroid Build Coastguard Worker } 88*35238bceSAndroid Build Coastguard Worker 89*35238bceSAndroid Build Coastguard Worker template <int ValSize> setdeqp::gls::VarSpec90*35238bceSAndroid Build Coastguard Worker void set(const tcu::Vector<float, ValSize> &minValue_, const tcu::Vector<float, ValSize> &maxValue_) 91*35238bceSAndroid Build Coastguard Worker { 92*35238bceSAndroid Build Coastguard Worker type = glu::getDataTypeFloatVec(ValSize); 93*35238bceSAndroid Build Coastguard Worker vecToArr(minValue_, minValue.f); 94*35238bceSAndroid Build Coastguard Worker vecToArr(maxValue_, maxValue.f); 95*35238bceSAndroid Build Coastguard Worker } 96*35238bceSAndroid Build Coastguard Worker 97*35238bceSAndroid Build Coastguard Worker template <int ValRows, int ValCols> setdeqp::gls::VarSpec98*35238bceSAndroid Build Coastguard Worker void set(const tcu::Matrix<float, ValRows, ValCols> &minValue_, 99*35238bceSAndroid Build Coastguard Worker const tcu::Matrix<float, ValRows, ValCols> &maxValue_) 100*35238bceSAndroid Build Coastguard Worker { 101*35238bceSAndroid Build Coastguard Worker type = glu::getDataTypeMatrix(ValCols, ValRows); 102*35238bceSAndroid Build Coastguard Worker matToArr(minValue_, minValue.f); 103*35238bceSAndroid Build Coastguard Worker matToArr(maxValue_, maxValue.f); 104*35238bceSAndroid Build Coastguard Worker } 105*35238bceSAndroid Build Coastguard Worker setdeqp::gls::VarSpec106*35238bceSAndroid Build Coastguard Worker void set(int minValue_, int maxValue_) 107*35238bceSAndroid Build Coastguard Worker { 108*35238bceSAndroid Build Coastguard Worker type = glu::TYPE_INT; 109*35238bceSAndroid Build Coastguard Worker minValue.i[0] = minValue_; 110*35238bceSAndroid Build Coastguard Worker maxValue.i[0] = maxValue_; 111*35238bceSAndroid Build Coastguard Worker } 112*35238bceSAndroid Build Coastguard Worker 113*35238bceSAndroid Build Coastguard Worker template <int ValSize> setdeqp::gls::VarSpec114*35238bceSAndroid Build Coastguard Worker void set(const tcu::Vector<int, ValSize> &minValue_, const tcu::Vector<int, ValSize> &maxValue_) 115*35238bceSAndroid Build Coastguard Worker { 116*35238bceSAndroid Build Coastguard Worker type = glu::getDataTypeVector(glu::TYPE_INT, ValSize); 117*35238bceSAndroid Build Coastguard Worker vecToArr(minValue_, minValue.i); 118*35238bceSAndroid Build Coastguard Worker vecToArr(maxValue_, maxValue.i); 119*35238bceSAndroid Build Coastguard Worker } 120*35238bceSAndroid Build Coastguard Worker 121*35238bceSAndroid Build Coastguard Worker private: 122*35238bceSAndroid Build Coastguard Worker template <typename T, int SrcSize, int DstSize> vecToArrdeqp::gls::VarSpec123*35238bceSAndroid Build Coastguard Worker static inline void vecToArr(const tcu::Vector<T, SrcSize> &src, T (&dst)[DstSize]) 124*35238bceSAndroid Build Coastguard Worker { 125*35238bceSAndroid Build Coastguard Worker DE_STATIC_ASSERT(DstSize >= SrcSize); 126*35238bceSAndroid Build Coastguard Worker for (int i = 0; i < SrcSize; i++) 127*35238bceSAndroid Build Coastguard Worker dst[i] = src[i]; 128*35238bceSAndroid Build Coastguard Worker } 129*35238bceSAndroid Build Coastguard Worker 130*35238bceSAndroid Build Coastguard Worker template <int ValRows, int ValCols, int DstSize> matToArrdeqp::gls::VarSpec131*35238bceSAndroid Build Coastguard Worker static inline void matToArr(const tcu::Matrix<float, ValRows, ValCols> &src, float (&dst)[DstSize]) 132*35238bceSAndroid Build Coastguard Worker { 133*35238bceSAndroid Build Coastguard Worker DE_STATIC_ASSERT(DstSize >= ValRows * ValCols); 134*35238bceSAndroid Build Coastguard Worker tcu::Array<float, ValRows *ValCols> data = src.getColumnMajorData(); 135*35238bceSAndroid Build Coastguard Worker for (int i = 0; i < ValRows * ValCols; i++) 136*35238bceSAndroid Build Coastguard Worker dst[i] = data[i]; 137*35238bceSAndroid Build Coastguard Worker } 138*35238bceSAndroid Build Coastguard Worker }; 139*35238bceSAndroid Build Coastguard Worker 140*35238bceSAndroid Build Coastguard Worker struct TextureSpec 141*35238bceSAndroid Build Coastguard Worker { 142*35238bceSAndroid Build Coastguard Worker glu::TextureTestUtil::TextureType textureType; 143*35238bceSAndroid Build Coastguard Worker uint32_t textureUnit; 144*35238bceSAndroid Build Coastguard Worker int width; 145*35238bceSAndroid Build Coastguard Worker int height; 146*35238bceSAndroid Build Coastguard Worker uint32_t format; 147*35238bceSAndroid Build Coastguard Worker uint32_t dataType; 148*35238bceSAndroid Build Coastguard Worker uint32_t internalFormat; 149*35238bceSAndroid Build Coastguard Worker bool useMipmap; 150*35238bceSAndroid Build Coastguard Worker uint32_t minFilter; 151*35238bceSAndroid Build Coastguard Worker uint32_t magFilter; 152*35238bceSAndroid Build Coastguard Worker uint32_t sWrap; 153*35238bceSAndroid Build Coastguard Worker uint32_t tWrap; 154*35238bceSAndroid Build Coastguard Worker tcu::Vec4 minValue; 155*35238bceSAndroid Build Coastguard Worker tcu::Vec4 maxValue; 156*35238bceSAndroid Build Coastguard Worker TextureSpecdeqp::gls::TextureSpec157*35238bceSAndroid Build Coastguard Worker TextureSpec(const glu::TextureTestUtil::TextureType texType, const uint32_t unit, const int width_, 158*35238bceSAndroid Build Coastguard Worker const int height_, const uint32_t format_, const uint32_t dataType_, const uint32_t internalFormat_, 159*35238bceSAndroid Build Coastguard Worker const bool useMipmap_, const uint32_t minFilter_, const uint32_t magFilter_, const uint32_t sWrap_, 160*35238bceSAndroid Build Coastguard Worker const uint32_t tWrap_, const tcu::Vec4 &minValue_, const tcu::Vec4 &maxValue_) 161*35238bceSAndroid Build Coastguard Worker : textureType(texType) 162*35238bceSAndroid Build Coastguard Worker , textureUnit(unit) 163*35238bceSAndroid Build Coastguard Worker , width(width_) 164*35238bceSAndroid Build Coastguard Worker , height(height_) 165*35238bceSAndroid Build Coastguard Worker , format(format_) 166*35238bceSAndroid Build Coastguard Worker , dataType(dataType_) 167*35238bceSAndroid Build Coastguard Worker , internalFormat(internalFormat_) 168*35238bceSAndroid Build Coastguard Worker , useMipmap(useMipmap_) 169*35238bceSAndroid Build Coastguard Worker , minFilter(minFilter_) 170*35238bceSAndroid Build Coastguard Worker , magFilter(magFilter_) 171*35238bceSAndroid Build Coastguard Worker , sWrap(sWrap_) 172*35238bceSAndroid Build Coastguard Worker , tWrap(tWrap_) 173*35238bceSAndroid Build Coastguard Worker , minValue(minValue_) 174*35238bceSAndroid Build Coastguard Worker , maxValue(maxValue_) 175*35238bceSAndroid Build Coastguard Worker { 176*35238bceSAndroid Build Coastguard Worker } 177*35238bceSAndroid Build Coastguard Worker }; 178*35238bceSAndroid Build Coastguard Worker 179*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*! 180*35238bceSAndroid Build Coastguard Worker * \brief Struct for a shader program sources and related data 181*35238bceSAndroid Build Coastguard Worker * 182*35238bceSAndroid Build Coastguard Worker * A ProgramContext holds a program's vertex and fragment shader sources 183*35238bceSAndroid Build Coastguard Worker * as well as specifications of its attributes, uniforms, and textures. 184*35238bceSAndroid Build Coastguard Worker * When given to a StressCase, the string ${NS} is replaced by a magic 185*35238bceSAndroid Build Coastguard Worker * number that varies between different compilations of the same program; 186*35238bceSAndroid Build Coastguard Worker * the same replacement is done in attributes' and uniforms' names. This 187*35238bceSAndroid Build Coastguard Worker * can be used to avoid shader caching by the GL, by e.g. suffixing each 188*35238bceSAndroid Build Coastguard Worker * attribute, uniform and varying name with ${NS} in the shader source. 189*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/ 190*35238bceSAndroid Build Coastguard Worker struct ProgramContext 191*35238bceSAndroid Build Coastguard Worker { 192*35238bceSAndroid Build Coastguard Worker std::string vertexSource; 193*35238bceSAndroid Build Coastguard Worker std::string fragmentSource; 194*35238bceSAndroid Build Coastguard Worker std::vector<VarSpec> attributes; 195*35238bceSAndroid Build Coastguard Worker std::vector<VarSpec> uniforms; 196*35238bceSAndroid Build Coastguard Worker 197*35238bceSAndroid Build Coastguard Worker std::vector<TextureSpec> 198*35238bceSAndroid Build Coastguard Worker textureSpecs; //!< \note If multiple textures have same unit, one of them is picked randomly. 199*35238bceSAndroid Build Coastguard Worker 200*35238bceSAndroid Build Coastguard Worker std::string 201*35238bceSAndroid Build Coastguard Worker positionAttrName; //!< \note Position attribute may get a bit more careful handling than just complete random. 202*35238bceSAndroid Build Coastguard Worker ProgramContextdeqp::gls::ProgramContext203*35238bceSAndroid Build Coastguard Worker ProgramContext(const char *const vtxShaderSource_, const char *const fragShaderSource_, 204*35238bceSAndroid Build Coastguard Worker const char *const positionAttrName_) 205*35238bceSAndroid Build Coastguard Worker : vertexSource(vtxShaderSource_) 206*35238bceSAndroid Build Coastguard Worker , fragmentSource(fragShaderSource_) 207*35238bceSAndroid Build Coastguard Worker , positionAttrName(positionAttrName_) 208*35238bceSAndroid Build Coastguard Worker { 209*35238bceSAndroid Build Coastguard Worker } 210*35238bceSAndroid Build Coastguard Worker }; 211*35238bceSAndroid Build Coastguard Worker 212*35238bceSAndroid Build Coastguard Worker class LongStressCase : public tcu::TestCase 213*35238bceSAndroid Build Coastguard Worker { 214*35238bceSAndroid Build Coastguard Worker public: 215*35238bceSAndroid Build Coastguard Worker //! Probabilities for actions that may be taken on each iteration. \note The texture and buffer specific actions are randomized per texture or buffer. 216*35238bceSAndroid Build Coastguard Worker struct FeatureProbabilities 217*35238bceSAndroid Build Coastguard Worker { 218*35238bceSAndroid Build Coastguard Worker float rebuildProgram; //!< Rebuild program, with variable name-mangling. 219*35238bceSAndroid Build Coastguard Worker float reuploadTexture; //!< Reupload texture, even if it already exists and has been uploaded. 220*35238bceSAndroid Build Coastguard Worker float reuploadBuffer; //!< Reupload buffer, even if it already exists and has been uploaded. 221*35238bceSAndroid Build Coastguard Worker float reuploadWithTexImage; //!< Use glTexImage*() when re-uploading texture, not glTexSubImage*(). 222*35238bceSAndroid Build Coastguard Worker float reuploadWithBufferData; //!< Use glBufferData() when re-uploading buffer, not glBufferSubData(). 223*35238bceSAndroid Build Coastguard Worker float deleteTexture; //!< Delete texture at end of iteration, even if we could re-use it. 224*35238bceSAndroid Build Coastguard Worker float deleteBuffer; //!< Delete buffer at end of iteration, even if we could re-use it. 225*35238bceSAndroid Build Coastguard Worker float 226*35238bceSAndroid Build Coastguard Worker wastefulTextureMemoryUsage; //!< Don't re-use a texture, and don't delete it until given memory limit is hit. 227*35238bceSAndroid Build Coastguard Worker float 228*35238bceSAndroid Build Coastguard Worker wastefulBufferMemoryUsage; //!< Don't re-use a buffer, and don't delete it until given memory limit is hit. 229*35238bceSAndroid Build Coastguard Worker float 230*35238bceSAndroid Build Coastguard Worker clientMemoryAttributeData; //!< Use client memory for vertex attribute data when drawing (instead of GL buffers). 231*35238bceSAndroid Build Coastguard Worker float clientMemoryIndexData; //!< Use client memory for vertex indices when drawing (instead of GL buffers). 232*35238bceSAndroid Build Coastguard Worker float 233*35238bceSAndroid Build Coastguard Worker randomBufferUploadTarget; //!< Use a random target when setting buffer data (i.e. not necessarily the one it'll be ultimately bound to). 234*35238bceSAndroid Build Coastguard Worker float 235*35238bceSAndroid Build Coastguard Worker randomBufferUsage; //!< Use a random buffer usage parameter with glBufferData(), instead of the ones specified as params for the case. 236*35238bceSAndroid Build Coastguard Worker float useDrawArrays; //!< Use glDrawArrays() instead of glDrawElements(). 237*35238bceSAndroid Build Coastguard Worker float separateAttributeBuffers; //!< Give each vertex attribute its own buffer. 238*35238bceSAndroid Build Coastguard Worker 239*35238bceSAndroid Build Coastguard Worker // Named parameter idiom: helpers that can be used when making temporaries, e.g. FeatureProbabilities().pReuploadTexture(1.0f).pReuploadWithTexImage(1.0f) pRebuildProgramdeqp::gls::LongStressCase::FeatureProbabilities240*35238bceSAndroid Build Coastguard Worker FeatureProbabilities &pRebuildProgram(const float prob) 241*35238bceSAndroid Build Coastguard Worker { 242*35238bceSAndroid Build Coastguard Worker rebuildProgram = prob; 243*35238bceSAndroid Build Coastguard Worker return *this; 244*35238bceSAndroid Build Coastguard Worker } pReuploadTexturedeqp::gls::LongStressCase::FeatureProbabilities245*35238bceSAndroid Build Coastguard Worker FeatureProbabilities &pReuploadTexture(const float prob) 246*35238bceSAndroid Build Coastguard Worker { 247*35238bceSAndroid Build Coastguard Worker reuploadTexture = prob; 248*35238bceSAndroid Build Coastguard Worker return *this; 249*35238bceSAndroid Build Coastguard Worker } pReuploadBufferdeqp::gls::LongStressCase::FeatureProbabilities250*35238bceSAndroid Build Coastguard Worker FeatureProbabilities &pReuploadBuffer(const float prob) 251*35238bceSAndroid Build Coastguard Worker { 252*35238bceSAndroid Build Coastguard Worker reuploadBuffer = prob; 253*35238bceSAndroid Build Coastguard Worker return *this; 254*35238bceSAndroid Build Coastguard Worker } pReuploadWithTexImagedeqp::gls::LongStressCase::FeatureProbabilities255*35238bceSAndroid Build Coastguard Worker FeatureProbabilities &pReuploadWithTexImage(const float prob) 256*35238bceSAndroid Build Coastguard Worker { 257*35238bceSAndroid Build Coastguard Worker reuploadWithTexImage = prob; 258*35238bceSAndroid Build Coastguard Worker return *this; 259*35238bceSAndroid Build Coastguard Worker } pReuploadWithBufferDatadeqp::gls::LongStressCase::FeatureProbabilities260*35238bceSAndroid Build Coastguard Worker FeatureProbabilities &pReuploadWithBufferData(const float prob) 261*35238bceSAndroid Build Coastguard Worker { 262*35238bceSAndroid Build Coastguard Worker reuploadWithBufferData = prob; 263*35238bceSAndroid Build Coastguard Worker return *this; 264*35238bceSAndroid Build Coastguard Worker } pDeleteTexturedeqp::gls::LongStressCase::FeatureProbabilities265*35238bceSAndroid Build Coastguard Worker FeatureProbabilities &pDeleteTexture(const float prob) 266*35238bceSAndroid Build Coastguard Worker { 267*35238bceSAndroid Build Coastguard Worker deleteTexture = prob; 268*35238bceSAndroid Build Coastguard Worker return *this; 269*35238bceSAndroid Build Coastguard Worker } pDeleteBufferdeqp::gls::LongStressCase::FeatureProbabilities270*35238bceSAndroid Build Coastguard Worker FeatureProbabilities &pDeleteBuffer(const float prob) 271*35238bceSAndroid Build Coastguard Worker { 272*35238bceSAndroid Build Coastguard Worker deleteBuffer = prob; 273*35238bceSAndroid Build Coastguard Worker return *this; 274*35238bceSAndroid Build Coastguard Worker } pWastefulTextureMemoryUsagedeqp::gls::LongStressCase::FeatureProbabilities275*35238bceSAndroid Build Coastguard Worker FeatureProbabilities &pWastefulTextureMemoryUsage(const float prob) 276*35238bceSAndroid Build Coastguard Worker { 277*35238bceSAndroid Build Coastguard Worker wastefulTextureMemoryUsage = prob; 278*35238bceSAndroid Build Coastguard Worker return *this; 279*35238bceSAndroid Build Coastguard Worker } pWastefulBufferMemoryUsagedeqp::gls::LongStressCase::FeatureProbabilities280*35238bceSAndroid Build Coastguard Worker FeatureProbabilities &pWastefulBufferMemoryUsage(const float prob) 281*35238bceSAndroid Build Coastguard Worker { 282*35238bceSAndroid Build Coastguard Worker wastefulBufferMemoryUsage = prob; 283*35238bceSAndroid Build Coastguard Worker return *this; 284*35238bceSAndroid Build Coastguard Worker } pClientMemoryAttributeDatadeqp::gls::LongStressCase::FeatureProbabilities285*35238bceSAndroid Build Coastguard Worker FeatureProbabilities &pClientMemoryAttributeData(const float prob) 286*35238bceSAndroid Build Coastguard Worker { 287*35238bceSAndroid Build Coastguard Worker clientMemoryAttributeData = prob; 288*35238bceSAndroid Build Coastguard Worker return *this; 289*35238bceSAndroid Build Coastguard Worker } pClientMemoryIndexDatadeqp::gls::LongStressCase::FeatureProbabilities290*35238bceSAndroid Build Coastguard Worker FeatureProbabilities &pClientMemoryIndexData(const float prob) 291*35238bceSAndroid Build Coastguard Worker { 292*35238bceSAndroid Build Coastguard Worker clientMemoryIndexData = prob; 293*35238bceSAndroid Build Coastguard Worker return *this; 294*35238bceSAndroid Build Coastguard Worker } pRandomBufferUploadTargetdeqp::gls::LongStressCase::FeatureProbabilities295*35238bceSAndroid Build Coastguard Worker FeatureProbabilities &pRandomBufferUploadTarget(const float prob) 296*35238bceSAndroid Build Coastguard Worker { 297*35238bceSAndroid Build Coastguard Worker randomBufferUploadTarget = prob; 298*35238bceSAndroid Build Coastguard Worker return *this; 299*35238bceSAndroid Build Coastguard Worker } pRandomBufferUsagedeqp::gls::LongStressCase::FeatureProbabilities300*35238bceSAndroid Build Coastguard Worker FeatureProbabilities &pRandomBufferUsage(const float prob) 301*35238bceSAndroid Build Coastguard Worker { 302*35238bceSAndroid Build Coastguard Worker randomBufferUsage = prob; 303*35238bceSAndroid Build Coastguard Worker return *this; 304*35238bceSAndroid Build Coastguard Worker } pUseDrawArraysdeqp::gls::LongStressCase::FeatureProbabilities305*35238bceSAndroid Build Coastguard Worker FeatureProbabilities &pUseDrawArrays(const float prob) 306*35238bceSAndroid Build Coastguard Worker { 307*35238bceSAndroid Build Coastguard Worker useDrawArrays = prob; 308*35238bceSAndroid Build Coastguard Worker return *this; 309*35238bceSAndroid Build Coastguard Worker } pSeparateAttribBuffersdeqp::gls::LongStressCase::FeatureProbabilities310*35238bceSAndroid Build Coastguard Worker FeatureProbabilities &pSeparateAttribBuffers(const float prob) 311*35238bceSAndroid Build Coastguard Worker { 312*35238bceSAndroid Build Coastguard Worker separateAttributeBuffers = prob; 313*35238bceSAndroid Build Coastguard Worker return *this; 314*35238bceSAndroid Build Coastguard Worker } 315*35238bceSAndroid Build Coastguard Worker FeatureProbabilitiesdeqp::gls::LongStressCase::FeatureProbabilities316*35238bceSAndroid Build Coastguard Worker FeatureProbabilities(void) 317*35238bceSAndroid Build Coastguard Worker : rebuildProgram(0.0f) 318*35238bceSAndroid Build Coastguard Worker , reuploadTexture(0.0f) 319*35238bceSAndroid Build Coastguard Worker , reuploadBuffer(0.0f) 320*35238bceSAndroid Build Coastguard Worker , reuploadWithTexImage(0.0f) 321*35238bceSAndroid Build Coastguard Worker , reuploadWithBufferData(0.0f) 322*35238bceSAndroid Build Coastguard Worker , deleteTexture(0.0f) 323*35238bceSAndroid Build Coastguard Worker , deleteBuffer(0.0f) 324*35238bceSAndroid Build Coastguard Worker , wastefulTextureMemoryUsage(0.0f) 325*35238bceSAndroid Build Coastguard Worker , wastefulBufferMemoryUsage(0.0f) 326*35238bceSAndroid Build Coastguard Worker , clientMemoryAttributeData(0.0f) 327*35238bceSAndroid Build Coastguard Worker , clientMemoryIndexData(0.0f) 328*35238bceSAndroid Build Coastguard Worker , randomBufferUploadTarget(0.0f) 329*35238bceSAndroid Build Coastguard Worker , randomBufferUsage(0.0f) 330*35238bceSAndroid Build Coastguard Worker , useDrawArrays(0.0f) 331*35238bceSAndroid Build Coastguard Worker , separateAttributeBuffers(0.0f) 332*35238bceSAndroid Build Coastguard Worker { 333*35238bceSAndroid Build Coastguard Worker } 334*35238bceSAndroid Build Coastguard Worker }; 335*35238bceSAndroid Build Coastguard Worker 336*35238bceSAndroid Build Coastguard Worker LongStressCase(tcu::TestContext &testCtx, const glu::RenderContext &renderCtx, const char *name, const char *desc, 337*35238bceSAndroid Build Coastguard Worker int maxTexMemoryUsageBytes, //!< Approximate upper bound on GL texture memory usage. 338*35238bceSAndroid Build Coastguard Worker int maxBufMemoryUsageBytes, //!< Approximate upper bound on GL buffer memory usage. 339*35238bceSAndroid Build Coastguard Worker int numDrawCallsPerIteration, int numTrianglesPerDrawCall, 340*35238bceSAndroid Build Coastguard Worker const std::vector<ProgramContext> &programContexts, const FeatureProbabilities &probabilities, 341*35238bceSAndroid Build Coastguard Worker uint32_t indexBufferUsage, uint32_t attrBufferUsage, int redundantBufferFactor = 1, 342*35238bceSAndroid Build Coastguard Worker bool showDebugInfo = false); 343*35238bceSAndroid Build Coastguard Worker 344*35238bceSAndroid Build Coastguard Worker ~LongStressCase(void); 345*35238bceSAndroid Build Coastguard Worker 346*35238bceSAndroid Build Coastguard Worker void init(void); 347*35238bceSAndroid Build Coastguard Worker void deinit(void); 348*35238bceSAndroid Build Coastguard Worker 349*35238bceSAndroid Build Coastguard Worker IterateResult iterate(void); 350*35238bceSAndroid Build Coastguard Worker 351*35238bceSAndroid Build Coastguard Worker private: 352*35238bceSAndroid Build Coastguard Worker LongStressCase(const LongStressCase &); 353*35238bceSAndroid Build Coastguard Worker LongStressCase &operator=(const LongStressCase &); 354*35238bceSAndroid Build Coastguard Worker 355*35238bceSAndroid Build Coastguard Worker const glu::RenderContext &m_renderCtx; 356*35238bceSAndroid Build Coastguard Worker const int m_maxTexMemoryUsageBytes; 357*35238bceSAndroid Build Coastguard Worker const int m_maxBufMemoryUsageBytes; 358*35238bceSAndroid Build Coastguard Worker const int m_numDrawCallsPerIteration; 359*35238bceSAndroid Build Coastguard Worker const int m_numTrianglesPerDrawCall; 360*35238bceSAndroid Build Coastguard Worker const int m_numVerticesPerDrawCall; 361*35238bceSAndroid Build Coastguard Worker const std::vector<ProgramContext> m_programContexts; 362*35238bceSAndroid Build Coastguard Worker const FeatureProbabilities m_probabilities; 363*35238bceSAndroid Build Coastguard Worker const uint32_t m_indexBufferUsage; 364*35238bceSAndroid Build Coastguard Worker const uint32_t m_attrBufferUsage; 365*35238bceSAndroid Build Coastguard Worker const int 366*35238bceSAndroid Build Coastguard Worker m_redundantBufferFactor; //!< By what factor we allocate redundant buffers. Default is 1, i.e. no redundancy. 367*35238bceSAndroid Build Coastguard Worker const bool m_showDebugInfo; 368*35238bceSAndroid Build Coastguard Worker 369*35238bceSAndroid Build Coastguard Worker const int m_numIterations; 370*35238bceSAndroid Build Coastguard Worker const bool m_isGLES3; 371*35238bceSAndroid Build Coastguard Worker 372*35238bceSAndroid Build Coastguard Worker int m_currentIteration; 373*35238bceSAndroid Build Coastguard Worker uint64_t m_startTimeSeconds; //!< Set at beginning of first iteration. 374*35238bceSAndroid Build Coastguard Worker uint64_t m_lastLogTime; 375*35238bceSAndroid Build Coastguard Worker int m_lastLogIteration; 376*35238bceSAndroid Build Coastguard Worker int m_currentLogEntryNdx; 377*35238bceSAndroid Build Coastguard Worker 378*35238bceSAndroid Build Coastguard Worker de::Random m_rnd; 379*35238bceSAndroid Build Coastguard Worker LongStressCaseInternal::GLObjectManager<LongStressCaseInternal::Program> *m_programs; 380*35238bceSAndroid Build Coastguard Worker LongStressCaseInternal::GLObjectManager<LongStressCaseInternal::Buffer> *m_buffers; 381*35238bceSAndroid Build Coastguard Worker LongStressCaseInternal::GLObjectManager<LongStressCaseInternal::Texture> *m_textures; 382*35238bceSAndroid Build Coastguard Worker std::vector<uint16_t> m_vertexIndices; 383*35238bceSAndroid Build Coastguard Worker 384*35238bceSAndroid Build Coastguard Worker struct ProgramResources 385*35238bceSAndroid Build Coastguard Worker { 386*35238bceSAndroid Build Coastguard Worker std::vector<uint8_t> attrDataBuf; 387*35238bceSAndroid Build Coastguard Worker std::vector<int> attrDataOffsets; 388*35238bceSAndroid Build Coastguard Worker std::vector<int> attrDataSizes; 389*35238bceSAndroid Build Coastguard Worker std::vector<de::SharedPtr<tcu::TextureLevel>> unusedTextures; 390*35238bceSAndroid Build Coastguard Worker std::string shaderNameManglingSuffix; 391*35238bceSAndroid Build Coastguard Worker }; 392*35238bceSAndroid Build Coastguard Worker 393*35238bceSAndroid Build Coastguard Worker std::vector<ProgramResources> m_programResources; 394*35238bceSAndroid Build Coastguard Worker 395*35238bceSAndroid Build Coastguard Worker LongStressCaseInternal::DebugInfoRenderer *m_debugInfoRenderer; 396*35238bceSAndroid Build Coastguard Worker }; 397*35238bceSAndroid Build Coastguard Worker 398*35238bceSAndroid Build Coastguard Worker } // namespace gls 399*35238bceSAndroid Build Coastguard Worker } // namespace deqp 400*35238bceSAndroid Build Coastguard Worker 401*35238bceSAndroid Build Coastguard Worker #endif // _GLSLONGSTRESSCASE_HPP 402