1 #ifndef _GLSSTATECHANGEPERFTESTCASES_HPP
2 #define _GLSSTATECHANGEPERFTESTCASES_HPP
3 /*-------------------------------------------------------------------------
4 * drawElements Quality Program OpenGL (ES) Module
5 * -----------------------------------------------
7 * Copyright 2014 The Android Open Source Project
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
23 * \brief State change performance tests.
24 *//*--------------------------------------------------------------------*/
26 #include "tcuDefs.hpp"
27 #include "tcuTestCase.hpp"
45 class StateChangePerformanceCase : public tcu::TestCase
50 DRAWTYPE_NOT_INDEXED = 0, //!< glDrawArrays()
51 DRAWTYPE_INDEXED_USER_PTR, //!< glDrawElements(), indices from user pointer.
52 DRAWTYPE_INDEXED_BUFFER, //!< glDrawElements(), indices in buffer.
55 StateChangePerformanceCase (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const char* name, const char* description, DrawType drawType, int drawCallCount, int triangleCount);
56 ~StateChangePerformanceCase (void);
61 IterateResult iterate (void);
64 void requireIndexBuffers (int count);
65 void requireCoordBuffers (int count);
66 void requirePrograms (int count);
67 void requireTextures (int count);
68 void requireFramebuffers (int count);
69 void requireRenderbuffers (int count);
70 void requireSamplers (int count);
71 void requireVertexArrays (int count);
73 virtual void setupInitialState (const glw::Functions& gl) = 0;
74 virtual void renderTest (const glw::Functions& gl) = 0;
75 virtual void renderReference (const glw::Functions& gl) = 0;
77 void callDraw (const glw::Functions& gl);
79 void logAndSetTestResult (void);
82 glu::RenderContext& m_renderCtx;
84 const DrawType m_drawType;
85 const int m_iterationCount;
86 const int m_callCount;
87 const int m_triangleCount;
89 std::vector<deUint32> m_indexBuffers;
90 std::vector<deUint32> m_coordBuffers;
91 std::vector<deUint32> m_textures;
92 std::vector<glu::ShaderProgram*> m_programs;
93 std::vector<deUint32> m_framebuffers;
94 std::vector<deUint32> m_renderbuffers;
95 std::vector<deUint32> m_samplers;
96 std::vector<deUint32> m_vertexArrays;
99 StateChangePerformanceCase (const StateChangePerformanceCase&);
100 StateChangePerformanceCase& operator= (const StateChangePerformanceCase&);
102 std::vector<deUint16> m_indices;
104 std::vector<deUint64> m_interleavedResults;
105 std::vector<deUint64> m_batchedResults;
108 class StateChangeCallPerformanceCase : public tcu::TestCase
112 StateChangeCallPerformanceCase (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const char* name, const char* description);
113 ~StateChangeCallPerformanceCase (void);
115 IterateResult iterate (void);
117 virtual void execCalls (const glw::Functions& gl, int iterNdx, int callCount) = 0;
120 void executeTest (void);
121 void logTestCase (void);
123 void logAndSetTestResult (void);
125 glu::RenderContext& m_renderCtx;
127 const int m_iterationCount;
128 const int m_callCount;
130 std::vector<deUint64> m_results;
136 #endif // _GLSSTATECHANGEPERFTESTCASES_HPP