1e5c31af7Sopenharmony_ci#ifndef _ESEXTCTESSELLATIONSHADERPOINTS_HPP 2e5c31af7Sopenharmony_ci#define _ESEXTCTESSELLATIONSHADERPOINTS_HPP 3e5c31af7Sopenharmony_ci/*------------------------------------------------------------------------- 4e5c31af7Sopenharmony_ci * OpenGL Conformance Test Suite 5e5c31af7Sopenharmony_ci * ----------------------------- 6e5c31af7Sopenharmony_ci * 7e5c31af7Sopenharmony_ci * Copyright (c) 2014-2016 The Khronos Group Inc. 8e5c31af7Sopenharmony_ci * 9e5c31af7Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 10e5c31af7Sopenharmony_ci * you may not use this file except in compliance with the License. 11e5c31af7Sopenharmony_ci * You may obtain a copy of the License at 12e5c31af7Sopenharmony_ci * 13e5c31af7Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 14e5c31af7Sopenharmony_ci * 15e5c31af7Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 16e5c31af7Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 17e5c31af7Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18e5c31af7Sopenharmony_ci * See the License for the specific language governing permissions and 19e5c31af7Sopenharmony_ci * limitations under the License. 20e5c31af7Sopenharmony_ci * 21e5c31af7Sopenharmony_ci */ /*! 22e5c31af7Sopenharmony_ci * \file 23e5c31af7Sopenharmony_ci * \brief 24e5c31af7Sopenharmony_ci */ /*-------------------------------------------------------------------*/ 25e5c31af7Sopenharmony_ci 26e5c31af7Sopenharmony_ci#include "../esextcTestCaseBase.hpp" 27e5c31af7Sopenharmony_ci#include "esextcTessellationShaderUtils.hpp" 28e5c31af7Sopenharmony_ci#include "gluShaderUtil.hpp" 29e5c31af7Sopenharmony_ci#include "tcuDefs.hpp" 30e5c31af7Sopenharmony_ci 31e5c31af7Sopenharmony_cinamespace glcts 32e5c31af7Sopenharmony_ci{ 33e5c31af7Sopenharmony_ci 34e5c31af7Sopenharmony_ci/** A DEQP CTS test group that collects all tests that verify triangle 35e5c31af7Sopenharmony_ci * tessellation. 36e5c31af7Sopenharmony_ci */ 37e5c31af7Sopenharmony_ciclass TessellationShaderPointsTests : public glcts::TestCaseGroupBase 38e5c31af7Sopenharmony_ci{ 39e5c31af7Sopenharmony_cipublic: 40e5c31af7Sopenharmony_ci /* Public methods */ 41e5c31af7Sopenharmony_ci TessellationShaderPointsTests(glcts::Context& context, const ExtParameters& extParams); 42e5c31af7Sopenharmony_ci virtual ~TessellationShaderPointsTests(void) 43e5c31af7Sopenharmony_ci { 44e5c31af7Sopenharmony_ci } 45e5c31af7Sopenharmony_ci 46e5c31af7Sopenharmony_ci virtual void init(void); 47e5c31af7Sopenharmony_ci 48e5c31af7Sopenharmony_ciprivate: 49e5c31af7Sopenharmony_ci /* Private methods */ 50e5c31af7Sopenharmony_ci TessellationShaderPointsTests(const TessellationShaderPointsTests& other); 51e5c31af7Sopenharmony_ci TessellationShaderPointsTests& operator=(const TessellationShaderPointsTests& other); 52e5c31af7Sopenharmony_ci}; 53e5c31af7Sopenharmony_ci 54e5c31af7Sopenharmony_ci/** Implementation of Test Case 39 55e5c31af7Sopenharmony_ci * 56e5c31af7Sopenharmony_ci * Assuming the implementation reports maximum point size to be at least 2, 57e5c31af7Sopenharmony_ci * make sure that points are rendered with size as defined by: 58e5c31af7Sopenharmony_ci * 59e5c31af7Sopenharmony_ci * * geometry shader (if present); (*) 60e5c31af7Sopenharmony_ci * * tessellation evaluation shader (if GL_EXT_tessellation_shader and 61e5c31af7Sopenharmony_ci * GL_EXT_tessellation_shader_point_size extensions are supported and no 62e5c31af7Sopenharmony_ci * geometry shader is active); (**) 63e5c31af7Sopenharmony_ci * 64e5c31af7Sopenharmony_ci * Technical details. 65e5c31af7Sopenharmony_ci * 66e5c31af7Sopenharmony_ci * 0. The test should draw points in a few pre-defined locations (screen corners, 67e5c31af7Sopenharmony_ci * center of the draw buffer). 68e5c31af7Sopenharmony_ci * 1a. For case (*), vertex shader should set point size to 0.01, TE should 69e5c31af7Sopenharmony_ci * set point size to 0.1 and GE should set point size to 2 for each 70e5c31af7Sopenharmony_ci * vertex processed. 71e5c31af7Sopenharmony_ci * 1b. For case (**), TE should set the point size to 2 and VE should set it 72e5c31af7Sopenharmony_ci * to 0.1. 73e5c31af7Sopenharmony_ci * 2. The test passes if centers of the rendered points have correct values. 74e5c31af7Sopenharmony_ci * 75e5c31af7Sopenharmony_ci **/ 76e5c31af7Sopenharmony_ciclass TessellationShaderPointsgl_PointSize : public TestCaseBase 77e5c31af7Sopenharmony_ci{ 78e5c31af7Sopenharmony_cipublic: 79e5c31af7Sopenharmony_ci /* Public methods */ 80e5c31af7Sopenharmony_ci TessellationShaderPointsgl_PointSize(Context& context, const ExtParameters& extParams); 81e5c31af7Sopenharmony_ci 82e5c31af7Sopenharmony_ci virtual ~TessellationShaderPointsgl_PointSize(void) 83e5c31af7Sopenharmony_ci { 84e5c31af7Sopenharmony_ci } 85e5c31af7Sopenharmony_ci 86e5c31af7Sopenharmony_ci virtual void deinit(); 87e5c31af7Sopenharmony_ci void initTest(void); 88e5c31af7Sopenharmony_ci virtual IterateResult iterate(void); 89e5c31af7Sopenharmony_ci 90e5c31af7Sopenharmony_ciprivate: 91e5c31af7Sopenharmony_ci /* Private type definitions */ 92e5c31af7Sopenharmony_ci typedef struct _test_descriptor 93e5c31af7Sopenharmony_ci { 94e5c31af7Sopenharmony_ci const char* fs_body; 95e5c31af7Sopenharmony_ci const char* gs_body; 96e5c31af7Sopenharmony_ci const char* tes_body; 97e5c31af7Sopenharmony_ci const char* tcs_body; 98e5c31af7Sopenharmony_ci const char* vs_body; 99e5c31af7Sopenharmony_ci 100e5c31af7Sopenharmony_ci glw::GLint fs_id; 101e5c31af7Sopenharmony_ci glw::GLint gs_id; 102e5c31af7Sopenharmony_ci glw::GLint tes_id; 103e5c31af7Sopenharmony_ci glw::GLint tcs_id; 104e5c31af7Sopenharmony_ci glw::GLint vs_id; 105e5c31af7Sopenharmony_ci 106e5c31af7Sopenharmony_ci glw::GLint draw_call_count; 107e5c31af7Sopenharmony_ci glw::GLint po_id; 108e5c31af7Sopenharmony_ci 109e5c31af7Sopenharmony_ci _test_descriptor() 110e5c31af7Sopenharmony_ci { 111e5c31af7Sopenharmony_ci fs_body = NULL; 112e5c31af7Sopenharmony_ci gs_body = NULL; 113e5c31af7Sopenharmony_ci tes_body = NULL; 114e5c31af7Sopenharmony_ci tcs_body = NULL; 115e5c31af7Sopenharmony_ci vs_body = NULL; 116e5c31af7Sopenharmony_ci 117e5c31af7Sopenharmony_ci fs_id = 0; 118e5c31af7Sopenharmony_ci gs_id = 0; 119e5c31af7Sopenharmony_ci tes_id = 0; 120e5c31af7Sopenharmony_ci tcs_id = 0; 121e5c31af7Sopenharmony_ci vs_id = 0; 122e5c31af7Sopenharmony_ci 123e5c31af7Sopenharmony_ci draw_call_count = 0; 124e5c31af7Sopenharmony_ci po_id = 0; 125e5c31af7Sopenharmony_ci } 126e5c31af7Sopenharmony_ci } _test_descriptor; 127e5c31af7Sopenharmony_ci 128e5c31af7Sopenharmony_ci typedef std::vector<_test_descriptor> _tests; 129e5c31af7Sopenharmony_ci typedef _tests::iterator _tests_iterator; 130e5c31af7Sopenharmony_ci 131e5c31af7Sopenharmony_ci /* Private methods */ 132e5c31af7Sopenharmony_ci 133e5c31af7Sopenharmony_ci /* Private variables */ 134e5c31af7Sopenharmony_ci _tests m_tests; 135e5c31af7Sopenharmony_ci 136e5c31af7Sopenharmony_ci glw::GLuint m_fbo_id; 137e5c31af7Sopenharmony_ci glw::GLuint m_to_id; 138e5c31af7Sopenharmony_ci glw::GLuint m_vao_id; 139e5c31af7Sopenharmony_ci 140e5c31af7Sopenharmony_ci static const unsigned int m_rt_height; 141e5c31af7Sopenharmony_ci static const unsigned int m_rt_width; 142e5c31af7Sopenharmony_ci}; 143e5c31af7Sopenharmony_ci 144e5c31af7Sopenharmony_ci/** Implementation of Test Case 27 145e5c31af7Sopenharmony_ci * 146e5c31af7Sopenharmony_ci * Make sure that point mode enabled in a tessellation evaluation shader 147e5c31af7Sopenharmony_ci * affects geometry generated by tessellation primitive generator. Iterate 148e5c31af7Sopenharmony_ci * over all vertex spacing modes. 149e5c31af7Sopenharmony_ci * Cover all three tessellation primitive generator modes (triangles, quads, 150e5c31af7Sopenharmony_ci * isolines). 151e5c31af7Sopenharmony_ci * 152e5c31af7Sopenharmony_ci * Technical details: 153e5c31af7Sopenharmony_ci * 154e5c31af7Sopenharmony_ci * 0. Consider the following set: {-1 (where valid), 1, MAX_TESS_GEN_LEVEL_EXT / 2, 155e5c31af7Sopenharmony_ci * MAX_TESS_GEN_LEVEL_EXT}. All combinations of values from this set 156e5c31af7Sopenharmony_ci * in regard to relevant inner/outer tessellation levels for all 157e5c31af7Sopenharmony_ci * primitive generator modes should be checked by this test. 158e5c31af7Sopenharmony_ci * 159e5c31af7Sopenharmony_ci * 1. TE should capture output points. Captured vertices should not 160e5c31af7Sopenharmony_ci * duplicate and their amount should be exactly as defined in the spec 161e5c31af7Sopenharmony_ci * for the (inner tessellation level, outer tessellation level, output 162e5c31af7Sopenharmony_ci * geometry) combination considered. 163e5c31af7Sopenharmony_ci * 164e5c31af7Sopenharmony_ci * This test implementation skips configurations meeting all of the following 165e5c31af7Sopenharmony_ci * properties: 166e5c31af7Sopenharmony_ci * 167e5c31af7Sopenharmony_ci * - primitive mode: QUADS or TRIANGLES 168e5c31af7Sopenharmony_ci * - vertex spacing mode: FRACTIONAL ODD 169e5c31af7Sopenharmony_ci * - inner tess level[0]: <= 1 170e5c31af7Sopenharmony_ci * - inner tess level[1]: <= 1 171e5c31af7Sopenharmony_ci * 172e5c31af7Sopenharmony_ci * These configurations are affected by a nuance described in greater 173e5c31af7Sopenharmony_ci * detail in Khronos Bugzilla#11979, which this test cannot handle. 174e5c31af7Sopenharmony_ci * 175e5c31af7Sopenharmony_ci **/ 176e5c31af7Sopenharmony_ciclass TessellationShaderPointsVerification : public TestCaseBase 177e5c31af7Sopenharmony_ci{ 178e5c31af7Sopenharmony_cipublic: 179e5c31af7Sopenharmony_ci /* Public methods */ 180e5c31af7Sopenharmony_ci TessellationShaderPointsVerification(Context& context, const ExtParameters& extParams); 181e5c31af7Sopenharmony_ci 182e5c31af7Sopenharmony_ci virtual ~TessellationShaderPointsVerification(void) 183e5c31af7Sopenharmony_ci { 184e5c31af7Sopenharmony_ci } 185e5c31af7Sopenharmony_ci 186e5c31af7Sopenharmony_ci virtual void deinit(void); 187e5c31af7Sopenharmony_ci void initTest(void); 188e5c31af7Sopenharmony_ci virtual IterateResult iterate(void); 189e5c31af7Sopenharmony_ci 190e5c31af7Sopenharmony_ciprivate: 191e5c31af7Sopenharmony_ci /* Private declarations */ 192e5c31af7Sopenharmony_ci typedef struct _run 193e5c31af7Sopenharmony_ci { 194e5c31af7Sopenharmony_ci float inner[2]; 195e5c31af7Sopenharmony_ci float outer[4]; 196e5c31af7Sopenharmony_ci _tessellation_primitive_mode primitive_mode; 197e5c31af7Sopenharmony_ci _tessellation_shader_vertex_spacing vertex_spacing; 198e5c31af7Sopenharmony_ci 199e5c31af7Sopenharmony_ci _run() 200e5c31af7Sopenharmony_ci { 201e5c31af7Sopenharmony_ci memset(inner, 0, sizeof(inner)); 202e5c31af7Sopenharmony_ci memset(outer, 0, sizeof(outer)); 203e5c31af7Sopenharmony_ci 204e5c31af7Sopenharmony_ci primitive_mode = TESSELLATION_SHADER_PRIMITIVE_MODE_UNKNOWN; 205e5c31af7Sopenharmony_ci vertex_spacing = TESSELLATION_SHADER_VERTEX_SPACING_UNKNOWN; 206e5c31af7Sopenharmony_ci } 207e5c31af7Sopenharmony_ci } _run; 208e5c31af7Sopenharmony_ci 209e5c31af7Sopenharmony_ci /* Private methods */ 210e5c31af7Sopenharmony_ci void verifyCorrectAmountOfDuplicateVertices(const _run& run, const void* run_data, unsigned int run_n_vertices); 211e5c31af7Sopenharmony_ci 212e5c31af7Sopenharmony_ci void verifyCorrectAmountOfVertices(const _run& run, const void* run_data, unsigned int run_n_vertices); 213e5c31af7Sopenharmony_ci 214e5c31af7Sopenharmony_ci /* Private variables */ 215e5c31af7Sopenharmony_ci std::vector<_run> m_runs; 216e5c31af7Sopenharmony_ci TessellationShaderUtils* m_utils; 217e5c31af7Sopenharmony_ci glw::GLuint m_vao_id; 218e5c31af7Sopenharmony_ci}; 219e5c31af7Sopenharmony_ci 220e5c31af7Sopenharmony_ci} // namespace glcts 221e5c31af7Sopenharmony_ci 222e5c31af7Sopenharmony_ci#endif // _ESEXTCTESSELLATIONSHADERPOINTS_HPP 223