• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _ES31CLAYOUTBINDINGTESTS_HPP
2 #define _ES31CLAYOUTBINDINGTESTS_HPP
3 /*-------------------------------------------------------------------------
4  * OpenGL Conformance Test Suite
5  * -----------------------------
6  *
7  * Copyright (c) 2014-2016 The Khronos Group Inc.
8  *
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
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
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.
20  *
21  */ /*!
22  * \file
23  * \brief
24  */ /*-------------------------------------------------------------------*/
25 
26 #include "glcTestCase.hpp"
27 #include "gluShaderUtil.hpp"
28 #include "tcuDefs.hpp"
29 #include "tes31TestCase.hpp"
30 
31 namespace glcts
32 {
33 
34 //=========================================================================
35 //= utility macros/templates
36 //=========================================================================
37 template <typename T, size_t N>
makeVector(const T (& data)[N])38 std::vector<T> makeVector(const T (&data)[N])
39 {
40 	return std::vector<T>(data, data + N);
41 }
42 
43 enum eStageType
44 {
45 	VertexShader,
46 	FragmentShader,
47 	ComputeShader
48 };
49 
50 struct StageType
51 {
52 	const char* name;
53 	eStageType  type;
54 };
55 
56 enum eSurfaceType
57 {
58 	AtomicCounter,
59 	Texture,
60 	Image,
61 	UniformBlock,
62 	ShaderStorageBuffer
63 };
64 
65 enum eTextureType
66 {
67 	None,
68 	OneD,
69 	TwoD,
70 	ThreeD,
71 	OneDArray,
72 	TwoDArray
73 };
74 
75 struct LayoutBindingParameters
76 {
77 	char const*  keyword;	  // uniform, buffer
78 	eSurfaceType surface_type; // Texture, Image...
79 	eTextureType texture_type;
80 	char const*  vector_type;		// lookup vector type
81 	char const*  uniform_type;		// sampler2D, image2D...
82 	char const*  coord_vector_type; // coord vector type
83 	char const*  access_function;   // texture(), imageLoad()...
84 };
85 
86 class LayoutBindingTests : public TestCaseGroup
87 {
88 public:
89 	LayoutBindingTests(glcts::Context& context, glu::GLSLVersion glslVersion);
90 	~LayoutBindingTests(void);
91 
92 	void init(void);
93 
94 private:
95 	LayoutBindingTests(const LayoutBindingTests& other);
96 	LayoutBindingTests& operator=(const LayoutBindingTests& other);
97 
98 	std::string createTestName(const StageType& stageType, const LayoutBindingParameters& testArgs);
99 
100 private:
101 	glu::GLSLVersion m_glslVersion;
102 
103 private:
104 	static StageType			   stageTypes[];
105 	static LayoutBindingParameters test_args[];
106 };
107 
108 } // glcts
109 
110 #endif // _ES31CLAYOUTBINDINGTESTS_HPP
111