1 #ifndef _ESEXTCGEOMETRYSHADERCONSTANTVARIABLES_HPP
2 #define _ESEXTCGEOMETRYSHADERCONSTANTVARIABLES_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 Test Group 15 from CTS_EXT_geometry_shader. Description follows:
31  *
32  *  1. gl_MaxGeometry* constants should reflect values reported for
33  *     corresponding GL_MAX_GEOMETRY_* properties.
34  *
35  *     Category: API;
36  *               Functional Test.
37  *
38  *     Using transform feedback, query values of the following constants in
39  *     a geometry shader and transfer them to a buffer object:
40  *
41  *     * gl_MaxGeometryInputComponents;
42  *     * gl_MaxGeometryOutputComponents;
43  *     * gl_MaxGeometryImageUniforms;
44  *     * gl_MaxGeometryTextureImageUnits;
45  *     * gl_MaxGeometryOutputVertices;
46  *     * gl_MaxGeometryTotalOutputComponents;
47  *     * gl_MaxGeometryUniformComponents;
48  *     * gl_MaxGeometryAtomicCounters;
49  *     * gl_MaxGeometryAtomicCounterBuffers;
50  *
51  *     The test should then map the buffer object into client-space for reading
52  *     and compare them against values reported by glGetIntegerv() for
53  *     corresponding pnames. Test should fail if any of the values do not match.
54  *
55  *
56  *  2. Implementation-dependent constants are the same for all compatible
57  *     getters. The value reported meets minimum maximum requirements enforced
58  *     by the specification.
59  *
60  *     Category: API;
61  *
62  *     The following properties should be checked:
63  *
64  *     1)  GL_MAX_GEOMETRY_IMAGE_UNIFORMS_EXT              (min: 0);
65  *     2)  GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_EXT       (min: 0);
66  *     3)  GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT         (min: 16);
67  *     4)  GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_EXT      (min: 0);
68  *     5)  GL_MAX_GEOMETRY_ATOMIC_COUNTERS_EXT             (min: 0);
69  *     6)  GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT          (min: 1024);
70  *     7)  GL_MAX_GEOMETRY_UNIFORM_BLOCKS_EXT              (min: 12);
71  *     8)  GL_MAX_GEOMETRY_INPUT_COMPONENTS_EXT            (min: 64);
72  *     9)  GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_EXT           (min: 128);
73  *     10) GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT             (min: 256);
74  *     11) GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT     (min: 1024);
75  *     12) GL_MAX_GEOMETRY_SHADER_INVOCATIONS_EXT          (min: 32);
76  *     13) GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_EXT (min:
77  *             GL_MAX_GEOMETRY_UNIFORM_BLOCKS_EXT * GL_MAX_UNIFORM_BLOCK_SIZE / 4 +
78  *             + GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT);
79  *     14) GL_LAYER_PROVOKING_VERTEX_EXT                   (accepted values:
80  *             GL_PROVOKING_VERTEX (*),
81  *             GL_FIRST_VERTEX_CONVENTION_EXT,
82  *             GL_LAST_VERTEX_CONVENTION_EXT,
83  *             GL_UNDEFINED_VERTEX_EXT)
84  *     15) GL_MAX_FRAMEBUFFER_LAYERS_EXT                   (min: 2048)
85  *
86  *     (*) Only applicable to OpenGL. The ES extension does not allow this value.
87  **/
88 
89 class GeometryShaderConstantVariables : public TestCaseBase
90 {
91 public:
92     /* Public methods */
93     GeometryShaderConstantVariables(Context &context, const ExtParameters &extParams, const char *name,
94                                     const char *description);
95 
~GeometryShaderConstantVariables()96     virtual ~GeometryShaderConstantVariables()
97     {
98     }
99 
100     void deinit(void);
101     IterateResult iterate(void);
102 
103 private:
104     /* Private methods */
105     void initTest(void);
106 
107     /* Private variables */
108     static const char *m_fragment_shader_code;
109     static const char *m_geometry_shader_code;
110     static const char *m_vertex_shader_code;
111     static const char *m_feedbackVaryings[];
112 
113     glw::GLuint m_fragment_shader_id;
114     glw::GLuint m_geometry_shader_id;
115     glw::GLuint m_vertex_shader_id;
116     glw::GLuint m_program_id;
117 
118     glw::GLuint m_bo_id;
119     glw::GLuint m_vao_id;
120 
121     /* EXT_geometry_shader specific constant values */
122     const int m_min_MaxGeometryImagesUniforms;
123     const int m_min_MaxGeometryTextureImagesUnits;
124     const int m_min_MaxGeometryShaderStorageBlocks;
125     const int m_min_MaxGeometryAtomicCounterBuffers;
126     const int m_min_MaxGeometryAtomicCounters;
127 
128     const int m_min_MaxFramebufferLayers;
129     const int m_min_MaxGeometryInputComponents;
130     const int m_min_MaxGeometryOutputComponents;
131     const int m_min_MaxGeometryOutputVertices;
132     const int m_min_MaxGeometryShaderInvocations;
133     const int m_min_MaxGeometryTotalOutputComponents;
134     const int m_min_MaxGeometryUniformBlocks;
135     const int m_min_MaxGeometryUniformComponents;
136 };
137 
138 } // namespace glcts
139 
140 #endif // _ESEXTCGEOMETRYSHADERCONSTANTVARIABLES_HPP
141