• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _GLCLIMITTEST_HPP
2 #define _GLCLIMITTEST_HPP
3 /*-------------------------------------------------------------------------
4  * OpenGL Conformance Test Suite
5  * -----------------------------
6  *
7  * Copyright (c) 2017 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 Limits tests.
24  */ /*-------------------------------------------------------------------*/
25 
26 #include "glcTestCase.hpp"
27 #include "gluDefs.hpp"
28 #include "glwDefs.hpp"
29 #include "glwEnums.hpp"
30 #include "glwFunctions.hpp"
31 #include "tcuCommandLine.hpp"
32 #include "tcuTestLog.hpp"
33 #include "tcuVector.hpp"
34 #include "tcuVectorUtil.hpp"
35 
36 #include <string>
37 
38 namespace glcts
39 {
40 
41 template <typename DataType>
42 class LimitCase : public deqp::TestCase
43 {
44 public:
45 	LimitCase(deqp::Context& context, const char* caseName, deUint32 limitToken, DataType limitBoundary,
46 			  bool isBoundaryMaximum, const char* glslVersion = "", const char* glslBuiltin = "",
47 			  const char* glslExtension = "");
48 	virtual ~LimitCase(void);
49 
50 	tcu::TestNode::IterateResult iterate(void);
51 
52 protected:
53 	bool isWithinBoundary(DataType value, bool isBuiltin = false) const;
54 	std::string createShader() const;
55 
56 	// those functions require specialization for some data types
57 	DataType getLimitValue(const glw::Functions& gl) const;
58 	std::string getGLSLDataType() const;
59 	bool isEqual(DataType a, DataType b) const;
60 	bool isGreater(DataType a, DataType b) const;
61 	bool isSmaller(DataType a, DataType b) const;
62 
63 private:
64 	LimitCase(const LimitCase&);			// not allowed!
65 	LimitCase& operator=(const LimitCase&); // not allowed!
66 
67 	void adjustBoundaryForMaxFragmentInterpolationOffset();
68 
69 	deUint32		  m_limitToken;
70 	DataType		  m_limitBoundary; // min/max value
71 	bool			  m_isBoundaryMaximum;
72 	const std::string m_glslVersion;
73 	const std::string m_glslBuiltin;
74 	const std::string m_glslExtension;
75 };
76 
77 #include "glcLimitTest.inl"
78 
79 } // glcts
80 
81 #endif // _GLCLIMITTEST_HPP
82