1e5c31af7Sopenharmony_ci#ifndef _ESEXTCTESSELLATIONSHADERISOLINES_HPP 2e5c31af7Sopenharmony_ci#define _ESEXTCTESSELLATIONSHADERISOLINES_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#include <map> 31e5c31af7Sopenharmony_ci#include <vector> 32e5c31af7Sopenharmony_ci 33e5c31af7Sopenharmony_cinamespace glcts 34e5c31af7Sopenharmony_ci{ 35e5c31af7Sopenharmony_ci/** Implementation of Test Case 34 36e5c31af7Sopenharmony_ci * 37e5c31af7Sopenharmony_ci * Consider isoline tessellation. 38e5c31af7Sopenharmony_ci * Make sure that the number of isolines generated is derived from the first 39e5c31af7Sopenharmony_ci * outer tessellation level; 40e5c31af7Sopenharmony_ci * Make sure that the number of segments in each isoline is derived 41e5c31af7Sopenharmony_ci * from the second outer tessellation level. 42e5c31af7Sopenharmony_ci * Make sure that both inner tessellation levels and the third and the fourth 43e5c31af7Sopenharmony_ci * outer tessellation levels do not affect the tessellation process. 44e5c31af7Sopenharmony_ci * Make sure that 'equal_spacing' vertex spacing mode is always used for 45e5c31af7Sopenharmony_ci * vertical subdivision of the input quad. 46e5c31af7Sopenharmony_ci * Make sure no line is drawn between (0, 1) and (1, 1) in (u, v) domain. 47e5c31af7Sopenharmony_ci * 48e5c31af7Sopenharmony_ci * 0. Consider the following set: {-1, 1, MAX_TESS_GEN_LEVEL_EXT / 2, 49e5c31af7Sopenharmony_ci * MAX_TESS_GEN_LEVEL_EXT}. All combinations of values from this set 50e5c31af7Sopenharmony_ci * in regard to the first two outer tessellation levels for isolines 51e5c31af7Sopenharmony_ci * generator mode should be checked by this test. 52e5c31af7Sopenharmony_ci * 1. For each combination and case described in the test summary, output 53e5c31af7Sopenharmony_ci * vertices processed by TE should be XFBed and verified by the test 54e5c31af7Sopenharmony_ci * implementation. 55e5c31af7Sopenharmony_ci * 2. For the case where we verify that inner tessellation level and 56e5c31af7Sopenharmony_ci * the 3rd and the 4th outer tessellation levels are ignored, 57e5c31af7Sopenharmony_ci * the test should work along the lines of test case 28. 58e5c31af7Sopenharmony_ci * 59e5c31af7Sopenharmony_ci **/ 60e5c31af7Sopenharmony_ciclass TessellationShadersIsolines : public TestCaseBase 61e5c31af7Sopenharmony_ci{ 62e5c31af7Sopenharmony_cipublic: 63e5c31af7Sopenharmony_ci /* Public methods */ 64e5c31af7Sopenharmony_ci TessellationShadersIsolines(Context& context, const ExtParameters& extParams); 65e5c31af7Sopenharmony_ci 66e5c31af7Sopenharmony_ci virtual ~TessellationShadersIsolines(void) 67e5c31af7Sopenharmony_ci { 68e5c31af7Sopenharmony_ci } 69e5c31af7Sopenharmony_ci 70e5c31af7Sopenharmony_ci virtual void deinit(void); 71e5c31af7Sopenharmony_ci virtual IterateResult iterate(void); 72e5c31af7Sopenharmony_ci 73e5c31af7Sopenharmony_ciprivate: 74e5c31af7Sopenharmony_ci /* Forward declarations */ 75e5c31af7Sopenharmony_ci struct _test_descriptor; 76e5c31af7Sopenharmony_ci 77e5c31af7Sopenharmony_ci /* Private type definitions */ 78e5c31af7Sopenharmony_ci /** Stores: 79e5c31af7Sopenharmony_ci * 80e5c31af7Sopenharmony_ci * a) properties used to generate tessellated coordinates. 81e5c31af7Sopenharmony_ci * b) pointer to owning test descriptor 82e5c31af7Sopenharmony_ci * c) captured tessellated coordinates. 83e5c31af7Sopenharmony_ci **/ 84e5c31af7Sopenharmony_ci typedef struct _test_result 85e5c31af7Sopenharmony_ci { 86e5c31af7Sopenharmony_ci unsigned int n_isolines; 87e5c31af7Sopenharmony_ci unsigned int n_vertices; 88e5c31af7Sopenharmony_ci const _test_descriptor* parent; 89e5c31af7Sopenharmony_ci std::vector<float> rendered_data; 90e5c31af7Sopenharmony_ci 91e5c31af7Sopenharmony_ci int irrelevant_tess_level; 92e5c31af7Sopenharmony_ci int outer1_tess_level; 93e5c31af7Sopenharmony_ci int outer2_tess_level; 94e5c31af7Sopenharmony_ci 95e5c31af7Sopenharmony_ci _test_result() 96e5c31af7Sopenharmony_ci { 97e5c31af7Sopenharmony_ci n_isolines = 0; 98e5c31af7Sopenharmony_ci n_vertices = 0; 99e5c31af7Sopenharmony_ci parent = DE_NULL; 100e5c31af7Sopenharmony_ci rendered_data.clear(); 101e5c31af7Sopenharmony_ci 102e5c31af7Sopenharmony_ci irrelevant_tess_level = 0; 103e5c31af7Sopenharmony_ci outer1_tess_level = 0; 104e5c31af7Sopenharmony_ci outer2_tess_level = 0; 105e5c31af7Sopenharmony_ci } 106e5c31af7Sopenharmony_ci } _test_result; 107e5c31af7Sopenharmony_ci 108e5c31af7Sopenharmony_ci /** Encapsulates: 109e5c31af7Sopenharmony_ci * 110e5c31af7Sopenharmony_ci * a) Tessellation properties corresponding to what is set 111e5c31af7Sopenharmony_ci * in TC and TE stages, when the particular program object 112e5c31af7Sopenharmony_ci * is used for draw calls. 113e5c31af7Sopenharmony_ci * b) Pointer to test instance. 114e5c31af7Sopenharmony_ci **/ 115e5c31af7Sopenharmony_ci typedef struct _test_descriptor 116e5c31af7Sopenharmony_ci { 117e5c31af7Sopenharmony_ci TessellationShadersIsolines* parent; 118e5c31af7Sopenharmony_ci 119e5c31af7Sopenharmony_ci float inner_tess_levels[2]; 120e5c31af7Sopenharmony_ci float irrelevant_tess_level; 121e5c31af7Sopenharmony_ci float outer_tess_levels[4]; 122e5c31af7Sopenharmony_ci _tessellation_shader_vertex_spacing vertex_spacing_mode; 123e5c31af7Sopenharmony_ci 124e5c31af7Sopenharmony_ci _test_descriptor() : irrelevant_tess_level(0) 125e5c31af7Sopenharmony_ci { 126e5c31af7Sopenharmony_ci parent = DE_NULL; 127e5c31af7Sopenharmony_ci 128e5c31af7Sopenharmony_ci memset(inner_tess_levels, 0, sizeof(inner_tess_levels)); 129e5c31af7Sopenharmony_ci memset(outer_tess_levels, 0, sizeof(outer_tess_levels)); 130e5c31af7Sopenharmony_ci 131e5c31af7Sopenharmony_ci vertex_spacing_mode = TESSELLATION_SHADER_VERTEX_SPACING_UNKNOWN; 132e5c31af7Sopenharmony_ci } 133e5c31af7Sopenharmony_ci } _test_descriptor; 134e5c31af7Sopenharmony_ci 135e5c31af7Sopenharmony_ci /** Function pointer used to refer to verification functions that operate on 136e5c31af7Sopenharmony_ci * a single test result descriptor. 137e5c31af7Sopenharmony_ci **/ 138e5c31af7Sopenharmony_ci typedef void (*PFNTESTRESULTPROCESSORPROC)(_test_result& test_result, glw::GLenum glToken); 139e5c31af7Sopenharmony_ci 140e5c31af7Sopenharmony_ci typedef std::vector<_test_descriptor> _tests; 141e5c31af7Sopenharmony_ci typedef _tests::const_iterator _tests_const_iterator; 142e5c31af7Sopenharmony_ci typedef _tests::iterator _tests_iterator; 143e5c31af7Sopenharmony_ci typedef std::map<_tessellation_shader_vertex_spacing, _tests> _tests_per_vertex_spacing_map; 144e5c31af7Sopenharmony_ci typedef _tests_per_vertex_spacing_map::const_iterator _tests_per_vertex_spacing_map_const_iterator; 145e5c31af7Sopenharmony_ci typedef _tests_per_vertex_spacing_map::iterator _tests_per_vertex_spacing_map_iterator; 146e5c31af7Sopenharmony_ci typedef std::vector<_test_result> _test_results; 147e5c31af7Sopenharmony_ci typedef _test_results::iterator _test_results_iterator; 148e5c31af7Sopenharmony_ci typedef std::map<_tessellation_shader_vertex_spacing, _test_results> _test_results_per_vertex_spacing_map; 149e5c31af7Sopenharmony_ci typedef _test_results_per_vertex_spacing_map::const_iterator _test_results_per_vertex_spacing_map_const_iterator; 150e5c31af7Sopenharmony_ci typedef _test_results_per_vertex_spacing_map::iterator _test_results_per_vertex_spacing_map_iterator; 151e5c31af7Sopenharmony_ci 152e5c31af7Sopenharmony_ci typedef int _irrelevant_tess_level; 153e5c31af7Sopenharmony_ci typedef int _outer1_tess_level; 154e5c31af7Sopenharmony_ci typedef int _outer2_tess_level; 155e5c31af7Sopenharmony_ci 156e5c31af7Sopenharmony_ci /* Private methods */ 157e5c31af7Sopenharmony_ci void countIsolines(_test_result& test_result); 158e5c31af7Sopenharmony_ci 159e5c31af7Sopenharmony_ci _test_result findTestResult(_irrelevant_tess_level irrelevant_tess_level, _outer1_tess_level outer1_tess_level, 160e5c31af7Sopenharmony_ci _outer2_tess_level outer2_tess_level, 161e5c31af7Sopenharmony_ci _tessellation_shader_vertex_spacing vertex_spacing_mode); 162e5c31af7Sopenharmony_ci 163e5c31af7Sopenharmony_ci Context& getContext(); 164e5c31af7Sopenharmony_ci void initTest(void); 165e5c31af7Sopenharmony_ci 166e5c31af7Sopenharmony_ci void initTestDescriptor(_tessellation_shader_vertex_spacing vertex_spacing_mode, const float* inner_tess_levels, 167e5c31af7Sopenharmony_ci const float* outer_tess_levels, float irrelevant_tess_level, _test_descriptor& test); 168e5c31af7Sopenharmony_ci 169e5c31af7Sopenharmony_ci void runForAllTestResults(PFNTESTRESULTPROCESSORPROC pProcessTestResult); 170e5c31af7Sopenharmony_ci 171e5c31af7Sopenharmony_ci static void checkFirstOuterTessellationLevelEffect(_test_result& test_result, 172e5c31af7Sopenharmony_ci const glw::GLenum glMaxTessGenLevelToken); 173e5c31af7Sopenharmony_ci 174e5c31af7Sopenharmony_ci void checkIrrelevantTessellationLevelsHaveNoEffect(); 175e5c31af7Sopenharmony_ci 176e5c31af7Sopenharmony_ci static void checkNoLineSegmentIsDefinedAtHeightOne(_test_result& test_result, const glw::GLenum unused); 177e5c31af7Sopenharmony_ci 178e5c31af7Sopenharmony_ci static void checkSecondOuterTessellationLevelEffect(_test_result& test_result, 179e5c31af7Sopenharmony_ci const glw::GLenum glMaxTessGenLevelToken); 180e5c31af7Sopenharmony_ci 181e5c31af7Sopenharmony_ci void checkVertexSpacingDoesNotAffectAmountOfGeneratedIsolines(); 182e5c31af7Sopenharmony_ci 183e5c31af7Sopenharmony_ci /* Private variables */ 184e5c31af7Sopenharmony_ci float m_irrelevant_tess_value_1; 185e5c31af7Sopenharmony_ci float m_irrelevant_tess_value_2; 186e5c31af7Sopenharmony_ci 187e5c31af7Sopenharmony_ci _test_results_per_vertex_spacing_map m_test_results; 188e5c31af7Sopenharmony_ci _tests_per_vertex_spacing_map m_tests; 189e5c31af7Sopenharmony_ci TessellationShaderUtils* m_utils_ptr; 190e5c31af7Sopenharmony_ci glw::GLuint m_vao_id; 191e5c31af7Sopenharmony_ci}; 192e5c31af7Sopenharmony_ci 193e5c31af7Sopenharmony_ci} // namespace glcts 194e5c31af7Sopenharmony_ci 195e5c31af7Sopenharmony_ci#endif // _ESEXTCTESSELLATIONSHADERISOLINES_HPP 196