#ifndef _ESEXTCTESSELLATIONSHADERVERTEXORDERING_HPP #define _ESEXTCTESSELLATIONSHADERVERTEXORDERING_HPP /*------------------------------------------------------------------------- * OpenGL Conformance Test Suite * ----------------------------- * * Copyright (c) 2014-2016 The Khronos Group Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ /*! * \file * \brief */ /*-------------------------------------------------------------------*/ #include "../esextcTestCaseBase.hpp" #include "esextcTessellationShaderUtils.hpp" #include "gluShaderUtil.hpp" #include "tcuDefs.hpp" namespace glcts { /** Implementation of Test Case 26 * * Make sure that vertex ordering mode defined in a tessellation evaluation * shader affects geometry generated by tessellation primitive generator and * works as per extension specification (to the limit enforced by implementation- * -dependent behaviour). * Cover 'triangles' and 'quads' tessellation primitive generator modes. * Make sure that points are unaffected by the vertex ordering mode. * Make sure that by default counter-clockwise ordering is used. * Note: This is based on 3.6.1 from ES spec 3.0.2 (p.102) * * Technical details: * * 0. Consider the following set: {-1 (where valid), 1, MAX_TESS_GEN_LEVEL_EXT / 2, * MAX_TESS_GEN_LEVEL_EXT}. All combinations of values from this set * in regard to relevant inner/outer tessellation levels for all * primitive generator modes should be checked by this test. * * 1. For cases where clock-wise ordering is expected, make sure that: * * 1/2 * sum(i=0..n-1)(x_i*y_(i@1) - x_(i@1)*y_i) < 0 * * where: n is number of vertices making up a single primitive, * @ is an operator defined as x@y=(x+y)%n; * * For cases where counterclock-wise ordering is expected, the value * should be positive. * **/ class TessellationShaderVertexOrdering : public TestCaseBase { public: /* Public methods */ TessellationShaderVertexOrdering(Context& context, const ExtParameters& extParams); virtual ~TessellationShaderVertexOrdering(void) { } virtual void deinit(void); void initTest(void); virtual IterateResult iterate(void); private: /* Private type definitions */ typedef struct _test_iteration { char* data; float inner_tess_levels[2]; bool is_point_mode_enabled; unsigned int n_vertices; float outer_tess_levels[4]; _tessellation_primitive_mode primitive_mode; _tessellation_shader_vertex_ordering vertex_ordering; _test_iteration() { memset(inner_tess_levels, 0, sizeof(inner_tess_levels)); memset(outer_tess_levels, 0, sizeof(outer_tess_levels)); data = DE_NULL; is_point_mode_enabled = false; n_vertices = 0; primitive_mode = TESSELLATION_SHADER_PRIMITIVE_MODE_UNKNOWN; vertex_ordering = TESSELLATION_SHADER_VERTEX_ORDERING_UNKNOWN; } } _test_iteration; typedef std::vector<_test_iteration> _test_iterations; typedef _test_iterations::const_iterator _test_iterations_const_iterator; /* Private methods */ void deinitTestIteration(_test_iteration& test_iteration); _test_iteration initTestIteration(const float* inner_tess_levels, const float* outer_tess_levels, _tessellation_primitive_mode primitive_mode, _tessellation_shader_vertex_ordering vertex_ordering, bool is_point_mode_enabled, TessellationShaderUtils* utils); void verifyVertexOrderingCorrectness(const _test_iteration& test_iteration); void verifyVertexOrderingDoesNotChangeGeneratedPoints(const _test_iteration& test_iteration_a, const _test_iteration& test_iteration_b); /* Private variables */ glw::GLuint m_bo_id; glw::GLuint m_fs_id; glw::GLuint m_tc_id; glw::GLuint m_vs_id; glw::GLuint m_vao_id; _test_iterations m_tests; _test_iterations m_tests_points; TessellationShaderUtils* m_utils; }; } // namespace glcts #endif // _ESEXTCTESSELLATIONSHADERVERTEXORDERING_HPP