1#ifndef _ESEXTCGEOMETRYSHADERNONARRAYINPUT_HPP
2#define _ESEXTCGEOMETRYSHADERNONARRAYINPUT_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
28namespace glcts
29{
30/** Implementation of "Group 4" from CTS_EXT_geometry_shader. Description follows:
31 *
32 * 1. Make sure GLES implementation does not accept non-array input variables
33 *    in geometry shaders. Geometry shaders using unsized array-based input
34 *    variables and blocks should not be detrimental to the linking process.
35 *
36 *    Category : API;
37 *               Negative & positive tests.
38 *
39 *    Create two program objects, a boilerplate fragment shader object and two
40 *    vertex shader objects.
41 *
42 *    Create a geometry shader object A. The implementation should not use any
43 *    interface blocks - all input variables (discussed below) should be
44 *    located in the default interface block. Variable named v4 should lack
45 *    array brackets (as required by the spec). A corresponding vertex shader
46 *    object A should output all variables(see later discussion) expected by
47 *    the geometry shader, so that the interfaces match.
48 *
49 *    Create a geometry shader object B. The implementation should use a single
50 *    input interface block *not* being declared as an unsized array (opposite
51 *    to spec requirements). A corresponding vertex shader object B should
52 *    output the interface block, so that that interfaces match. Both stages
53 *    should use variables as discussed in next paragraph.
54 *
55 *    Vertex shader stage should output the following variables (in a separate
56 *    output interface block or in the default one, depending on geometry
57 *    shader object considered):
58 *
59 *    * vec4 v1 (set to (-1, -1, 0, 1) )
60 *    * vec4 v2 (set to (-1,  1, 0, 1) )
61 *    * vec4 v3 (set to ( 1, -1, 0, 1) )
62 *    * vec4 v4 (set to ( 1,  1, 0, 1) )
63 *
64 *    Both geometry shaders should take points on input and output a triangle
65 *    strip, consisting of a maximum of 4 vertices. For each input point, they
66 *    should emit 4 vertices, of which coordinates are subsequently described
67 *    by vectors v1, v2, v3 and v4.
68 *
69 *    Fragment shader stage should set output vec4 variable to (0, 255, 0, 255).
70 *
71 *    Program object A should use fragment shader object as described above,
72 *    geometry shader object A and vertex shader object A.
73 *    Program object B should use fragment shader object as described above,
74 *    geometry shader object B and vertex shader object B.
75 *
76 *    Both program objects A and B are expected not to link correctly (their
77 *    GL_LINK_STATUS after linking should be reported as GL_FALSE).
78 *
79 *    Delete both program objects and geometry shader objects. Geometry shader
80 *    objects should now use a slightly modified implementation where the input
81 *    variables and the interface block is correctly defined as unsized array.
82 *
83 *    Attach all shaders to corresponding program objects, compile them, link
84 *    program objects. Both program objects should now link correctly.
85 *
86 *    The test should now set up a FBO. A 2D texture of 4x4 resolution using
87 *    GL_RGBA8 internal format should be attached to its color attachment 0.
88 *
89 *    The test should generate and bind a vertex array object, as well as the
90 *    framebuffer object.
91 *
92 *    For each program object, the test should clear the color buffer with
93 *    (255, 0, 0, 0) color and then draw a single point. The test passes if all
94 *    of the texels of the texture attached to color attachment 0 are equal to
95 *    (0, 255, 0, 255).
96 */
97
98class GeometryShaderNonarrayInputCase : public TestCaseBase
99{
100public:
101	/* Public methods */
102	GeometryShaderNonarrayInputCase(Context& context, const ExtParameters& extParams, const char* name,
103									const char* description);
104
105	virtual ~GeometryShaderNonarrayInputCase(void)
106	{
107	}
108
109	void		  deinit(void);
110	IterateResult iterate(void);
111
112protected:
113	/* Protected variables */
114	glw::GLuint m_fbo_id;
115	glw::GLuint m_fs;
116	glw::GLuint m_gs_invalid_non_ib;
117	glw::GLuint m_gs_invalid_ib;
118	glw::GLuint m_gs_valid_non_ib;
119	glw::GLuint m_gs_valid_ib;
120	glw::GLuint m_po_a_invalid;
121	glw::GLuint m_po_b_invalid;
122	glw::GLuint m_po_a_valid;
123	glw::GLuint m_po_b_valid;
124	glw::GLuint m_to_id;
125	glw::GLuint m_vao_id;
126	glw::GLuint m_vs_valid_ib;
127	glw::GLuint m_vs_valid_non_ib;
128
129	static const char* m_fs_code;
130	static const char* m_gs_code_preamble;
131	static const char* m_gs_code_body;
132	static const char* m_vs_code_preamble;
133	static const char* m_vs_code_body;
134};
135
136} // namespace glcts
137
138#endif // _ESEXTCGEOMETRYSHADERNONARRAYINPUT_HPP
139