1 #ifndef _ESEXTCTESSELLATIONSHADERMAXPATCHVERTICES_HPP
2 #define _ESEXTCTESSELLATIONSHADERMAXPATCHVERTICES_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 #include "esextcTessellationShaderUtils.hpp"
28 #include "gluShaderUtil.hpp"
29 #include "tcuDefs.hpp"
30 
31 /*!
32  * \file esextcTessellationShaderMaxPatchVertices.hpp
33  * \brief TessellationShadeMaxPatchVertices (Test 19)
34  */ /*-------------------------------------------------------------------*/
35 
36 namespace glcts
37 {
38 
39 /*   Implementation for Test Case 19
40  *
41  *   Make sure it is possible to use up to gl_MaxPatchVertices vertices in
42  *   a patch and that the tessellation control shader, if it is present, can
43  *   correctly access all of the vertices passed in a draw call. Input
44  *   variables should be defined as arrays without explicit array size assigned.
45  *   Test two cases:
46  *
47  *   * one where the patch size is explicitly defined to be equal to
48  *     gl_MaxPatchVertices (tessellation control shader is present);
49  *   * another one where the patch size is implicitly assumed to be equal to
50  *     gl_MaxPatchVertices (tessellation control shader is not present) (*);
51  *
52  *   Technical details:
53  *
54  *   0. For each patch vertex, vec4 and ivec4 input attributes should be defined in
55  *      TC. Values retrieved from these attributes should be passed to TE for XFB
56  *      and then compared against reference data sets.
57  *
58  *   (*) Only checked on Desktop
59  *
60  *   Category: Functional Test.
61  *   Priority: Must-Have
62  */
63 class TessellationShaderMaxPatchVertices : public TestCaseBase
64 {
65 public:
66     /* Public methods */
67     TessellationShaderMaxPatchVertices(Context &context, const ExtParameters &extParams);
68 
~TessellationShaderMaxPatchVertices()69     virtual ~TessellationShaderMaxPatchVertices()
70     {
71     }
72 
73     virtual void deinit(void);
74     virtual IterateResult iterate(void);
75 
76 private:
77     /* private methods */
78     void initTest(void);
79     void initProgramObjects(void);
80     void initVertexBufferObjects(void);
81     void initTransformFeedbackBufferObjects(void);
82     void initReferenceValues(void);
83 
84     bool compareResults(const char *description, glw::GLfloat ref_fv[4]);
85     bool compareResults(const char *description, glw::GLint ref_iv[4]);
86 
87     /* Private variables */
88     glw::GLuint m_bo_id_f_1; /* buffer object name for transform feedback of vec4 for case 1 */
89     glw::GLuint m_bo_id_f_2; /* buffer object name for transform feedback of vec4 for case 2 */
90     glw::GLuint m_bo_id_i_1; /* buffer object name for transform feedback of ivec4 for case 1 */
91     glw::GLuint m_bo_id_i_2; /* buffer object name for transform feedback of ivec4 for case 2 */
92     glw::GLuint m_fs_id;     /* fragment shader object name */
93     glw::GLuint m_po_id_1;   /* program object name for case 1 */
94     glw::GLuint m_po_id_2;   /* program object name for case 2 */
95     glw::GLuint m_tc_id;     /* tessellation control shader object name for case 1 */
96     glw::GLuint m_te_id;     /* tessellation evaluation shader object name */
97     glw::GLuint m_tf_id_1;   /* transform feedback object name for case 1 */
98     glw::GLuint m_tf_id_2;   /* transform feedback object name for case 2 */
99     glw::GLuint m_vs_id;     /* vertex shader object name */
100     glw::GLuint m_vao_id;    /* vertex array object */
101 
102     glw::GLint m_gl_max_patch_vertices; /* GL_MAX_PATCH_VERTICES_EXT pname value */
103 
104     glw::GLuint m_patch_vertices_bo_f_id; /* buffer object name for patch vertices submission */
105     glw::GLuint m_patch_vertices_bo_i_id; /* buffer object name for patch vertices submission */
106     glw::GLfloat *m_patch_vertices_f;     /* input array of patches for submission */
107     glw::GLint *m_patch_vertices_i;       /* input array of patches for submission */
108 
109     static const char *m_fs_code;             /* fragment shader code */
110     static const char *m_vs_code;             /* vertex shader code */
111     static const char *m_tc_code;             /* tessellation control shader code */
112     static const char *m_te_code;             /* tessellation evaluation shader code */
113     static const char *const m_tf_varyings[]; /* transform feedback varyings */
114 
115     glw::GLfloat m_ref_fv_case_1[4]; /* reference values of vec4 outputs for case 1 */
116     glw::GLint m_ref_iv_case_1[4];   /* reference values of ivec4 outputs for case 1 */
117 
118     glw::GLfloat m_ref_fv_case_2[4]; /* reference values of vec4 outputs for case 2 */
119     glw::GLint m_ref_iv_case_2[4];   /* reference values of ivec4 outputs for case 2 */
120 };
121 
122 } // namespace glcts
123 
124 #endif // _ESEXTCTESSELLATIONSHADERMAXPATCHVERTICES_HPP
125