• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _ESEXTCGEOMETRYSHADERCLIPPING_HPP
2 #define _ESEXTCGEOMETRYSHADERCLIPPING_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 "../esextcTestCaseBase.hpp"
27 
28 namespace glcts
29 {
30 /** Implementation of "Group 8" from CTS_EXT_geometry_shader. Description follows:
31  *
32  *  1. Make sure that, should geometry shader be present in the pipeline,
33  *     vertices that are outside clipping region are not discarded but are
34  *     passed down to geometry shader for further processing.
35  *
36  *     Category: API;
37  *               Functional Test.
38  *
39  *     Create a program object and a fragment, geometry and a vertex shader
40  *     object:
41  *
42  *     - Vertex shader should set gl_Position to (-10, -10, -10, 0).
43  *     - Geometry shader object should accept points and output triangle strips
44  *       (a maximum of 4 vertices). It should emit following vertices:
45  *
46  *     1) (-1, -1, 0, 1)
47  *     2) (-1,  1, 0, 1)
48  *     3) ( 1, -1, 0, 1)
49  *     4) ( 1,  1, 0, 1)
50  *
51  *     - Fragment shader object should store (0, 1, 0, 0) to result variable.
52  *
53  *     These shaders should be attached to the program object and compiled. The
54  *     program object should be accordingly configured and linked.
55  *
56  *     The test should generate a vertex array object and bind it.
57  *
58  *     The test should then clear the draw buffer with red color (1, 0, 0, 0).
59  *     Afterward, it should activate the program object and run it for a single
60  *     point. The contents of the draw buffer should then be read. The test
61  *     passes if the draw buffer contains a green color, fails otherwise.
62  *
63  **/
64 class GeometryShaderClipping : public TestCaseBase
65 {
66 public:
67 	/* Public methods */
68 	GeometryShaderClipping(Context& context, const ExtParameters& extParams, const char* name, const char* description);
69 
~GeometryShaderClipping()70 	virtual ~GeometryShaderClipping()
71 	{
72 	}
73 
74 	virtual void		  deinit(void);
75 	virtual IterateResult iterate(void);
76 
77 private:
78 	/* Private variables */
79 	static const char* m_fs_code;
80 	static const char* m_vs_code;
81 	static const char* m_gs_code;
82 
83 	static const int m_texture_height		= 4;
84 	static const int m_texture_width		= 4;
85 	static const int m_texture_n_levels		= 1;
86 	static const int m_texture_n_components = 4;
87 
88 	/* Variables for general usege*/
89 	glw::GLuint m_fbo_id;
90 	glw::GLuint m_fs_id;
91 	glw::GLuint m_gs_id;
92 	glw::GLuint m_po_id;
93 	glw::GLuint m_to_id;
94 	glw::GLuint m_vao_id;
95 	glw::GLuint m_vs_id;
96 };
97 
98 } // namespace glcts
99 
100 #endif // _ESEXTCGEOMETRYSHADERCLIPPING_HPP
101