1 #ifndef _GLSSHADERPERFORMANCECASE_HPP
2 #define _GLSSHADERPERFORMANCECASE_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 Single-program test case wrapper for ShaderPerformanceMeasurer.
24 *//*--------------------------------------------------------------------*/
26 #include "tcuDefs.hpp"
27 #include "tcuTestCase.hpp"
28 #include "gluRenderContext.hpp"
29 #include "gluShaderProgram.hpp"
30 #include "glsShaderPerformanceMeasurer.hpp"
31 #include "deSharedPtr.hpp"
38 class ShaderPerformanceCase : public tcu::TestCase
41 struct InitialCalibration
44 InitialCalibration (void) : initialNumCalls(1) {}
47 ShaderPerformanceCase (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const char* name, const char* description, PerfCaseType caseType);
48 ~ShaderPerformanceCase (void);
50 void setCalibrationInitialParamStorage (const de::SharedPtr<InitialCalibration>& storage) { m_initialCalibration = storage; }
55 IterateResult iterate (void);
58 virtual void setupProgram (deUint32 program);
59 virtual void setupRenderState (void);
61 void setGridSize (int gridW, int gridH);
62 void setViewportSize (int width, int height);
63 void setVertexFragmentRatio (float fragmentsPerVertices);
65 int getGridWidth (void) const { return m_measurer.getGridWidth(); }
66 int getGridHeight (void) const { return m_measurer.getGridHeight(); }
67 int getViewportWidth (void) const { return m_measurer.getViewportWidth(); }
68 int getViewportHeight (void) const { return m_measurer.getViewportHeight(); }
70 virtual void reportResult (float mvertPerSecond, float mfragPerSecond);
72 glu::RenderContext& m_renderCtx;
74 PerfCaseType m_caseType;
76 std::string m_vertShaderSource;
77 std::string m_fragShaderSource;
78 std::vector<AttribSpec> m_attributes;
81 glu::ShaderProgram* m_program;
82 ShaderPerformanceMeasurer m_measurer;
84 de::SharedPtr<InitialCalibration> m_initialCalibration;
87 class ShaderPerformanceCaseGroup : public tcu::TestCaseGroup
90 ShaderPerformanceCaseGroup (tcu::TestContext& testCtx, const char* name, const char* description);
91 void addChild (ShaderPerformanceCase*);
94 de::SharedPtr<ShaderPerformanceCase::InitialCalibration> m_initialCalibrationStorage;
100 #endif // _GLSSHADERPERFORMANCECASE_HPP