1 #ifndef _GL4CSHADERDRAWPARAMETERSTESTS_HPP 2 #define _GL4CSHADERDRAWPARAMETERSTESTS_HPP 3 /*------------------------------------------------------------------------- 4 * OpenGL Conformance Test Suite 5 * ----------------------------- 6 * 7 * Copyright (c) 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 */ /*! 28 * \file gl4cShaderDrawParametersTests.hpp 29 * \brief Conformance tests for the GL_ARB_shader_draw_parameters functionality. 30 */ /*-------------------------------------------------------------------*/ 31 #include "glcTestCase.hpp" 32 #include "glwDefs.hpp" 33 #include "tcuDefs.hpp" 34 35 using namespace glw; 36 using namespace glu; 37 38 namespace gl4cts 39 { 40 41 typedef struct 42 { 43 GLuint count; 44 GLuint instanceCount; 45 GLuint first; 46 GLuint baseInstance; 47 } SDPDrawArraysIndirectCommand; 48 49 typedef struct 50 { 51 GLuint count; 52 GLuint instanceCount; 53 GLuint firstIndex; 54 GLuint baseVertex; 55 GLuint baseInstance; 56 } SDPDrawElementsIndirectCommand; 57 58 struct ResultPoint 59 { 60 GLfloat x; 61 GLfloat y; 62 GLfloat red; 63 GLfloat green; 64 GLfloat blue; 65 ResultPointgl4cts::ResultPoint66 ResultPoint(GLfloat _x, GLfloat _y, GLfloat _red, GLfloat _green, GLfloat _blue) 67 : x(_x), y(_y), red(_red), green(_green), blue(_blue) 68 { 69 // Left blank 70 } 71 }; 72 73 /** Test verifies if extension is available for GLSL 74 **/ 75 class ShaderDrawParametersExtensionTestCase : public deqp::TestCase 76 { 77 public: 78 /* Public methods */ 79 ShaderDrawParametersExtensionTestCase(deqp::Context& context); 80 81 tcu::TestNode::IterateResult iterate(); 82 83 private: 84 /* Private members */ 85 }; 86 87 /** This is base class for drawing commands tests 88 **/ 89 class ShaderDrawParametersTestBase : public deqp::TestCase 90 { 91 public: 92 /* Public methods */ 93 ShaderDrawParametersTestBase(deqp::Context& context, const char* name, const char* description); 94 95 virtual void init(); 96 virtual void deinit(); 97 tcu::TestNode::IterateResult iterate(); 98 99 private: 100 /* Private methods */ 101 bool draw(); 102 bool verify(); 103 104 protected: 105 /* Protected members */ 106 GLuint m_vao; 107 GLuint m_arrayBuffer; 108 GLuint m_elementBuffer; 109 GLuint m_drawIndirectBuffer; 110 GLuint m_parameterBuffer; 111 112 std::vector<ResultPoint> m_resultPoints; 113 114 /* Protected methods */ 115 virtual void initChild(); 116 virtual void deinitChild(); 117 virtual void drawCommand(); 118 }; 119 120 class ShaderDrawArraysParametersTestCase : public ShaderDrawParametersTestBase 121 { 122 public: 123 /* Public methods */ ShaderDrawArraysParametersTestCase(deqp::Context & context)124 ShaderDrawArraysParametersTestCase(deqp::Context& context) 125 : ShaderDrawParametersTestBase(context, "ShaderDrawArraysParameters", 126 "Verifies shader draw parameters with DrawArrays command") 127 { 128 } 129 130 private: 131 /* Private methods */ 132 virtual void initChild(); 133 virtual void deinitChild(); 134 virtual void drawCommand(); 135 }; 136 137 class ShaderDrawElementsParametersTestCase : public ShaderDrawParametersTestBase 138 { 139 public: 140 /* Public methods */ ShaderDrawElementsParametersTestCase(deqp::Context & context)141 ShaderDrawElementsParametersTestCase(deqp::Context& context) 142 : ShaderDrawParametersTestBase(context, "ShaderDrawElementsParameters", 143 "Verifies shader draw parameters with DrawElements command") 144 { 145 } 146 147 private: 148 /* Private methods */ 149 virtual void initChild(); 150 virtual void deinitChild(); 151 virtual void drawCommand(); 152 }; 153 154 class ShaderDrawArraysIndirectParametersTestCase : public ShaderDrawParametersTestBase 155 { 156 public: 157 /* Public methods */ ShaderDrawArraysIndirectParametersTestCase(deqp::Context & context)158 ShaderDrawArraysIndirectParametersTestCase(deqp::Context& context) 159 : ShaderDrawParametersTestBase(context, "ShaderDrawArraysIndirectParameters", 160 "Verifies shader draw parameters with DrawArraysIndirect command") 161 { 162 } 163 164 private: 165 /* Private methods */ 166 virtual void initChild(); 167 virtual void deinitChild(); 168 virtual void drawCommand(); 169 }; 170 171 class ShaderDrawElementsIndirectParametersTestCase : public ShaderDrawParametersTestBase 172 { 173 public: 174 /* Public methods */ ShaderDrawElementsIndirectParametersTestCase(deqp::Context & context)175 ShaderDrawElementsIndirectParametersTestCase(deqp::Context& context) 176 : ShaderDrawParametersTestBase(context, "ShaderDrawElementsIndirectParameters", 177 "Verifies shader draw parameters with DrawElementsIndirect command") 178 { 179 } 180 181 private: 182 /* Private methods */ 183 virtual void initChild(); 184 virtual void deinitChild(); 185 virtual void drawCommand(); 186 }; 187 188 class ShaderDrawArraysInstancedParametersTestCase : public ShaderDrawParametersTestBase 189 { 190 public: 191 /* Public methods */ ShaderDrawArraysInstancedParametersTestCase(deqp::Context & context)192 ShaderDrawArraysInstancedParametersTestCase(deqp::Context& context) 193 : ShaderDrawParametersTestBase(context, "ShaderDrawArraysInstancedParameters", 194 "Verifies shader draw parameters with DrawArraysInstanced command") 195 { 196 } 197 198 private: 199 /* Private methods */ 200 virtual void initChild(); 201 virtual void deinitChild(); 202 virtual void drawCommand(); 203 }; 204 205 class ShaderDrawElementsInstancedParametersTestCase : public ShaderDrawParametersTestBase 206 { 207 public: 208 /* Public methods */ ShaderDrawElementsInstancedParametersTestCase(deqp::Context & context)209 ShaderDrawElementsInstancedParametersTestCase(deqp::Context& context) 210 : ShaderDrawParametersTestBase(context, "ShaderDrawElementsInstancedParameters", 211 "Verifies shader draw parameters with DrawElementsInstanced command") 212 { 213 } 214 215 private: 216 /* Private methods */ 217 virtual void initChild(); 218 virtual void deinitChild(); 219 virtual void drawCommand(); 220 }; 221 222 class ShaderMultiDrawArraysParametersTestCase : public ShaderDrawParametersTestBase 223 { 224 public: 225 /* Public methods */ ShaderMultiDrawArraysParametersTestCase(deqp::Context & context)226 ShaderMultiDrawArraysParametersTestCase(deqp::Context& context) 227 : ShaderDrawParametersTestBase(context, "ShaderMultiDrawArraysParameters", 228 "Verifies shader draw parameters with MultiDrawArrays command") 229 { 230 } 231 232 private: 233 /* Private methods */ 234 virtual void initChild(); 235 virtual void deinitChild(); 236 virtual void drawCommand(); 237 }; 238 239 class ShaderMultiDrawElementsParametersTestCase : public ShaderDrawParametersTestBase 240 { 241 public: 242 /* Public methods */ ShaderMultiDrawElementsParametersTestCase(deqp::Context & context)243 ShaderMultiDrawElementsParametersTestCase(deqp::Context& context) 244 : ShaderDrawParametersTestBase(context, "ShaderMultiDrawElementsParameters", 245 "Verifies shader draw parameters with MultiDrawElements command") 246 { 247 } 248 249 private: 250 /* Private methods */ 251 virtual void initChild(); 252 virtual void deinitChild(); 253 virtual void drawCommand(); 254 }; 255 256 class ShaderMultiDrawArraysIndirectParametersTestCase : public ShaderDrawParametersTestBase 257 { 258 public: 259 /* Public methods */ ShaderMultiDrawArraysIndirectParametersTestCase(deqp::Context & context)260 ShaderMultiDrawArraysIndirectParametersTestCase(deqp::Context& context) 261 : ShaderDrawParametersTestBase(context, "ShaderMultiDrawArraysIndirectParameters", 262 "Verifies shader draw parameters with MultiDrawArraysIndirect command") 263 { 264 } 265 266 private: 267 /* Private methods */ 268 virtual void initChild(); 269 virtual void deinitChild(); 270 virtual void drawCommand(); 271 }; 272 273 class ShaderMultiDrawElementsIndirectParametersTestCase : public ShaderDrawParametersTestBase 274 { 275 public: 276 /* Public methods */ ShaderMultiDrawElementsIndirectParametersTestCase(deqp::Context & context)277 ShaderMultiDrawElementsIndirectParametersTestCase(deqp::Context& context) 278 : ShaderDrawParametersTestBase(context, "ShaderMultiDrawElementsIndirectParameters", 279 "Verifies shader draw parameters with MultiDrawElementsIndirect command") 280 { 281 } 282 283 private: 284 /* Private methods */ 285 virtual void initChild(); 286 virtual void deinitChild(); 287 virtual void drawCommand(); 288 }; 289 290 class ShaderMultiDrawArraysIndirectCountParametersTestCase : public ShaderDrawParametersTestBase 291 { 292 public: 293 /* Public methods */ ShaderMultiDrawArraysIndirectCountParametersTestCase(deqp::Context & context)294 ShaderMultiDrawArraysIndirectCountParametersTestCase(deqp::Context& context) 295 : ShaderDrawParametersTestBase(context, "MultiDrawArraysIndirectCountParameters", 296 "Verifies shader draw parameters with MultiDrawArraysIndirectCount command") 297 { 298 } 299 300 private: 301 /* Private methods */ 302 virtual void initChild(); 303 virtual void deinitChild(); 304 virtual void drawCommand(); 305 }; 306 307 class ShaderMultiDrawElementsIndirectCountParametersTestCase : public ShaderDrawParametersTestBase 308 { 309 public: 310 /* Public methods */ ShaderMultiDrawElementsIndirectCountParametersTestCase(deqp::Context & context)311 ShaderMultiDrawElementsIndirectCountParametersTestCase(deqp::Context& context) 312 : ShaderDrawParametersTestBase(context, "MultiDrawElementIndirectCountParameters", 313 "Verifies shader draw parameters with MultiDrawElementIndirectCount command") 314 { 315 } 316 317 private: 318 /* Private methods */ 319 virtual void initChild(); 320 virtual void deinitChild(); 321 virtual void drawCommand(); 322 }; 323 324 /** Test group which encapsulates all sparse buffer conformance tests */ 325 class ShaderDrawParametersTests : public deqp::TestCaseGroup 326 { 327 public: 328 /* Public methods */ 329 ShaderDrawParametersTests(deqp::Context& context); 330 331 void init(); 332 333 private: 334 ShaderDrawParametersTests(const ShaderDrawParametersTests& other); 335 ShaderDrawParametersTests& operator=(const ShaderDrawParametersTests& other); 336 }; 337 338 } /* gl4cts namespace */ 339 340 #endif // _GL4CSHADERDRAWPARAMETERSTESTS_HPP 341