1 #ifndef _ESEXTCTESSELLATIONSHADERPRIMITIVECOVERAGE_HPP 2 #define _ESEXTCTESSELLATIONSHADERPRIMITIVECOVERAGE_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 /*! 27 * \file esextcTessellationShaderPrimitiveCoverage.hpp 28 * \brief TessellationShadePrimitiveCoverage (Test 31) 29 */ /*-------------------------------------------------------------------*/ 30 31 #include "../esextcTestCaseBase.hpp" 32 #include "esextcTessellationShaderUtils.hpp" 33 #include "gluShaderUtil.hpp" 34 #include "tcuDefs.hpp" 35 36 namespace glcts 37 { 38 /** Implementation of Test 31 from CTS_EXT_tessellation_shader. Description follows: 39 * 40 * Assume this test is run separately for a tessellated full-screen triangle 41 * and a tessellated full-screen quad. 42 * Using a stencil buffer, make sure that the whole domain is always 43 * covered by exactly one triangle generated during the process of tessellation. 44 * Make sure that the whole domain is covered by the set of all triangles 45 * generated during the process of tessellation. 46 * 47 * Category: Functional Test. 48 * Priority: Must-Have 49 */ 50 class TessellationShaderPrimitiveCoverage : public TestCaseBase 51 { 52 public: 53 /* Public methods */ 54 TessellationShaderPrimitiveCoverage(Context& context, const ExtParameters& extParams); 55 ~TessellationShaderPrimitiveCoverage()56 virtual ~TessellationShaderPrimitiveCoverage() 57 { 58 } 59 60 virtual void deinit(void); 61 virtual IterateResult iterate(void); 62 63 private: 64 /* Private methods */ 65 void initBufferObjects(void); 66 void initFramebuffer(void); 67 void initProgramObjects(void); 68 void initTest(void); 69 70 void drawPatch(glw::GLuint po_id, glw::GLuint n_patch_vertices, glw::GLuint n_draw_call_vertices, 71 const glw::GLfloat inner_levels[], const glw::GLfloat outer_levels[]); 72 73 bool verifyDrawBufferContents(void); 74 75 /* Private variables */ 76 glw::GLuint m_vao_id; /* name of vertex array object */ 77 glw::GLuint m_quad_tessellation_po_id; /* name of program object that performs quad tessellation */ 78 glw::GLuint m_stencil_verification_po_id; /* name of program object for stencil setup */ 79 glw::GLuint m_triangles_tessellation_po_id; /* name of program object that performs triangle tessellation */ 80 81 glw::GLuint m_bo_id; /* name of a buffer object used to hold input vertex data */ 82 83 glw::GLuint m_fs_id; /* name of fragment shader object */ 84 glw::GLuint 85 m_quad_tessellation_tcs_id; /* name of tessellation control shader object that performs quad tessellation */ 86 glw::GLuint 87 m_quad_tessellation_tes_id; /* name of tessellation evaluation shader object that performs quad tessellation */ 88 glw::GLuint 89 m_triangles_tessellation_tcs_id; /* name of tessellation control shader object that performs triangle tessellation */ 90 glw::GLuint 91 m_triangles_tessellation_tes_id; /* name of tessellation evaluation shader object that performs triangle tessellation */ 92 glw::GLuint m_vs_id; /* nameof vertex shader object */ 93 94 glw::GLuint m_fbo_id; /* name of a framebuffer object */ 95 glw::GLuint m_color_rbo_id; /* name of a renderbuffer object to be used as color attachment */ 96 glw::GLuint m_stencil_rbo_id; /* name of a renderbuffer object to be used as stencil attachment */ 97 98 static const char* m_fs_code; /* fragment shader source code */ 99 static const char* m_quad_tessellation_tcs_code; /* tessellation control shader source code */ 100 static const char* m_quad_tessellation_tes_code; /* tessellation evaluation shader source code */ 101 static const char* m_triangles_tessellation_tcs_code; /* tessellation control shader source code */ 102 static const char* m_triangles_tessellation_tes_code; /* tessellation evaluation shader source code */ 103 static const char* m_vs_code; /* vertex shader source code */ 104 105 static const glw::GLuint m_height; /* height of the rendering area */ 106 static const glw::GLuint m_n_components; /* number of components used by a single texel */ 107 static const glw::GLuint m_width; /* width of the rendering area */ 108 109 static const glw::GLfloat m_clear_color[4]; /* clear color */ 110 static const glw::GLfloat m_stencil_pass_color[4]; /* primitive color when stencil fails */ 111 glw::GLubyte* m_rendered_data_buffer; /* pixel buffer for fetched data */ 112 static const glw::GLuint m_rendered_data_buffer_size; /* pixel buffer size */ 113 }; 114 115 } // namespace glcts 116 117 #endif // _ESEXTCTESSELLATIONSHADERPRIMITIVECOVERAGE_HPP 118