1 #ifndef _GLSRANDOMSHADERCASE_HPP
2 #define _GLSRANDOMSHADERCASE_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 Random shader test case.
24 *//*--------------------------------------------------------------------*/
26 #include "tcuDefs.hpp"
27 #include "tcuTestCase.hpp"
28 #include "gluRenderContext.hpp"
29 #include "rsgParameters.hpp"
30 #include "tcuSurface.hpp"
31 #include "rsgShader.hpp"
32 #include "rsgVariableValue.hpp"
33 #include "gluTexture.hpp"
47 VertexArray (const rsg::ShaderInput* input, int numVertices);
48 ~VertexArray (void) {}
50 const std::vector<float>& getVertices (void) const { return m_vertices; }
51 std::vector<float>& getVertices (void) { return m_vertices; }
52 const char* getName (void) const { return m_input->getVariable()->getName(); }
53 int getNumComponents (void) const { return m_input->getVariable()->getType().getNumElements(); }
54 rsg::ConstValueRangeAccess getValueRange (void) const { return m_input->getValueRange(); }
57 const rsg::ShaderInput* m_input;
58 std::vector<float> m_vertices;
64 TextureManager (void);
65 ~TextureManager (void);
67 void bindTexture (int unit, const glu::Texture2D* tex2D);
68 void bindTexture (int unit, const glu::TextureCube* texCube);
70 std::vector<std::pair<int, const glu::Texture2D*> > getBindings2D (void) const;
71 std::vector<std::pair<int, const glu::TextureCube*> > getBindingsCube (void) const;
74 std::map<int, const glu::Texture2D*> m_tex2D;
75 std::map<int, const glu::TextureCube*> m_texCube;
78 class RandomShaderCase : public tcu::TestCase
81 RandomShaderCase (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const char* name, const char* description, const rsg::ProgramParameters& params);
82 virtual ~RandomShaderCase (void);
84 virtual void init (void);
85 virtual void deinit (void);
86 virtual IterateResult iterate (void);
89 void checkShaderLimits (const rsg::Shader& shader) const;
90 void checkProgramLimits (const rsg::Shader& vtxShader, const rsg::Shader& frgShader) const;
93 glu::RenderContext& m_renderCtx;
95 // \todo [2011-12-21 pyry] Multiple textures!
96 const glu::Texture2D* getTex2D (void);
97 const glu::TextureCube* getTexCube (void);
99 rsg::ProgramParameters m_parameters;
103 rsg::Shader m_vertexShader;
104 rsg::Shader m_fragmentShader;
105 std::vector<rsg::VariableValue> m_uniforms;
107 std::vector<VertexArray> m_vertexArrays;
108 std::vector<deUint16> m_indices;
110 TextureManager m_texManager;
111 glu::Texture2D* m_tex2D;
112 glu::TextureCube* m_texCube;
118 #endif // _GLSRANDOMSHADERCASE_HPP