1 #ifndef _GLCPOLYGONOFFSETCLAMPTESTS_HPP 2 #define _GLCPOLYGONOFFSETCLAMPTESTS_HPP 3 /*------------------------------------------------------------------------- 4 * OpenGL Conformance Test Suite 5 * ----------------------------- 6 * 7 * Copyright (c) 2017 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 glcPolygonOffsetClampTests.hpp 23 * \brief Conformance tests for the EXT_polygon_offset_clamp functionality. 24 */ /*-------------------------------------------------------------------*/ 25 26 #include "esextcTestCaseBase.hpp" 27 #include "glcTestCase.hpp" 28 #include "gluShaderProgram.hpp" 29 30 #include <string> 31 32 using namespace glw; 33 34 namespace glcts 35 { 36 37 struct PolygonOffsetClampValues 38 { 39 GLfloat factor; 40 GLfloat units; 41 GLfloat clamp; 42 PolygonOffsetClampValuesglcts::PolygonOffsetClampValues43 PolygonOffsetClampValues(GLfloat _f, GLfloat _u, GLfloat _c) : factor(_f), units(_u), clamp(_c) 44 { 45 } 46 }; 47 48 /** Tests base class 49 **/ 50 class PolygonOffsetClampTestCaseBase : public deqp::TestCase 51 { 52 public: 53 /* Public methods */ 54 PolygonOffsetClampTestCaseBase(deqp::Context& context, const char* name, const char* description); 55 56 virtual tcu::TestNode::IterateResult iterate(); 57 58 protected: 59 /* Protected methods */ 60 virtual void test(const glw::Functions& gl) = DE_NULL; 61 62 /* Protected members */ 63 bool m_extensionSupported; 64 }; 65 66 /** Test verifies if polygon offset clamp works as expected for non-zero, finite clamp values 67 **/ 68 class PolygonOffsetClampAvailabilityTestCase : public PolygonOffsetClampTestCaseBase 69 { 70 public: 71 /* Public methods */ 72 PolygonOffsetClampAvailabilityTestCase(deqp::Context& context); 73 74 protected: 75 /* Protected methods */ 76 void test(const glw::Functions& gl); 77 }; 78 79 /** Base class for polygon offset clamp depth values verifying 80 **/ 81 class PolygonOffsetClampValueTestCaseBase : public PolygonOffsetClampTestCaseBase 82 { 83 public: 84 /* Public methods */ 85 PolygonOffsetClampValueTestCaseBase(deqp::Context& context, const char* name, const char* description); 86 87 virtual void init(); 88 virtual void deinit(); 89 90 protected: 91 /* Protected members */ 92 GLuint m_fbo; 93 GLuint m_depthBuf; 94 GLuint m_colorBuf; 95 GLuint m_fboReadback; 96 GLuint m_colorBufReadback; 97 98 std::vector<PolygonOffsetClampValues> m_testValues; 99 100 /* Protected methods */ 101 void test(const glw::Functions& gl); 102 103 float readDepthValue(const glw::Functions& gl, const GLuint readDepthProgramId); 104 105 virtual bool verify(GLuint caseNo, GLfloat depth, GLfloat offsetDepth, GLfloat offsetClampDepth) = DE_NULL; 106 }; 107 108 /** Test verifies if polygon offset clamp works as expected for zero and infinite clamp values 109 **/ 110 class PolygonOffsetClampMinMaxTestCase : public PolygonOffsetClampValueTestCaseBase 111 { 112 public: 113 /* Public methods */ 114 PolygonOffsetClampMinMaxTestCase(deqp::Context& context); 115 116 void init(); 117 118 protected: 119 /* Protected methods */ 120 bool verify(GLuint caseNo, GLfloat depth, GLfloat offsetDepth, GLfloat offsetClampDepth); 121 }; 122 123 /** Test verifies if polygon offset clamp works as expected for zero and infinite clamp values 124 **/ 125 class PolygonOffsetClampZeroInfinityTestCase : public PolygonOffsetClampValueTestCaseBase 126 { 127 public: 128 /* Public methods */ 129 PolygonOffsetClampZeroInfinityTestCase(deqp::Context& context); 130 131 void init(); 132 133 protected: 134 /* Protected methods */ 135 bool verify(GLuint caseNo, GLfloat depth, GLfloat offsetDepth, GLfloat offsetClampDepth); 136 }; 137 138 /** Test group which encapsulates all ARB_shader_group_vote conformance tests */ 139 class PolygonOffsetClamp : public deqp::TestCaseGroup 140 { 141 public: 142 /* Public methods */ 143 PolygonOffsetClamp(deqp::Context& context); 144 145 void init(); 146 147 private: 148 PolygonOffsetClamp(const PolygonOffsetClamp& other); 149 }; 150 151 } /* glcts namespace */ 152 153 #endif // _GLCPOLYGONOFFSETCLAMPTESTS_HPP 154