1*35238bceSAndroid Build Coastguard Worker #ifndef _GL4CPIPELINESTATISTICSQUERYTESTS_HPP 2*35238bceSAndroid Build Coastguard Worker #define _GL4CPIPELINESTATISTICSQUERYTESTS_HPP 3*35238bceSAndroid Build Coastguard Worker /*------------------------------------------------------------------------- 4*35238bceSAndroid Build Coastguard Worker * OpenGL Conformance Test Suite 5*35238bceSAndroid Build Coastguard Worker * ----------------------------- 6*35238bceSAndroid Build Coastguard Worker * 7*35238bceSAndroid Build Coastguard Worker * Copyright (c) 2014-2016 The Khronos Group Inc. 8*35238bceSAndroid Build Coastguard Worker * 9*35238bceSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License"); 10*35238bceSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License. 11*35238bceSAndroid Build Coastguard Worker * You may obtain a copy of the License at 12*35238bceSAndroid Build Coastguard Worker * 13*35238bceSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0 14*35238bceSAndroid Build Coastguard Worker * 15*35238bceSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software 16*35238bceSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS, 17*35238bceSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18*35238bceSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and 19*35238bceSAndroid Build Coastguard Worker * limitations under the License. 20*35238bceSAndroid Build Coastguard Worker * 21*35238bceSAndroid Build Coastguard Worker */ /*! 22*35238bceSAndroid Build Coastguard Worker * \file 23*35238bceSAndroid Build Coastguard Worker * \brief 24*35238bceSAndroid Build Coastguard Worker */ /*-------------------------------------------------------------------*/ 25*35238bceSAndroid Build Coastguard Worker 26*35238bceSAndroid Build Coastguard Worker /** 27*35238bceSAndroid Build Coastguard Worker */ /*! 28*35238bceSAndroid Build Coastguard Worker * \file gl4c PipelineStatisticsQueryTests.hpp 29*35238bceSAndroid Build Coastguard Worker * \brief Declares test classes that verify conformance of the 30*35238bceSAndroid Build Coastguard Worker * GL implementation with GL_ARB_pipeline_statistics_query 31*35238bceSAndroid Build Coastguard Worker * extension specification. 32*35238bceSAndroid Build Coastguard Worker */ /*-------------------------------------------------------------------*/ 33*35238bceSAndroid Build Coastguard Worker 34*35238bceSAndroid Build Coastguard Worker #include "glcTestCase.hpp" 35*35238bceSAndroid Build Coastguard Worker #include "glwDefs.hpp" 36*35238bceSAndroid Build Coastguard Worker #include "tcuDefs.hpp" 37*35238bceSAndroid Build Coastguard Worker #include <limits.h> 38*35238bceSAndroid Build Coastguard Worker #include <sstream> 39*35238bceSAndroid Build Coastguard Worker #include <string.h> 40*35238bceSAndroid Build Coastguard Worker 41*35238bceSAndroid Build Coastguard Worker namespace glcts 42*35238bceSAndroid Build Coastguard Worker { 43*35238bceSAndroid Build Coastguard Worker class PipelineStatisticsQueryUtilities 44*35238bceSAndroid Build Coastguard Worker { 45*35238bceSAndroid Build Coastguard Worker public: 46*35238bceSAndroid Build Coastguard Worker /* Public type definitions */ 47*35238bceSAndroid Build Coastguard Worker typedef bool (*PFNQUERYDRAWHANDLERPROC)(void *user_arg); 48*35238bceSAndroid Build Coastguard Worker 49*35238bceSAndroid Build Coastguard Worker /* Type of the draw call used for a test iteration */ 50*35238bceSAndroid Build Coastguard Worker enum _draw_call_type 51*35238bceSAndroid Build Coastguard Worker { 52*35238bceSAndroid Build Coastguard Worker /* glDrawArrays() */ 53*35238bceSAndroid Build Coastguard Worker DRAW_CALL_TYPE_GLDRAWARRAYS, 54*35238bceSAndroid Build Coastguard Worker /* glDrawArraysIndirect() */ 55*35238bceSAndroid Build Coastguard Worker DRAW_CALL_TYPE_GLDRAWARRAYSINDIRECT, 56*35238bceSAndroid Build Coastguard Worker /* glDrawArraysInstanced() */ 57*35238bceSAndroid Build Coastguard Worker DRAW_CALL_TYPE_GLDRAWARRAYSINSTANCED, 58*35238bceSAndroid Build Coastguard Worker /* glDrawArraysInstancedBaseInstance() */ 59*35238bceSAndroid Build Coastguard Worker DRAW_CALL_TYPE_GLDRAWARRAYSINSTANCEDBASEINSTANCE, 60*35238bceSAndroid Build Coastguard Worker /* glDrawElements() */ 61*35238bceSAndroid Build Coastguard Worker DRAW_CALL_TYPE_GLDRAWELEMENTS, 62*35238bceSAndroid Build Coastguard Worker /* glDrawElementsBaseVertex() */ 63*35238bceSAndroid Build Coastguard Worker DRAW_CALL_TYPE_GLDRAWELEMENTSBASEVERTEX, 64*35238bceSAndroid Build Coastguard Worker /* glDrawElementsIndirect() */ 65*35238bceSAndroid Build Coastguard Worker DRAW_CALL_TYPE_GLDRAWELEMENTSINDIRECT, 66*35238bceSAndroid Build Coastguard Worker /* glDrawElementsInstanced() */ 67*35238bceSAndroid Build Coastguard Worker DRAW_CALL_TYPE_GLDRAWELEMENTSINSTANCED, 68*35238bceSAndroid Build Coastguard Worker /* glDrawElementsInstancedBaseInstance() */ 69*35238bceSAndroid Build Coastguard Worker DRAW_CALL_TYPE_GLDRAWELEMENTSINSTANCEDBASEINSTANCE, 70*35238bceSAndroid Build Coastguard Worker /* glDrawElementsInstancedBaseVertexBaseInstance() */ 71*35238bceSAndroid Build Coastguard Worker DRAW_CALL_TYPE_GLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCE, 72*35238bceSAndroid Build Coastguard Worker /* glDrawRangeElements() */ 73*35238bceSAndroid Build Coastguard Worker DRAW_CALL_TYPE_GLDRAWRANGEELEMENTS, 74*35238bceSAndroid Build Coastguard Worker /* glDrawRangeElementsBaseVertex() */ 75*35238bceSAndroid Build Coastguard Worker DRAW_CALL_TYPE_GLDRAWRANGEELEMENTSBASEVERTEX, 76*35238bceSAndroid Build Coastguard Worker 77*35238bceSAndroid Build Coastguard Worker /* Always last */ 78*35238bceSAndroid Build Coastguard Worker DRAW_CALL_TYPE_COUNT 79*35238bceSAndroid Build Coastguard Worker }; 80*35238bceSAndroid Build Coastguard Worker 81*35238bceSAndroid Build Coastguard Worker /* Input primitive type defined in geometry shader body used by a test iteration */ 82*35238bceSAndroid Build Coastguard Worker enum _geometry_shader_input 83*35238bceSAndroid Build Coastguard Worker { 84*35238bceSAndroid Build Coastguard Worker GEOMETRY_SHADER_INPUT_FIRST, 85*35238bceSAndroid Build Coastguard Worker 86*35238bceSAndroid Build Coastguard Worker GEOMETRY_SHADER_INPUT_POINTS = GEOMETRY_SHADER_INPUT_FIRST, 87*35238bceSAndroid Build Coastguard Worker GEOMETRY_SHADER_INPUT_LINES, 88*35238bceSAndroid Build Coastguard Worker GEOMETRY_SHADER_INPUT_LINES_ADJACENCY, 89*35238bceSAndroid Build Coastguard Worker GEOMETRY_SHADER_INPUT_TRIANGLES, 90*35238bceSAndroid Build Coastguard Worker GEOMETRY_SHADER_INPUT_TRIANGLES_ADJACENCY, 91*35238bceSAndroid Build Coastguard Worker 92*35238bceSAndroid Build Coastguard Worker /* Always last */ 93*35238bceSAndroid Build Coastguard Worker GEOMETRY_SHADER_INPUT_COUNT 94*35238bceSAndroid Build Coastguard Worker }; 95*35238bceSAndroid Build Coastguard Worker 96*35238bceSAndroid Build Coastguard Worker /* Output primitive type defined in geometry shader body used by a test iteration */ 97*35238bceSAndroid Build Coastguard Worker enum _geometry_shader_output 98*35238bceSAndroid Build Coastguard Worker { 99*35238bceSAndroid Build Coastguard Worker GEOMETRY_SHADER_OUTPUT_FIRST, 100*35238bceSAndroid Build Coastguard Worker 101*35238bceSAndroid Build Coastguard Worker GEOMETRY_SHADER_OUTPUT_POINTS = GEOMETRY_SHADER_OUTPUT_FIRST, 102*35238bceSAndroid Build Coastguard Worker GEOMETRY_SHADER_OUTPUT_LINE_STRIP, 103*35238bceSAndroid Build Coastguard Worker GEOMETRY_SHADER_OUTPUT_TRIANGLE_STRIP, 104*35238bceSAndroid Build Coastguard Worker 105*35238bceSAndroid Build Coastguard Worker /* Always last */ 106*35238bceSAndroid Build Coastguard Worker GEOMETRY_SHADER_OUTPUT_COUNT 107*35238bceSAndroid Build Coastguard Worker }; 108*35238bceSAndroid Build Coastguard Worker 109*35238bceSAndroid Build Coastguard Worker /* Primitive type used for a draw call */ 110*35238bceSAndroid Build Coastguard Worker enum _primitive_type 111*35238bceSAndroid Build Coastguard Worker { 112*35238bceSAndroid Build Coastguard Worker PRIMITIVE_TYPE_FIRST, 113*35238bceSAndroid Build Coastguard Worker 114*35238bceSAndroid Build Coastguard Worker /* GL_POINTS */ 115*35238bceSAndroid Build Coastguard Worker PRIMITIVE_TYPE_POINTS = PRIMITIVE_TYPE_FIRST, 116*35238bceSAndroid Build Coastguard Worker /* GL_LINE_LOOP */ 117*35238bceSAndroid Build Coastguard Worker PRIMITIVE_TYPE_LINE_LOOP, 118*35238bceSAndroid Build Coastguard Worker /* GL_LINE_STRIP */ 119*35238bceSAndroid Build Coastguard Worker PRIMITIVE_TYPE_LINE_STRIP, 120*35238bceSAndroid Build Coastguard Worker /* GL_LINES */ 121*35238bceSAndroid Build Coastguard Worker PRIMITIVE_TYPE_LINES, 122*35238bceSAndroid Build Coastguard Worker /* GL_LINES_ADJACENCY */ 123*35238bceSAndroid Build Coastguard Worker PRIMITIVE_TYPE_LINES_ADJACENCY, 124*35238bceSAndroid Build Coastguard Worker /* GL_PATCHES */ 125*35238bceSAndroid Build Coastguard Worker PRIMITIVE_TYPE_PATCHES, 126*35238bceSAndroid Build Coastguard Worker /* GL_TRIANGLE_FAN */ 127*35238bceSAndroid Build Coastguard Worker PRIMITIVE_TYPE_TRIANGLE_FAN, 128*35238bceSAndroid Build Coastguard Worker /* GL_TRIANGLE_STRIP */ 129*35238bceSAndroid Build Coastguard Worker PRIMITIVE_TYPE_TRIANGLE_STRIP, 130*35238bceSAndroid Build Coastguard Worker /* GL_TRIANGLES */ 131*35238bceSAndroid Build Coastguard Worker PRIMITIVE_TYPE_TRIANGLES, 132*35238bceSAndroid Build Coastguard Worker /* GL_TRIANGLES_ADJACENCY */ 133*35238bceSAndroid Build Coastguard Worker PRIMITIVE_TYPE_TRIANGLES_ADJACENCY, 134*35238bceSAndroid Build Coastguard Worker 135*35238bceSAndroid Build Coastguard Worker /* Always last */ 136*35238bceSAndroid Build Coastguard Worker PRIMITIVE_TYPE_COUNT 137*35238bceSAndroid Build Coastguard Worker }; 138*35238bceSAndroid Build Coastguard Worker 139*35238bceSAndroid Build Coastguard Worker /* Stores result of a single test iteration. */ 140*35238bceSAndroid Build Coastguard Worker struct _test_execution_result 141*35238bceSAndroid Build Coastguard Worker { 142*35238bceSAndroid Build Coastguard Worker /* true if 64-bit signed integer counter value was retrieved for the iteration, 143*35238bceSAndroid Build Coastguard Worker * false otherwise. 144*35238bceSAndroid Build Coastguard Worker */ 145*35238bceSAndroid Build Coastguard Worker bool int64_written; 146*35238bceSAndroid Build Coastguard Worker /* true if 64-bit unsigned integer counter value was retrieved for the iteration, 147*35238bceSAndroid Build Coastguard Worker * false otherwise. 148*35238bceSAndroid Build Coastguard Worker */ 149*35238bceSAndroid Build Coastguard Worker bool uint64_written; 150*35238bceSAndroid Build Coastguard Worker 151*35238bceSAndroid Build Coastguard Worker /* 32-bit signed integer counter value, as stored in the query buffer object 152*35238bceSAndroid Build Coastguard Worker * used for the test iteration. This variable will only be modified if query 153*35238bceSAndroid Build Coastguard Worker * buffer objects are supported. 154*35238bceSAndroid Build Coastguard Worker */ 155*35238bceSAndroid Build Coastguard Worker glw::GLint result_qo_int; 156*35238bceSAndroid Build Coastguard Worker /* 64-bit signed integer counter value, as stored in the query buffer object 157*35238bceSAndroid Build Coastguard Worker * used for the test iteration. This variable will only be modified if query 158*35238bceSAndroid Build Coastguard Worker * buffer objects are supported, and int64_written is true. 159*35238bceSAndroid Build Coastguard Worker */ 160*35238bceSAndroid Build Coastguard Worker glw::GLint64 result_qo_int64; 161*35238bceSAndroid Build Coastguard Worker /* 32-bit unsigned integer counter value, as stored in the query buffer object 162*35238bceSAndroid Build Coastguard Worker * used for the test iteration. This variable will only be modified if query 163*35238bceSAndroid Build Coastguard Worker * buffer objects are supported. 164*35238bceSAndroid Build Coastguard Worker */ 165*35238bceSAndroid Build Coastguard Worker glw::GLuint result_qo_uint; 166*35238bceSAndroid Build Coastguard Worker /* 64-bit unsigned integer counter value, as stored in the query buffer object 167*35238bceSAndroid Build Coastguard Worker * used for the test iteration. This variable will only be modified if query 168*35238bceSAndroid Build Coastguard Worker * buffer objects are supported, and uint64_written is true. 169*35238bceSAndroid Build Coastguard Worker */ 170*35238bceSAndroid Build Coastguard Worker glw::GLuint64 result_qo_uint64; 171*35238bceSAndroid Build Coastguard Worker 172*35238bceSAndroid Build Coastguard Worker /* 32-bit signed integer counter value, as stored in the query object 173*35238bceSAndroid Build Coastguard Worker * used for the test iteration. 174*35238bceSAndroid Build Coastguard Worker */ 175*35238bceSAndroid Build Coastguard Worker glw::GLint result_int; 176*35238bceSAndroid Build Coastguard Worker /* 64-bit signed integer counter value, as stored in the query object 177*35238bceSAndroid Build Coastguard Worker * used for the test iteration. Only set if int64_written is true. 178*35238bceSAndroid Build Coastguard Worker */ 179*35238bceSAndroid Build Coastguard Worker glw::GLint64 result_int64; 180*35238bceSAndroid Build Coastguard Worker /* 32-bit unsigned integer counter value, as stored in the query object 181*35238bceSAndroid Build Coastguard Worker * used for the test iteration. 182*35238bceSAndroid Build Coastguard Worker */ 183*35238bceSAndroid Build Coastguard Worker glw::GLuint result_uint; 184*35238bceSAndroid Build Coastguard Worker /* 64-bit unsigned integer counter value, as stored in the query object 185*35238bceSAndroid Build Coastguard Worker * used for the test iteration. Only set if uint64_written is true. 186*35238bceSAndroid Build Coastguard Worker */ 187*35238bceSAndroid Build Coastguard Worker glw::GLuint64 result_uint64; 188*35238bceSAndroid Build Coastguard Worker 189*35238bceSAndroid Build Coastguard Worker /* Constructor */ _test_execution_resultglcts::PipelineStatisticsQueryUtilities::_test_execution_result190*35238bceSAndroid Build Coastguard Worker _test_execution_result() 191*35238bceSAndroid Build Coastguard Worker { 192*35238bceSAndroid Build Coastguard Worker result_qo_int = INT_MAX; 193*35238bceSAndroid Build Coastguard Worker result_qo_int64 = LLONG_MAX; 194*35238bceSAndroid Build Coastguard Worker result_qo_uint = UINT_MAX; 195*35238bceSAndroid Build Coastguard Worker result_qo_uint64 = ULLONG_MAX; 196*35238bceSAndroid Build Coastguard Worker 197*35238bceSAndroid Build Coastguard Worker result_int = INT_MAX; 198*35238bceSAndroid Build Coastguard Worker result_int64 = LLONG_MAX; 199*35238bceSAndroid Build Coastguard Worker result_uint = UINT_MAX; 200*35238bceSAndroid Build Coastguard Worker result_uint64 = ULLONG_MAX; 201*35238bceSAndroid Build Coastguard Worker 202*35238bceSAndroid Build Coastguard Worker int64_written = false; 203*35238bceSAndroid Build Coastguard Worker uint64_written = false; 204*35238bceSAndroid Build Coastguard Worker } 205*35238bceSAndroid Build Coastguard Worker }; 206*35238bceSAndroid Build Coastguard Worker 207*35238bceSAndroid Build Coastguard Worker /* Tells how the result values should be verified against 208*35238bceSAndroid Build Coastguard Worker * the reference value. 209*35238bceSAndroid Build Coastguard Worker */ 210*35238bceSAndroid Build Coastguard Worker enum _verification_type 211*35238bceSAndroid Build Coastguard Worker { 212*35238bceSAndroid Build Coastguard Worker /* The result value should be equal to the reference value */ 213*35238bceSAndroid Build Coastguard Worker VERIFICATION_TYPE_EXACT_MATCH, 214*35238bceSAndroid Build Coastguard Worker /* The result value should be equal or larger than the reference value */ 215*35238bceSAndroid Build Coastguard Worker VERIFICATION_TYPE_EQUAL_OR_GREATER, 216*35238bceSAndroid Build Coastguard Worker 217*35238bceSAndroid Build Coastguard Worker VERIFICATION_TYPE_UNDEFINED 218*35238bceSAndroid Build Coastguard Worker }; 219*35238bceSAndroid Build Coastguard Worker 220*35238bceSAndroid Build Coastguard Worker /* Code of a compute shader used by a functional test that verifies 221*35238bceSAndroid Build Coastguard Worker * GL_COMPUTE_SHADER_INVOCATIONS_ARB query works correctly. 222*35238bceSAndroid Build Coastguard Worker */ 223*35238bceSAndroid Build Coastguard Worker static const char *minimal_cs_code; 224*35238bceSAndroid Build Coastguard Worker static const char *minimal_cs_code_arb; 225*35238bceSAndroid Build Coastguard Worker /* Code of a fragment shader used by a number of functional tests */ 226*35238bceSAndroid Build Coastguard Worker static const char *minimal_fs_code; 227*35238bceSAndroid Build Coastguard Worker /* Code of a tessellation control shader used by a functional test that verifies 228*35238bceSAndroid Build Coastguard Worker * GL_TESS_CONTROL_SHADER_PATCHES_ARB and GL_TESS_EVALUATION_SHADER_INVOCATIONS_ARB 229*35238bceSAndroid Build Coastguard Worker * queries work correctly. 230*35238bceSAndroid Build Coastguard Worker */ 231*35238bceSAndroid Build Coastguard Worker static const char *minimal_tc_code; 232*35238bceSAndroid Build Coastguard Worker /* Code of a tessellation evaluation shader used by a functional test that verifies 233*35238bceSAndroid Build Coastguard Worker * GL_TESS_CONTROL_SHADER_PATCHES_ARB and GL_TESS_EVALUATION_SHADER_INVOCATIONS_ARB 234*35238bceSAndroid Build Coastguard Worker * queries work correctly. 235*35238bceSAndroid Build Coastguard Worker */ 236*35238bceSAndroid Build Coastguard Worker static const char *minimal_te_code; 237*35238bceSAndroid Build Coastguard Worker /* Code of a vertex shader used by a number of functional tests */ 238*35238bceSAndroid Build Coastguard Worker static const char *minimal_vs_code; 239*35238bceSAndroid Build Coastguard Worker 240*35238bceSAndroid Build Coastguard Worker /* Tells how many query targets are stored in query_targets */ 241*35238bceSAndroid Build Coastguard Worker static const unsigned int n_query_targets; 242*35238bceSAndroid Build Coastguard Worker /* Stores all query targets that should be used by the tests */ 243*35238bceSAndroid Build Coastguard Worker static const glw::GLenum query_targets[]; 244*35238bceSAndroid Build Coastguard Worker 245*35238bceSAndroid Build Coastguard Worker /* Tells the offset, relative to the beginning of the buffer object storage, 246*35238bceSAndroid Build Coastguard Worker * from which the query's int32 result value starts. */ 247*35238bceSAndroid Build Coastguard Worker static const unsigned int qo_bo_int_offset; 248*35238bceSAndroid Build Coastguard Worker /* Tells the offset, relative to the beginning of the buffer object storage, 249*35238bceSAndroid Build Coastguard Worker * from which the query's int64 result value starts. */ 250*35238bceSAndroid Build Coastguard Worker static const unsigned int qo_bo_int64_offset; 251*35238bceSAndroid Build Coastguard Worker /* Tells the offset, relative to the beginning of the buffer object storage, 252*35238bceSAndroid Build Coastguard Worker * from which the query's uint32 result value starts. */ 253*35238bceSAndroid Build Coastguard Worker static const unsigned int qo_bo_uint_offset; 254*35238bceSAndroid Build Coastguard Worker /* Tells the offset, relative to the beginning of the buffer object storage, 255*35238bceSAndroid Build Coastguard Worker * from which the query's uint64 result value starts. */ 256*35238bceSAndroid Build Coastguard Worker static const unsigned int qo_bo_uint64_offset; 257*35238bceSAndroid Build Coastguard Worker static const unsigned int qo_bo_size; 258*35238bceSAndroid Build Coastguard Worker 259*35238bceSAndroid Build Coastguard Worker /* Public methods */ 260*35238bceSAndroid Build Coastguard Worker static std::string buildGeometryShaderBody(_geometry_shader_input gs_input, _geometry_shader_output gs_output, 261*35238bceSAndroid Build Coastguard Worker unsigned int n_primitives_to_emit_in_stream0, unsigned int n_streams); 262*35238bceSAndroid Build Coastguard Worker 263*35238bceSAndroid Build Coastguard Worker static bool executeQuery(glw::GLenum query_type, glw::GLuint qo_id, glw::GLuint qo_bo_id, 264*35238bceSAndroid Build Coastguard Worker PFNQUERYDRAWHANDLERPROC pfn_draw, void *draw_user_arg, 265*35238bceSAndroid Build Coastguard Worker const glu::RenderContext &render_context, tcu::TestContext &test_context, 266*35238bceSAndroid Build Coastguard Worker const glu::ContextInfo &context_info, _test_execution_result *out_result, bool &skipped); 267*35238bceSAndroid Build Coastguard Worker 268*35238bceSAndroid Build Coastguard Worker static glw::GLenum getEnumForPrimitiveType(_primitive_type primitive_type); 269*35238bceSAndroid Build Coastguard Worker static std::string getGLSLStringForGSInput(_geometry_shader_input gs_input); 270*35238bceSAndroid Build Coastguard Worker static std::string getGLSLStringForGSOutput(_geometry_shader_output gs_output); 271*35238bceSAndroid Build Coastguard Worker static unsigned int getNumberOfVerticesForGSInput(_geometry_shader_input gs_input); 272*35238bceSAndroid Build Coastguard Worker static unsigned int getNumberOfVerticesForGSOutput(_geometry_shader_output gs_output); 273*35238bceSAndroid Build Coastguard Worker static unsigned int getNumberOfVerticesForPrimitiveType(_primitive_type primitive_type); 274*35238bceSAndroid Build Coastguard Worker static _primitive_type getPrimitiveTypeFromGSInput(_geometry_shader_input gs_input); 275*35238bceSAndroid Build Coastguard Worker static std::string getStringForDrawCallType(_draw_call_type draw_call_type); 276*35238bceSAndroid Build Coastguard Worker static std::string getStringForEnum(glw::GLenum value); 277*35238bceSAndroid Build Coastguard Worker static std::string getStringForPrimitiveType(_primitive_type primitive_type); 278*35238bceSAndroid Build Coastguard Worker 279*35238bceSAndroid Build Coastguard Worker static bool isDrawCallSupported(_draw_call_type draw_call, const glw::Functions &gl); 280*35238bceSAndroid Build Coastguard Worker 281*35238bceSAndroid Build Coastguard Worker static bool isInstancedDrawCall(_draw_call_type draw_call); 282*35238bceSAndroid Build Coastguard Worker 283*35238bceSAndroid Build Coastguard Worker static bool isQuerySupported(glw::GLenum value, const glu::ContextInfo &context_info, 284*35238bceSAndroid Build Coastguard Worker const glu::RenderContext &render_context); 285*35238bceSAndroid Build Coastguard Worker 286*35238bceSAndroid Build Coastguard Worker static bool verifyResultValues(const _test_execution_result &run_result, unsigned int n_expected_values, 287*35238bceSAndroid Build Coastguard Worker const glw::GLuint64 *expected_values, bool should_check_qo_bo_values, 288*35238bceSAndroid Build Coastguard Worker const glw::GLenum query_type, const _draw_call_type *draw_call_type_ptr, 289*35238bceSAndroid Build Coastguard Worker const _primitive_type *primitive_type_ptr, bool is_primitive_restart_enabled, 290*35238bceSAndroid Build Coastguard Worker tcu::TestContext &test_context, _verification_type verification_type); 291*35238bceSAndroid Build Coastguard Worker 292*35238bceSAndroid Build Coastguard Worker /** Constructs a string that describes details of a test iteration that has been 293*35238bceSAndroid Build Coastguard Worker * detected to have failed. 294*35238bceSAndroid Build Coastguard Worker * 295*35238bceSAndroid Build Coastguard Worker * @param value Query counter value as retrieved by the test iteration. 296*35238bceSAndroid Build Coastguard Worker * @param value_type Null-terminated string holding the name of the type 297*35238bceSAndroid Build Coastguard Worker * of the result value. 298*35238bceSAndroid Build Coastguard Worker * @param n_expected_values Number of possible expected values. 299*35238bceSAndroid Build Coastguard Worker * @param expected_values Array of possible expected values. 300*35238bceSAndroid Build Coastguard Worker * @param query_type Type of the query used by the test iteration. 301*35238bceSAndroid Build Coastguard Worker * @param draw_call_type_name Type of the draw call used by the test iteration. 302*35238bceSAndroid Build Coastguard Worker * @param primitive_type_name Primitive type used for the test iteration's draw call. 303*35238bceSAndroid Build Coastguard Worker * @param is_primitive_restart_enabled true if the test iteration was run with "primitive restart" 304*35238bceSAndroid Build Coastguard Worker * functionality enabled, false otherwise. 305*35238bceSAndroid Build Coastguard Worker * 306*35238bceSAndroid Build Coastguard Worker * @return String that includes a human-readable description of the 307*35238bceSAndroid Build Coastguard Worker * test iteration's properties. 308*35238bceSAndroid Build Coastguard Worker * 309*35238bceSAndroid Build Coastguard Worker */ 310*35238bceSAndroid Build Coastguard Worker template <typename VALUE_TYPE> getVerifyResultValuesErrorString(VALUE_TYPE value,const char * value_type,unsigned int n_expected_values,const glw::GLuint64 * expected_values,glw::GLenum query_type,std::string draw_call_type_name,std::string primitive_type_name,bool is_primitive_restart_enabled)311*35238bceSAndroid Build Coastguard Worker static std::string getVerifyResultValuesErrorString(VALUE_TYPE value, const char *value_type, 312*35238bceSAndroid Build Coastguard Worker unsigned int n_expected_values, 313*35238bceSAndroid Build Coastguard Worker const glw::GLuint64 *expected_values, glw::GLenum query_type, 314*35238bceSAndroid Build Coastguard Worker std::string draw_call_type_name, 315*35238bceSAndroid Build Coastguard Worker std::string primitive_type_name, 316*35238bceSAndroid Build Coastguard Worker bool is_primitive_restart_enabled) 317*35238bceSAndroid Build Coastguard Worker { 318*35238bceSAndroid Build Coastguard Worker std::stringstream log_sstream; 319*35238bceSAndroid Build Coastguard Worker 320*35238bceSAndroid Build Coastguard Worker DE_ASSERT(expected_values != DE_NULL); 321*35238bceSAndroid Build Coastguard Worker 322*35238bceSAndroid Build Coastguard Worker log_sstream << "Invalid default " << value_type 323*35238bceSAndroid Build Coastguard Worker << " query result value: found " 324*35238bceSAndroid Build Coastguard Worker "[" 325*35238bceSAndroid Build Coastguard Worker << value 326*35238bceSAndroid Build Coastguard Worker << "], expected:" 327*35238bceSAndroid Build Coastguard Worker "[" 328*35238bceSAndroid Build Coastguard Worker << expected_values[0] << "]"; 329*35238bceSAndroid Build Coastguard Worker 330*35238bceSAndroid Build Coastguard Worker for (unsigned int i = 1; i < n_expected_values; ++i) 331*35238bceSAndroid Build Coastguard Worker { 332*35238bceSAndroid Build Coastguard Worker log_sstream << " or [" << expected_values[i] << "]"; 333*35238bceSAndroid Build Coastguard Worker } 334*35238bceSAndroid Build Coastguard Worker 335*35238bceSAndroid Build Coastguard Worker log_sstream << ", query type:" 336*35238bceSAndroid Build Coastguard Worker "[" 337*35238bceSAndroid Build Coastguard Worker << getStringForEnum(query_type) 338*35238bceSAndroid Build Coastguard Worker << "], " 339*35238bceSAndroid Build Coastguard Worker "GL_PRIMITIVE_RESTART mode:" 340*35238bceSAndroid Build Coastguard Worker "[" 341*35238bceSAndroid Build Coastguard Worker << ((is_primitive_restart_enabled) ? "enabled" : "disabled") 342*35238bceSAndroid Build Coastguard Worker << "]" 343*35238bceSAndroid Build Coastguard Worker ", draw call type:" 344*35238bceSAndroid Build Coastguard Worker "[" 345*35238bceSAndroid Build Coastguard Worker << draw_call_type_name.c_str() 346*35238bceSAndroid Build Coastguard Worker << "]" 347*35238bceSAndroid Build Coastguard Worker ", primitive type:" 348*35238bceSAndroid Build Coastguard Worker "[" 349*35238bceSAndroid Build Coastguard Worker << primitive_type_name.c_str() << "]."; 350*35238bceSAndroid Build Coastguard Worker 351*35238bceSAndroid Build Coastguard Worker return log_sstream.str(); 352*35238bceSAndroid Build Coastguard Worker } 353*35238bceSAndroid Build Coastguard Worker }; 354*35238bceSAndroid Build Coastguard Worker 355*35238bceSAndroid Build Coastguard Worker /** Check that calling BeginQuery with a pipeline statistics query target 356*35238bceSAndroid Build Coastguard Worker * generates an INVALID_OPERATION error if the specified query was 357*35238bceSAndroid Build Coastguard Worker * previously used with a different pipeline statistics query target. 358*35238bceSAndroid Build Coastguard Worker **/ 359*35238bceSAndroid Build Coastguard Worker class PipelineStatisticsQueryTestAPICoverage1 : public deqp::TestCase 360*35238bceSAndroid Build Coastguard Worker { 361*35238bceSAndroid Build Coastguard Worker public: 362*35238bceSAndroid Build Coastguard Worker /* Public methods */ 363*35238bceSAndroid Build Coastguard Worker PipelineStatisticsQueryTestAPICoverage1(deqp::Context &context); 364*35238bceSAndroid Build Coastguard Worker 365*35238bceSAndroid Build Coastguard Worker virtual void deinit(); 366*35238bceSAndroid Build Coastguard Worker virtual tcu::TestNode::IterateResult iterate(); 367*35238bceSAndroid Build Coastguard Worker 368*35238bceSAndroid Build Coastguard Worker private: 369*35238bceSAndroid Build Coastguard Worker /* Private fields */ 370*35238bceSAndroid Build Coastguard Worker glw::GLuint m_qo_id; 371*35238bceSAndroid Build Coastguard Worker }; 372*35238bceSAndroid Build Coastguard Worker 373*35238bceSAndroid Build Coastguard Worker /** Performs the following tests: 374*35238bceSAndroid Build Coastguard Worker * 375*35238bceSAndroid Build Coastguard Worker * * If GL 3.2 and ARB_geometry_shader4 are not supported then check that 376*35238bceSAndroid Build Coastguard Worker * calling BeginQuery with target GEOMETRY_SHADER_INVOCATIONS or 377*35238bceSAndroid Build Coastguard Worker * GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB generates an INVALID_ENUM error. 378*35238bceSAndroid Build Coastguard Worker * 379*35238bceSAndroid Build Coastguard Worker * * If GL 4.0 and ARB_tessellation_shader are not supported then check that 380*35238bceSAndroid Build Coastguard Worker * calling BeginQuery with target TESS_CONTROL_SHADER_INVOCATIONS_ARB or 381*35238bceSAndroid Build Coastguard Worker * TESS_EVALUATION_SHADER_INVOCATIONS_ARB generates an INVALID_ENUM error. 382*35238bceSAndroid Build Coastguard Worker * 383*35238bceSAndroid Build Coastguard Worker * * If GL 4.3 and ARB_compute_shader are not supported then check that 384*35238bceSAndroid Build Coastguard Worker * calling BeginQuery with target COMPUTE_SHADER_INVOCATIONS_ARB generates 385*35238bceSAndroid Build Coastguard Worker * an INVALID_ENUM error. 386*35238bceSAndroid Build Coastguard Worker * 387*35238bceSAndroid Build Coastguard Worker **/ 388*35238bceSAndroid Build Coastguard Worker class PipelineStatisticsQueryTestAPICoverage2 : public deqp::TestCase 389*35238bceSAndroid Build Coastguard Worker { 390*35238bceSAndroid Build Coastguard Worker public: 391*35238bceSAndroid Build Coastguard Worker /* Public methods */ 392*35238bceSAndroid Build Coastguard Worker PipelineStatisticsQueryTestAPICoverage2(deqp::Context &context); 393*35238bceSAndroid Build Coastguard Worker 394*35238bceSAndroid Build Coastguard Worker virtual void deinit(); 395*35238bceSAndroid Build Coastguard Worker virtual tcu::TestNode::IterateResult iterate(); 396*35238bceSAndroid Build Coastguard Worker 397*35238bceSAndroid Build Coastguard Worker private: 398*35238bceSAndroid Build Coastguard Worker /* Private fields */ 399*35238bceSAndroid Build Coastguard Worker glw::GLuint m_qo_id; 400*35238bceSAndroid Build Coastguard Worker }; 401*35238bceSAndroid Build Coastguard Worker 402*35238bceSAndroid Build Coastguard Worker /** Base class used by all functional test implementations. Provides various 403*35238bceSAndroid Build Coastguard Worker * methods that are shared between functional tests. 404*35238bceSAndroid Build Coastguard Worker * 405*35238bceSAndroid Build Coastguard Worker * Derivative classes must implement executeTest() method. 406*35238bceSAndroid Build Coastguard Worker */ 407*35238bceSAndroid Build Coastguard Worker class PipelineStatisticsQueryTestFunctionalBase : public deqp::TestCase 408*35238bceSAndroid Build Coastguard Worker { 409*35238bceSAndroid Build Coastguard Worker public: 410*35238bceSAndroid Build Coastguard Worker /* Public methods */ 411*35238bceSAndroid Build Coastguard Worker PipelineStatisticsQueryTestFunctionalBase(deqp::Context &context, const char *name, const char *description); 412*35238bceSAndroid Build Coastguard Worker 413*35238bceSAndroid Build Coastguard Worker virtual void deinit(); 414*35238bceSAndroid Build Coastguard Worker virtual tcu::TestNode::IterateResult iterate(); 415*35238bceSAndroid Build Coastguard Worker 416*35238bceSAndroid Build Coastguard Worker protected: 417*35238bceSAndroid Build Coastguard Worker /* Protected methods */ 418*35238bceSAndroid Build Coastguard Worker void buildProgram(const char *cs_body, const char *fs_body, const char *gs_body, const char *tc_body, 419*35238bceSAndroid Build Coastguard Worker const char *te_body, const char *vs_body); 420*35238bceSAndroid Build Coastguard Worker 421*35238bceSAndroid Build Coastguard Worker virtual void deinitObjects(); 422*35238bceSAndroid Build Coastguard Worker 423*35238bceSAndroid Build Coastguard Worker virtual bool executeTest(glw::GLenum current_query_target) = 0; 424*35238bceSAndroid Build Coastguard Worker void initFBO(); 425*35238bceSAndroid Build Coastguard Worker virtual void initObjects(); 426*35238bceSAndroid Build Coastguard Worker void initQOBO(); 427*35238bceSAndroid Build Coastguard Worker void initVAO(unsigned int n_components_per_vertex); 428*35238bceSAndroid Build Coastguard Worker 429*35238bceSAndroid Build Coastguard Worker void initVBO(const float *raw_vertex_data, unsigned int raw_vertex_data_size, const unsigned int *raw_index_data, 430*35238bceSAndroid Build Coastguard Worker unsigned int raw_index_data_size, unsigned int indirect_draw_bo_count_argument, 431*35238bceSAndroid Build Coastguard Worker unsigned int indirect_draw_bo_primcount_argument, unsigned int indirect_draw_bo_baseinstance_argument, 432*35238bceSAndroid Build Coastguard Worker unsigned int indirect_draw_bo_first_argument, /* glDrawArrays() only */ 433*35238bceSAndroid Build Coastguard Worker unsigned int indirect_draw_bo_basevertex_argument); /* glDrawElements() only */ 434*35238bceSAndroid Build Coastguard Worker 435*35238bceSAndroid Build Coastguard Worker virtual bool shouldExecuteForQueryTarget(glw::GLenum query_target); 436*35238bceSAndroid Build Coastguard Worker 437*35238bceSAndroid Build Coastguard Worker /* Protected static methods */ 438*35238bceSAndroid Build Coastguard Worker static bool queryCallbackDrawCallHandler(void *pThis); 439*35238bceSAndroid Build Coastguard Worker 440*35238bceSAndroid Build Coastguard Worker /* Protected fields */ 441*35238bceSAndroid Build Coastguard Worker glw::GLuint m_bo_qo_id; 442*35238bceSAndroid Build Coastguard Worker glw::GLuint m_fbo_id; 443*35238bceSAndroid Build Coastguard Worker glw::GLuint m_po_id; 444*35238bceSAndroid Build Coastguard Worker glw::GLuint m_qo_id; 445*35238bceSAndroid Build Coastguard Worker glw::GLuint m_to_id; 446*35238bceSAndroid Build Coastguard Worker glw::GLuint m_vao_id; 447*35238bceSAndroid Build Coastguard Worker glw::GLuint m_vbo_id; 448*35238bceSAndroid Build Coastguard Worker 449*35238bceSAndroid Build Coastguard Worker const unsigned int m_to_height; 450*35238bceSAndroid Build Coastguard Worker const unsigned int m_to_width; 451*35238bceSAndroid Build Coastguard Worker 452*35238bceSAndroid Build Coastguard Worker unsigned int m_vbo_indirect_arrays_argument_offset; 453*35238bceSAndroid Build Coastguard Worker unsigned int m_vbo_indirect_elements_argument_offset; 454*35238bceSAndroid Build Coastguard Worker unsigned int m_vbo_index_data_offset; 455*35238bceSAndroid Build Coastguard Worker unsigned int m_vbo_n_indices; 456*35238bceSAndroid Build Coastguard Worker unsigned int m_vbo_vertex_data_offset; 457*35238bceSAndroid Build Coastguard Worker 458*35238bceSAndroid Build Coastguard Worker PipelineStatisticsQueryUtilities::_draw_call_type m_current_draw_call_type; 459*35238bceSAndroid Build Coastguard Worker PipelineStatisticsQueryUtilities::_primitive_type m_current_primitive_type; 460*35238bceSAndroid Build Coastguard Worker unsigned int m_indirect_draw_call_baseinstance_argument; 461*35238bceSAndroid Build Coastguard Worker unsigned int m_indirect_draw_call_basevertex_argument; 462*35238bceSAndroid Build Coastguard Worker unsigned int m_indirect_draw_call_count_argument; 463*35238bceSAndroid Build Coastguard Worker unsigned int m_indirect_draw_call_first_argument; 464*35238bceSAndroid Build Coastguard Worker unsigned int m_indirect_draw_call_firstindex_argument; 465*35238bceSAndroid Build Coastguard Worker unsigned int m_indirect_draw_call_primcount_argument; 466*35238bceSAndroid Build Coastguard Worker }; 467*35238bceSAndroid Build Coastguard Worker 468*35238bceSAndroid Build Coastguard Worker /** Performs the following functional test: 469*35238bceSAndroid Build Coastguard Worker * 470*35238bceSAndroid Build Coastguard Worker * Check that all pipeline statistics query types return a result of zero 471*35238bceSAndroid Build Coastguard Worker * if no rendering commands are issued between BeginQuery and EndQuery. 472*35238bceSAndroid Build Coastguard Worker * 473*35238bceSAndroid Build Coastguard Worker **/ 474*35238bceSAndroid Build Coastguard Worker class PipelineStatisticsQueryTestFunctional1 : public PipelineStatisticsQueryTestFunctionalBase 475*35238bceSAndroid Build Coastguard Worker { 476*35238bceSAndroid Build Coastguard Worker public: 477*35238bceSAndroid Build Coastguard Worker /* Public methods */ 478*35238bceSAndroid Build Coastguard Worker PipelineStatisticsQueryTestFunctional1(deqp::Context &context); 479*35238bceSAndroid Build Coastguard Worker 480*35238bceSAndroid Build Coastguard Worker protected: 481*35238bceSAndroid Build Coastguard Worker /* Protected methods */ 482*35238bceSAndroid Build Coastguard Worker bool executeTest(glw::GLenum current_query_target); 483*35238bceSAndroid Build Coastguard Worker }; 484*35238bceSAndroid Build Coastguard Worker 485*35238bceSAndroid Build Coastguard Worker /** Performs the following functional test: 486*35238bceSAndroid Build Coastguard Worker * 487*35238bceSAndroid Build Coastguard Worker * Check that all pipeline statistics query types return a result of zero 488*35238bceSAndroid Build Coastguard Worker * if Clear, ClearBuffer*, BlitFramebuffer, or any of the non-rendering 489*35238bceSAndroid Build Coastguard Worker * commands involving blits or copies (e.g. TexSubImage, CopyImageSubData, 490*35238bceSAndroid Build Coastguard Worker * ClearTexSubImage, BufferSubData, ClearBufferSubData) are issued between 491*35238bceSAndroid Build Coastguard Worker * BeginQuery and EndQuery. 492*35238bceSAndroid Build Coastguard Worker * 493*35238bceSAndroid Build Coastguard Worker **/ 494*35238bceSAndroid Build Coastguard Worker class PipelineStatisticsQueryTestFunctional2 : public PipelineStatisticsQueryTestFunctionalBase 495*35238bceSAndroid Build Coastguard Worker { 496*35238bceSAndroid Build Coastguard Worker public: 497*35238bceSAndroid Build Coastguard Worker /* Public methods */ 498*35238bceSAndroid Build Coastguard Worker PipelineStatisticsQueryTestFunctional2(deqp::Context &context); 499*35238bceSAndroid Build Coastguard Worker 500*35238bceSAndroid Build Coastguard Worker protected: 501*35238bceSAndroid Build Coastguard Worker /* Protected methods */ 502*35238bceSAndroid Build Coastguard Worker void deinitObjects(); 503*35238bceSAndroid Build Coastguard Worker bool executeTest(glw::GLenum current_query_target); 504*35238bceSAndroid Build Coastguard Worker void initObjects(); 505*35238bceSAndroid Build Coastguard Worker 506*35238bceSAndroid Build Coastguard Worker private: 507*35238bceSAndroid Build Coastguard Worker static bool executeBlitFramebufferTest(void *pThis); 508*35238bceSAndroid Build Coastguard Worker static bool executeBufferSubDataTest(void *pThis); 509*35238bceSAndroid Build Coastguard Worker static bool executeClearBufferfvColorBufferTest(void *pThis); 510*35238bceSAndroid Build Coastguard Worker static bool executeClearBufferfvDepthBufferTest(void *pThis); 511*35238bceSAndroid Build Coastguard Worker static bool executeClearBufferivStencilBufferTest(void *pThis); 512*35238bceSAndroid Build Coastguard Worker static bool executeClearBufferSubDataTest(void *pThis); 513*35238bceSAndroid Build Coastguard Worker static bool executeClearColorBufferTest(void *pThis); 514*35238bceSAndroid Build Coastguard Worker static bool executeClearDepthBufferTest(void *pThis); 515*35238bceSAndroid Build Coastguard Worker static bool executeClearStencilBufferTest(void *pThis); 516*35238bceSAndroid Build Coastguard Worker static bool executeClearTexSubImageTest(void *pThis); 517*35238bceSAndroid Build Coastguard Worker static bool executeCopyImageSubDataTest(void *pThis); 518*35238bceSAndroid Build Coastguard Worker static bool executeTexSubImageTest(void *pThis); 519*35238bceSAndroid Build Coastguard Worker 520*35238bceSAndroid Build Coastguard Worker /* Private fields */ 521*35238bceSAndroid Build Coastguard Worker glw::GLuint m_bo_id; 522*35238bceSAndroid Build Coastguard Worker glw::GLuint m_fbo_draw_id; 523*35238bceSAndroid Build Coastguard Worker glw::GLuint m_fbo_read_id; 524*35238bceSAndroid Build Coastguard Worker glw::GLuint m_to_draw_fbo_id; 525*35238bceSAndroid Build Coastguard Worker glw::GLuint m_to_read_fbo_id; 526*35238bceSAndroid Build Coastguard Worker 527*35238bceSAndroid Build Coastguard Worker const glw::GLuint m_to_height; 528*35238bceSAndroid Build Coastguard Worker const glw::GLuint m_to_width; 529*35238bceSAndroid Build Coastguard Worker 530*35238bceSAndroid Build Coastguard Worker static const glw::GLuint bo_size; 531*35238bceSAndroid Build Coastguard Worker }; 532*35238bceSAndroid Build Coastguard Worker 533*35238bceSAndroid Build Coastguard Worker /** Performs the following functional tests: 534*35238bceSAndroid Build Coastguard Worker * 535*35238bceSAndroid Build Coastguard Worker * Using the basic outline check that VERTICES_SUBMITTED_ARB queries return 536*35238bceSAndroid Build Coastguard Worker * the number of vertices submitted using draw commands. Vertices 537*35238bceSAndroid Build Coastguard Worker * corresponding to partial/incomplete primitives may or may not be counted 538*35238bceSAndroid Build Coastguard Worker * (e.g. when submitting a single instance with 8 vertices with primitive 539*35238bceSAndroid Build Coastguard Worker * mode TRIANGLES, the result of the query could be either 6 or 8). 540*35238bceSAndroid Build Coastguard Worker * 541*35238bceSAndroid Build Coastguard Worker * Using the basic outline check that VERTICES_SUBMITTED_ARB queries don't 542*35238bceSAndroid Build Coastguard Worker * count primitive topology restarts when PRIMITIVE_RESTART is enabled and 543*35238bceSAndroid Build Coastguard Worker * DrawElements* is used to submit an element array which contains one or 544*35238bceSAndroid Build Coastguard Worker * more primitive restart index values. 545*35238bceSAndroid Build Coastguard Worker * 546*35238bceSAndroid Build Coastguard Worker * Using the basic outline check that PRIMITIVES_SUBMITTED_ARB queries 547*35238bceSAndroid Build Coastguard Worker * return the exact number of primitives submitted using draw commands. 548*35238bceSAndroid Build Coastguard Worker * Partial/incomplete primitives may or may not be counted (e.g. when 549*35238bceSAndroid Build Coastguard Worker * submitting a single instance with 8 vertices with primitive mode 550*35238bceSAndroid Build Coastguard Worker * TRIANGLES, the result of the query could be either 2 or 3). Test the 551*35238bceSAndroid Build Coastguard Worker * behavior with all supported primitive modes. 552*35238bceSAndroid Build Coastguard Worker * 553*35238bceSAndroid Build Coastguard Worker * Using the basic outline check that PRIMITIVES_SUBMITTED_ARB queries 554*35238bceSAndroid Build Coastguard Worker * don't count primitive topology restarts when PRIMITIVE_RESTART is 555*35238bceSAndroid Build Coastguard Worker * enabled and DrawElements* is used to submit an element array which 556*35238bceSAndroid Build Coastguard Worker * contains one or more primitive restart index values. Also, partial/ 557*35238bceSAndroid Build Coastguard Worker * incomplete primitives resulting from the use of primitive restart index 558*35238bceSAndroid Build Coastguard Worker * values may or may not be counted. 559*35238bceSAndroid Build Coastguard Worker * 560*35238bceSAndroid Build Coastguard Worker * Using the basic outline check that CLIPPING_INPUT_PRIMITIVES_ARB queries 561*35238bceSAndroid Build Coastguard Worker * return the exact number of primitives reaching the primitive clipping 562*35238bceSAndroid Build Coastguard Worker * stage. If RASTERIZER_DISCARD is disabled, and the tessellation and 563*35238bceSAndroid Build Coastguard Worker * geometry shader stage is not used, this should match the number of 564*35238bceSAndroid Build Coastguard Worker * primitives submitted. 565*35238bceSAndroid Build Coastguard Worker * 566*35238bceSAndroid Build Coastguard Worker * Using the basic outline check that CLIPPING_OUTPUT_PRIMITIVES_ARB 567*35238bceSAndroid Build Coastguard Worker * queries return a value that is always greater than or equal to the 568*35238bceSAndroid Build Coastguard Worker * number of primitives submitted if RASTERIZER_DISCARD is disabled, there 569*35238bceSAndroid Build Coastguard Worker * is no tessellation and geometry shader stage used, and all primitives 570*35238bceSAndroid Build Coastguard Worker * lie entirely in the cull volume. 571*35238bceSAndroid Build Coastguard Worker * 572*35238bceSAndroid Build Coastguard Worker **/ 573*35238bceSAndroid Build Coastguard Worker class PipelineStatisticsQueryTestFunctional3 : public PipelineStatisticsQueryTestFunctionalBase 574*35238bceSAndroid Build Coastguard Worker { 575*35238bceSAndroid Build Coastguard Worker public: 576*35238bceSAndroid Build Coastguard Worker /* Public methods */ 577*35238bceSAndroid Build Coastguard Worker PipelineStatisticsQueryTestFunctional3(deqp::Context &context); 578*35238bceSAndroid Build Coastguard Worker 579*35238bceSAndroid Build Coastguard Worker protected: 580*35238bceSAndroid Build Coastguard Worker /* Protected methods */ 581*35238bceSAndroid Build Coastguard Worker void deinitObjects(); 582*35238bceSAndroid Build Coastguard Worker bool executeTest(glw::GLenum current_query_target); 583*35238bceSAndroid Build Coastguard Worker void initObjects(); 584*35238bceSAndroid Build Coastguard Worker bool shouldExecuteForQueryTarget(glw::GLenum query_target); 585*35238bceSAndroid Build Coastguard Worker 586*35238bceSAndroid Build Coastguard Worker private: 587*35238bceSAndroid Build Coastguard Worker /* Private methods */ 588*35238bceSAndroid Build Coastguard Worker void getExpectedPrimitivesSubmittedQueryResult( 589*35238bceSAndroid Build Coastguard Worker PipelineStatisticsQueryUtilities::_primitive_type current_primitive_type, unsigned int *out_results_written, 590*35238bceSAndroid Build Coastguard Worker glw::GLuint64 out_results[4]); 591*35238bceSAndroid Build Coastguard Worker 592*35238bceSAndroid Build Coastguard Worker void getExpectedVerticesSubmittedQueryResult( 593*35238bceSAndroid Build Coastguard Worker PipelineStatisticsQueryUtilities::_primitive_type current_primitive_type, unsigned int *out_results_written, 594*35238bceSAndroid Build Coastguard Worker glw::GLuint64 out_results[4]); 595*35238bceSAndroid Build Coastguard Worker 596*35238bceSAndroid Build Coastguard Worker /* Private fields */ 597*35238bceSAndroid Build Coastguard Worker bool m_is_primitive_restart_enabled; 598*35238bceSAndroid Build Coastguard Worker }; 599*35238bceSAndroid Build Coastguard Worker 600*35238bceSAndroid Build Coastguard Worker /** Performs the following functional test: 601*35238bceSAndroid Build Coastguard Worker * 602*35238bceSAndroid Build Coastguard Worker * Using the basic outline with a program having a vertex shader check that 603*35238bceSAndroid Build Coastguard Worker * VERTEX_SHADER_INVOCATIONS_ARB queries return a result greater than zero 604*35238bceSAndroid Build Coastguard Worker * if at least one vertex is submitted to the GL. 605*35238bceSAndroid Build Coastguard Worker * 606*35238bceSAndroid Build Coastguard Worker **/ 607*35238bceSAndroid Build Coastguard Worker class PipelineStatisticsQueryTestFunctional4 : public PipelineStatisticsQueryTestFunctionalBase 608*35238bceSAndroid Build Coastguard Worker { 609*35238bceSAndroid Build Coastguard Worker public: 610*35238bceSAndroid Build Coastguard Worker /* Public methods */ 611*35238bceSAndroid Build Coastguard Worker PipelineStatisticsQueryTestFunctional4(deqp::Context &context); 612*35238bceSAndroid Build Coastguard Worker 613*35238bceSAndroid Build Coastguard Worker protected: 614*35238bceSAndroid Build Coastguard Worker /* Protected methods */ 615*35238bceSAndroid Build Coastguard Worker void deinitObjects(); 616*35238bceSAndroid Build Coastguard Worker bool executeTest(glw::GLenum current_query_target); 617*35238bceSAndroid Build Coastguard Worker void initObjects(); 618*35238bceSAndroid Build Coastguard Worker bool shouldExecuteForQueryTarget(glw::GLenum query_target); 619*35238bceSAndroid Build Coastguard Worker }; 620*35238bceSAndroid Build Coastguard Worker 621*35238bceSAndroid Build Coastguard Worker /** Performs the following functional test: 622*35238bceSAndroid Build Coastguard Worker * 623*35238bceSAndroid Build Coastguard Worker * If GL 4.0 is supported, using the basic outline with a program having a 624*35238bceSAndroid Build Coastguard Worker * tessellation control and tessellation evaluation shader check that 625*35238bceSAndroid Build Coastguard Worker * TESS_CONTROL_SHADER_INVOCATIONS_ARB and TESS_EVALUATION_SHADER_- 626*35238bceSAndroid Build Coastguard Worker * INVOCATIONS_ARB queries return a result greater than zero if at least 627*35238bceSAndroid Build Coastguard Worker * one patch is needed to be processed by the GL (e.g. PATCH_VERTICES is 3, 628*35238bceSAndroid Build Coastguard Worker * and at least 3 vertices are submitted to the GL). 629*35238bceSAndroid Build Coastguard Worker * 630*35238bceSAndroid Build Coastguard Worker **/ 631*35238bceSAndroid Build Coastguard Worker class PipelineStatisticsQueryTestFunctional5 : public PipelineStatisticsQueryTestFunctionalBase 632*35238bceSAndroid Build Coastguard Worker { 633*35238bceSAndroid Build Coastguard Worker public: 634*35238bceSAndroid Build Coastguard Worker /* Public methods */ 635*35238bceSAndroid Build Coastguard Worker PipelineStatisticsQueryTestFunctional5(deqp::Context &context); 636*35238bceSAndroid Build Coastguard Worker 637*35238bceSAndroid Build Coastguard Worker protected: 638*35238bceSAndroid Build Coastguard Worker /* Protected methods */ 639*35238bceSAndroid Build Coastguard Worker void deinitObjects(); 640*35238bceSAndroid Build Coastguard Worker bool executeTest(glw::GLenum current_query_target); 641*35238bceSAndroid Build Coastguard Worker void initObjects(); 642*35238bceSAndroid Build Coastguard Worker bool shouldExecuteForQueryTarget(glw::GLenum query_target); 643*35238bceSAndroid Build Coastguard Worker }; 644*35238bceSAndroid Build Coastguard Worker 645*35238bceSAndroid Build Coastguard Worker /** Performs the following functional test: 646*35238bceSAndroid Build Coastguard Worker * 647*35238bceSAndroid Build Coastguard Worker * If GL 3.2 is supported, using the basic outline with a program having a 648*35238bceSAndroid Build Coastguard Worker * geometry shader check that GEOMETRY_SHADER_INVOCATIONS queries return 649*35238bceSAndroid Build Coastguard Worker * a result greater than zero if at least one complete primitive is 650*35238bceSAndroid Build Coastguard Worker * submitted to the GL. 651*35238bceSAndroid Build Coastguard Worker * 652*35238bceSAndroid Build Coastguard Worker * If GL 3.2 is supported, using the basic outline with a program having a 653*35238bceSAndroid Build Coastguard Worker * geometry shader check that GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB 654*35238bceSAndroid Build Coastguard Worker * queries return the exact number of primitives emitted by the geometry 655*35238bceSAndroid Build Coastguard Worker * shader. Also, if GL 4.0 is supported, use a geometry shader that emits 656*35238bceSAndroid Build Coastguard Worker * primitives to multiple vertex streams. In this case the result of 657*35238bceSAndroid Build Coastguard Worker * GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB has to match the sum of the 658*35238bceSAndroid Build Coastguard Worker * number of primitives emitted to each particular vertex stream. 659*35238bceSAndroid Build Coastguard Worker * 660*35238bceSAndroid Build Coastguard Worker **/ 661*35238bceSAndroid Build Coastguard Worker class PipelineStatisticsQueryTestFunctional6 : public PipelineStatisticsQueryTestFunctionalBase 662*35238bceSAndroid Build Coastguard Worker { 663*35238bceSAndroid Build Coastguard Worker public: 664*35238bceSAndroid Build Coastguard Worker /* Public methods */ 665*35238bceSAndroid Build Coastguard Worker PipelineStatisticsQueryTestFunctional6(deqp::Context &context); 666*35238bceSAndroid Build Coastguard Worker 667*35238bceSAndroid Build Coastguard Worker protected: 668*35238bceSAndroid Build Coastguard Worker /* Protected methods */ 669*35238bceSAndroid Build Coastguard Worker void deinitObjects(); 670*35238bceSAndroid Build Coastguard Worker bool executeTest(glw::GLenum current_query_target); 671*35238bceSAndroid Build Coastguard Worker void initObjects(); 672*35238bceSAndroid Build Coastguard Worker bool shouldExecuteForQueryTarget(glw::GLenum query_target); 673*35238bceSAndroid Build Coastguard Worker 674*35238bceSAndroid Build Coastguard Worker private: 675*35238bceSAndroid Build Coastguard Worker /* Private fields */ 676*35238bceSAndroid Build Coastguard Worker const unsigned int m_n_primitives_emitted_by_gs; 677*35238bceSAndroid Build Coastguard Worker const unsigned int m_n_streams_emitted_by_gs; 678*35238bceSAndroid Build Coastguard Worker }; 679*35238bceSAndroid Build Coastguard Worker 680*35238bceSAndroid Build Coastguard Worker /** Performs the following functional test: 681*35238bceSAndroid Build Coastguard Worker * 682*35238bceSAndroid Build Coastguard Worker * Using the basic outline with a program having a fragment shader check 683*35238bceSAndroid Build Coastguard Worker * that FRAGMENT_SHADER_INVOCATIONS_ARB queries return a result greater 684*35238bceSAndroid Build Coastguard Worker * than zero if at least one fragment gets rasterized. 685*35238bceSAndroid Build Coastguard Worker * 686*35238bceSAndroid Build Coastguard Worker **/ 687*35238bceSAndroid Build Coastguard Worker class PipelineStatisticsQueryTestFunctional7 : public PipelineStatisticsQueryTestFunctionalBase 688*35238bceSAndroid Build Coastguard Worker { 689*35238bceSAndroid Build Coastguard Worker public: 690*35238bceSAndroid Build Coastguard Worker /* Public methods */ 691*35238bceSAndroid Build Coastguard Worker PipelineStatisticsQueryTestFunctional7(deqp::Context &context); 692*35238bceSAndroid Build Coastguard Worker 693*35238bceSAndroid Build Coastguard Worker protected: 694*35238bceSAndroid Build Coastguard Worker /* Protected methods */ 695*35238bceSAndroid Build Coastguard Worker void deinitObjects(); 696*35238bceSAndroid Build Coastguard Worker bool executeTest(glw::GLenum current_query_target); 697*35238bceSAndroid Build Coastguard Worker void initObjects(); 698*35238bceSAndroid Build Coastguard Worker bool shouldExecuteForQueryTarget(glw::GLenum query_target); 699*35238bceSAndroid Build Coastguard Worker }; 700*35238bceSAndroid Build Coastguard Worker 701*35238bceSAndroid Build Coastguard Worker /** Performs the following functional test: 702*35238bceSAndroid Build Coastguard Worker * 703*35238bceSAndroid Build Coastguard Worker * Using the basic outline with a program having a compute shader check 704*35238bceSAndroid Build Coastguard Worker * that COMPUTE_SHADER_INVOCATIONS_ARB queries return a result greater 705*35238bceSAndroid Build Coastguard Worker * than zero if at least a single work group is submitted using one of the 706*35238bceSAndroid Build Coastguard Worker * Dispatch* commands. 707*35238bceSAndroid Build Coastguard Worker * 708*35238bceSAndroid Build Coastguard Worker **/ 709*35238bceSAndroid Build Coastguard Worker class PipelineStatisticsQueryTestFunctional8 : public PipelineStatisticsQueryTestFunctionalBase 710*35238bceSAndroid Build Coastguard Worker { 711*35238bceSAndroid Build Coastguard Worker public: 712*35238bceSAndroid Build Coastguard Worker /* Public methods */ 713*35238bceSAndroid Build Coastguard Worker PipelineStatisticsQueryTestFunctional8(deqp::Context &context); 714*35238bceSAndroid Build Coastguard Worker 715*35238bceSAndroid Build Coastguard Worker protected: 716*35238bceSAndroid Build Coastguard Worker /* Protected methods */ 717*35238bceSAndroid Build Coastguard Worker void deinitObjects(); 718*35238bceSAndroid Build Coastguard Worker bool executeTest(glw::GLenum current_query_target); 719*35238bceSAndroid Build Coastguard Worker void initObjects(); 720*35238bceSAndroid Build Coastguard Worker bool shouldExecuteForQueryTarget(glw::GLenum query_target); 721*35238bceSAndroid Build Coastguard Worker 722*35238bceSAndroid Build Coastguard Worker private: 723*35238bceSAndroid Build Coastguard Worker /* Private methods */ 724*35238bceSAndroid Build Coastguard Worker static bool queryCallbackDispatchCallHandler(void *pInstance); 725*35238bceSAndroid Build Coastguard Worker 726*35238bceSAndroid Build Coastguard Worker /* Private fields */ 727*35238bceSAndroid Build Coastguard Worker glw::GLuint m_bo_dispatch_compute_indirect_args_offset; 728*35238bceSAndroid Build Coastguard Worker glw::GLuint m_bo_id; 729*35238bceSAndroid Build Coastguard Worker unsigned int m_current_iteration; 730*35238bceSAndroid Build Coastguard Worker }; 731*35238bceSAndroid Build Coastguard Worker 732*35238bceSAndroid Build Coastguard Worker /** Test group which encapsulates all conformance tests for 733*35238bceSAndroid Build Coastguard Worker * GL_ARB_pipeline_statistics_query extension. 734*35238bceSAndroid Build Coastguard Worker */ 735*35238bceSAndroid Build Coastguard Worker class PipelineStatisticsQueryTests : public deqp::TestCaseGroup 736*35238bceSAndroid Build Coastguard Worker { 737*35238bceSAndroid Build Coastguard Worker public: 738*35238bceSAndroid Build Coastguard Worker /* Public methods */ 739*35238bceSAndroid Build Coastguard Worker PipelineStatisticsQueryTests(deqp::Context &context); 740*35238bceSAndroid Build Coastguard Worker 741*35238bceSAndroid Build Coastguard Worker void init(void); 742*35238bceSAndroid Build Coastguard Worker 743*35238bceSAndroid Build Coastguard Worker private: 744*35238bceSAndroid Build Coastguard Worker PipelineStatisticsQueryTests(const PipelineStatisticsQueryTests &other); 745*35238bceSAndroid Build Coastguard Worker PipelineStatisticsQueryTests &operator=(const PipelineStatisticsQueryTests &other); 746*35238bceSAndroid Build Coastguard Worker }; 747*35238bceSAndroid Build Coastguard Worker 748*35238bceSAndroid Build Coastguard Worker } // namespace glcts 749*35238bceSAndroid Build Coastguard Worker 750*35238bceSAndroid Build Coastguard Worker #endif // _GL4CPIPELINESTATISTICSQUERYTESTS_HPP 751