1e5c31af7Sopenharmony_ci#ifndef _GLSRANDOMSHADERCASE_HPP
2e5c31af7Sopenharmony_ci#define _GLSRANDOMSHADERCASE_HPP
3e5c31af7Sopenharmony_ci/*-------------------------------------------------------------------------
4e5c31af7Sopenharmony_ci * drawElements Quality Program OpenGL (ES) Module
5e5c31af7Sopenharmony_ci * -----------------------------------------------
6e5c31af7Sopenharmony_ci *
7e5c31af7Sopenharmony_ci * Copyright 2014 The Android Open Source Project
8e5c31af7Sopenharmony_ci *
9e5c31af7Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
10e5c31af7Sopenharmony_ci * you may not use this file except in compliance with the License.
11e5c31af7Sopenharmony_ci * You may obtain a copy of the License at
12e5c31af7Sopenharmony_ci *
13e5c31af7Sopenharmony_ci *      http://www.apache.org/licenses/LICENSE-2.0
14e5c31af7Sopenharmony_ci *
15e5c31af7Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
16e5c31af7Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
17e5c31af7Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18e5c31af7Sopenharmony_ci * See the License for the specific language governing permissions and
19e5c31af7Sopenharmony_ci * limitations under the License.
20e5c31af7Sopenharmony_ci *
21e5c31af7Sopenharmony_ci *//*!
22e5c31af7Sopenharmony_ci * \file
23e5c31af7Sopenharmony_ci * \brief Random shader test case.
24e5c31af7Sopenharmony_ci *//*--------------------------------------------------------------------*/
25e5c31af7Sopenharmony_ci
26e5c31af7Sopenharmony_ci#include "tcuDefs.hpp"
27e5c31af7Sopenharmony_ci#include "tcuTestCase.hpp"
28e5c31af7Sopenharmony_ci#include "gluRenderContext.hpp"
29e5c31af7Sopenharmony_ci#include "rsgParameters.hpp"
30e5c31af7Sopenharmony_ci#include "tcuSurface.hpp"
31e5c31af7Sopenharmony_ci#include "rsgShader.hpp"
32e5c31af7Sopenharmony_ci#include "rsgVariableValue.hpp"
33e5c31af7Sopenharmony_ci#include "gluTexture.hpp"
34e5c31af7Sopenharmony_ci
35e5c31af7Sopenharmony_ci#include <string>
36e5c31af7Sopenharmony_ci#include <vector>
37e5c31af7Sopenharmony_ci#include <map>
38e5c31af7Sopenharmony_ci
39e5c31af7Sopenharmony_cinamespace deqp
40e5c31af7Sopenharmony_ci{
41e5c31af7Sopenharmony_cinamespace gls
42e5c31af7Sopenharmony_ci{
43e5c31af7Sopenharmony_ci
44e5c31af7Sopenharmony_ciclass VertexArray
45e5c31af7Sopenharmony_ci{
46e5c31af7Sopenharmony_cipublic:
47e5c31af7Sopenharmony_ci								VertexArray			(const rsg::ShaderInput* input, int numVertices);
48e5c31af7Sopenharmony_ci								~VertexArray		(void) {}
49e5c31af7Sopenharmony_ci
50e5c31af7Sopenharmony_ci	const std::vector<float>&	getVertices			(void) const	{ return m_vertices;		}
51e5c31af7Sopenharmony_ci	std::vector<float>&			getVertices			(void)			{ return m_vertices;		}
52e5c31af7Sopenharmony_ci	const char*					getName				(void) const	{ return m_input->getVariable()->getName();						}
53e5c31af7Sopenharmony_ci	int							getNumComponents	(void) const	{ return m_input->getVariable()->getType().getNumElements();	}
54e5c31af7Sopenharmony_ci	rsg::ConstValueRangeAccess	getValueRange		(void) const	{ return m_input->getValueRange();								}
55e5c31af7Sopenharmony_ci
56e5c31af7Sopenharmony_ciprivate:
57e5c31af7Sopenharmony_ci	const rsg::ShaderInput*		m_input;
58e5c31af7Sopenharmony_ci	std::vector<float>			m_vertices;
59e5c31af7Sopenharmony_ci};
60e5c31af7Sopenharmony_ci
61e5c31af7Sopenharmony_ciclass TextureManager
62e5c31af7Sopenharmony_ci{
63e5c31af7Sopenharmony_cipublic:
64e5c31af7Sopenharmony_ci															TextureManager		(void);
65e5c31af7Sopenharmony_ci															~TextureManager		(void);
66e5c31af7Sopenharmony_ci
67e5c31af7Sopenharmony_ci	void													bindTexture			(int unit, const glu::Texture2D* tex2D);
68e5c31af7Sopenharmony_ci	void													bindTexture			(int unit, const glu::TextureCube* texCube);
69e5c31af7Sopenharmony_ci
70e5c31af7Sopenharmony_ci	std::vector<std::pair<int, const glu::Texture2D*> >		getBindings2D		(void) const;
71e5c31af7Sopenharmony_ci	std::vector<std::pair<int, const glu::TextureCube*> >	getBindingsCube		(void) const;
72e5c31af7Sopenharmony_ci
73e5c31af7Sopenharmony_ciprivate:
74e5c31af7Sopenharmony_ci	std::map<int, const glu::Texture2D*>					m_tex2D;
75e5c31af7Sopenharmony_ci	std::map<int, const glu::TextureCube*>					m_texCube;
76e5c31af7Sopenharmony_ci};
77e5c31af7Sopenharmony_ci
78e5c31af7Sopenharmony_ciclass RandomShaderCase : public tcu::TestCase
79e5c31af7Sopenharmony_ci{
80e5c31af7Sopenharmony_cipublic:
81e5c31af7Sopenharmony_ci									RandomShaderCase		(tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const char* name, const char* description, const rsg::ProgramParameters& params);
82e5c31af7Sopenharmony_ci	virtual							~RandomShaderCase		(void);
83e5c31af7Sopenharmony_ci
84e5c31af7Sopenharmony_ci	virtual void					init					(void);
85e5c31af7Sopenharmony_ci	virtual void					deinit					(void);
86e5c31af7Sopenharmony_ci	virtual IterateResult			iterate					(void);
87e5c31af7Sopenharmony_ci
88e5c31af7Sopenharmony_ciprivate:
89e5c31af7Sopenharmony_ci	void							checkShaderLimits		(const rsg::Shader& shader) const;
90e5c31af7Sopenharmony_ci	void							checkProgramLimits		(const rsg::Shader& vtxShader, const rsg::Shader& frgShader) const;
91e5c31af7Sopenharmony_ci
92e5c31af7Sopenharmony_ciprotected:
93e5c31af7Sopenharmony_ci	glu::RenderContext&				m_renderCtx;
94e5c31af7Sopenharmony_ci
95e5c31af7Sopenharmony_ci	// \todo [2011-12-21 pyry] Multiple textures!
96e5c31af7Sopenharmony_ci	const glu::Texture2D*			getTex2D				(void);
97e5c31af7Sopenharmony_ci	const glu::TextureCube*			getTexCube				(void);
98e5c31af7Sopenharmony_ci
99e5c31af7Sopenharmony_ci	rsg::ProgramParameters			m_parameters;
100e5c31af7Sopenharmony_ci	int								m_gridWidth;
101e5c31af7Sopenharmony_ci	int								m_gridHeight;
102e5c31af7Sopenharmony_ci
103e5c31af7Sopenharmony_ci	rsg::Shader						m_vertexShader;
104e5c31af7Sopenharmony_ci	rsg::Shader						m_fragmentShader;
105e5c31af7Sopenharmony_ci	std::vector<rsg::VariableValue>	m_uniforms;
106e5c31af7Sopenharmony_ci
107e5c31af7Sopenharmony_ci	std::vector<VertexArray>		m_vertexArrays;
108e5c31af7Sopenharmony_ci	std::vector<deUint16>			m_indices;
109e5c31af7Sopenharmony_ci
110e5c31af7Sopenharmony_ci	TextureManager					m_texManager;
111e5c31af7Sopenharmony_ci	glu::Texture2D*					m_tex2D;
112e5c31af7Sopenharmony_ci	glu::TextureCube*				m_texCube;
113e5c31af7Sopenharmony_ci};
114e5c31af7Sopenharmony_ci
115e5c31af7Sopenharmony_ci} // gls
116e5c31af7Sopenharmony_ci} // deqp
117e5c31af7Sopenharmony_ci
118e5c31af7Sopenharmony_ci#endif // _GLSRANDOMSHADERCASE_HPP
119