15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci EXT_disjoint_timer_query 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_EXT_disjoint_timer_query 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContact 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Maurice Ribble, Qualcomm (mribble 'at' qualcomm.com) 125bd8deadSopenharmony_ci 135bd8deadSopenharmony_ciContributors 145bd8deadSopenharmony_ci 155bd8deadSopenharmony_ci Matt Trusten 165bd8deadSopenharmony_ci Maurice Ribble 175bd8deadSopenharmony_ci Daniel Koch 185bd8deadSopenharmony_ci Jan-Harald Fredriksen 195bd8deadSopenharmony_ci 205bd8deadSopenharmony_ci Contributors to ANGLE_timer_query 215bd8deadSopenharmony_ci Contributors to ARB_timer_query 225bd8deadSopenharmony_ci Contributors to EXT_timer_query 235bd8deadSopenharmony_ci Contributors to EXT_occlusion_query_boolean 245bd8deadSopenharmony_ci This extension is based on the ARB_timer_query and ANGLE_timer_query 255bd8deadSopenharmony_ci 265bd8deadSopenharmony_ciIP Status 275bd8deadSopenharmony_ci 285bd8deadSopenharmony_ci No known IP claims. 295bd8deadSopenharmony_ci 305bd8deadSopenharmony_ciStatus 315bd8deadSopenharmony_ci 325bd8deadSopenharmony_ci Complete 335bd8deadSopenharmony_ci 345bd8deadSopenharmony_ciVersion 355bd8deadSopenharmony_ci 365bd8deadSopenharmony_ci Version 9, November 20, 2020 375bd8deadSopenharmony_ci 385bd8deadSopenharmony_ciNumber 395bd8deadSopenharmony_ci 405bd8deadSopenharmony_ci OpenGL ES Extension #150 415bd8deadSopenharmony_ci 425bd8deadSopenharmony_ciDependencies 435bd8deadSopenharmony_ci 445bd8deadSopenharmony_ci OpenGL ES 2.0 or greater required. 455bd8deadSopenharmony_ci 465bd8deadSopenharmony_ci The extension is written against the OpenGL ES 2.0 specification. 475bd8deadSopenharmony_ci 485bd8deadSopenharmony_ci The GetInteger64vEXT command is required only if OpenGL ES 3.0 or 495bd8deadSopenharmony_ci later is not supported (see the Interactions section for details). 505bd8deadSopenharmony_ci 515bd8deadSopenharmony_ciOverview 525bd8deadSopenharmony_ci 535bd8deadSopenharmony_ci Applications can benefit from accurate timing information in a number of 545bd8deadSopenharmony_ci different ways. During application development, timing information can 555bd8deadSopenharmony_ci help identify application or driver bottlenecks. At run time, 565bd8deadSopenharmony_ci applications can use timing information to dynamically adjust the amount 575bd8deadSopenharmony_ci of detail in a scene to achieve constant frame rates. OpenGL 585bd8deadSopenharmony_ci implementations have historically provided little to no useful timing 595bd8deadSopenharmony_ci information. Applications can get some idea of timing by reading timers 605bd8deadSopenharmony_ci on the CPU, but these timers are not synchronized with the graphics 615bd8deadSopenharmony_ci rendering pipeline. Reading a CPU timer does not guarantee the completion 625bd8deadSopenharmony_ci of a potentially large amount of graphics work accumulated before the 635bd8deadSopenharmony_ci timer is read, and will thus produce wildly inaccurate results. 645bd8deadSopenharmony_ci glFinish() can be used to determine when previous rendering commands have 655bd8deadSopenharmony_ci been completed, but will idle the graphics pipeline and adversely affect 665bd8deadSopenharmony_ci application performance. 675bd8deadSopenharmony_ci 685bd8deadSopenharmony_ci This extension provides a query mechanism that can be used to determine 695bd8deadSopenharmony_ci the amount of time it takes to fully complete a set of GL commands, and 705bd8deadSopenharmony_ci without stalling the rendering pipeline. It uses the query object 715bd8deadSopenharmony_ci mechanisms first introduced in the occlusion query extension, which allow 725bd8deadSopenharmony_ci time intervals to be polled asynchronously by the application. 735bd8deadSopenharmony_ci 745bd8deadSopenharmony_ciNew Procedures and Functions 755bd8deadSopenharmony_ci 765bd8deadSopenharmony_ci void GenQueriesEXT(sizei n, uint *ids); 775bd8deadSopenharmony_ci void DeleteQueriesEXT(sizei n, const uint *ids); 785bd8deadSopenharmony_ci boolean IsQueryEXT(uint id); 795bd8deadSopenharmony_ci void BeginQueryEXT(enum target, uint id); 805bd8deadSopenharmony_ci void EndQueryEXT(enum target); 815bd8deadSopenharmony_ci void QueryCounterEXT(uint id, enum target); 825bd8deadSopenharmony_ci void GetQueryivEXT(enum target, enum pname, int *params); 835bd8deadSopenharmony_ci void GetQueryObjectivEXT(uint id, enum pname, int *params); 845bd8deadSopenharmony_ci void GetQueryObjectuivEXT(uint id, enum pname, uint *params); 855bd8deadSopenharmony_ci void GetQueryObjecti64vEXT(uint id, enum pname, int64 *params); 865bd8deadSopenharmony_ci void GetQueryObjectui64vEXT(uint id, enum pname, uint64 *params); 875bd8deadSopenharmony_ci void GetInteger64vEXT(enum pname, int64 *data) 885bd8deadSopenharmony_ci 895bd8deadSopenharmony_ciNew Tokens 905bd8deadSopenharmony_ci 915bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetQueryivEXT: 925bd8deadSopenharmony_ci 935bd8deadSopenharmony_ci QUERY_COUNTER_BITS_EXT 0x8864 945bd8deadSopenharmony_ci CURRENT_QUERY_EXT 0x8865 955bd8deadSopenharmony_ci 965bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetQueryObjectivEXT, 975bd8deadSopenharmony_ci GetQueryObjectuivEXT, GetQueryObjecti64vEXT, and 985bd8deadSopenharmony_ci GetQueryObjectui64vEXT: 995bd8deadSopenharmony_ci 1005bd8deadSopenharmony_ci QUERY_RESULT_EXT 0x8866 1015bd8deadSopenharmony_ci QUERY_RESULT_AVAILABLE_EXT 0x8867 1025bd8deadSopenharmony_ci 1035bd8deadSopenharmony_ci Accepted by the <target> parameter of BeginQueryEXT, EndQueryEXT, and 1045bd8deadSopenharmony_ci GetQueryivEXT: 1055bd8deadSopenharmony_ci 1065bd8deadSopenharmony_ci TIME_ELAPSED_EXT 0x88BF 1075bd8deadSopenharmony_ci 1085bd8deadSopenharmony_ci Accepted by the <target> parameter of GetQueryiv and QueryCounter. 1095bd8deadSopenharmony_ci Accepted by the <value> parameter of GetBooleanv, GetIntegerv, 1105bd8deadSopenharmony_ci GetInteger64v, and GetFloatv: 1115bd8deadSopenharmony_ci 1125bd8deadSopenharmony_ci TIMESTAMP_EXT 0x8E28 1135bd8deadSopenharmony_ci 1145bd8deadSopenharmony_ci Accepted by the <value> parameter of GetBooleanv, GetIntegerv, 1155bd8deadSopenharmony_ci GetInteger64v, and GetFloatv: 1165bd8deadSopenharmony_ci 1175bd8deadSopenharmony_ci GPU_DISJOINT_EXT 0x8FBB 1185bd8deadSopenharmony_ci 1195bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL ES 2.0 Specification (OpenGL ES Operation) 1205bd8deadSopenharmony_ci 1215bd8deadSopenharmony_ci (Modify table 2.1, Correspondence of command suffix letters to GL argument) 1225bd8deadSopenharmony_ci Add two new types: 1235bd8deadSopenharmony_ci 1245bd8deadSopenharmony_ci Letter Corresponding GL Type 1255bd8deadSopenharmony_ci ------ --------------------- 1265bd8deadSopenharmony_ci i64 int64 1275bd8deadSopenharmony_ci ui64 uint64 1285bd8deadSopenharmony_ci 1295bd8deadSopenharmony_ci (Modify table 2.2, GL data types) Add two new types: 1305bd8deadSopenharmony_ci 1315bd8deadSopenharmony_ci GL Type Minimum Bit Width Description 1325bd8deadSopenharmony_ci ------- ----------------- ----------------------------- 1335bd8deadSopenharmony_ci int64 64 Signed 2's complement integer 1345bd8deadSopenharmony_ci uint64 64 Unsigned binary integer 1355bd8deadSopenharmony_ci 1365bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL ES 2.0 Specification (Special Functions) 1375bd8deadSopenharmony_ci 1385bd8deadSopenharmony_ci Add a new section 5.3 "Timer Queries": 1395bd8deadSopenharmony_ci 1405bd8deadSopenharmony_ci "5.3 Timer Queries 1415bd8deadSopenharmony_ci 1425bd8deadSopenharmony_ci Timer queries use query objects to track the amount of time needed to 1435bd8deadSopenharmony_ci fully complete a set of GL commands, or to determine the current time 1445bd8deadSopenharmony_ci of the GL. 1455bd8deadSopenharmony_ci 1465bd8deadSopenharmony_ci Timer queries are associated with query objects. The command 1475bd8deadSopenharmony_ci 1485bd8deadSopenharmony_ci void GenQueriesEXT(sizei n, uint *ids); 1495bd8deadSopenharmony_ci 1505bd8deadSopenharmony_ci returns <n> previously unused query object names in <ids>. These 1515bd8deadSopenharmony_ci names are marked as used, but no object is associated with them until 1525bd8deadSopenharmony_ci the first time they are used by BeginQueryEXT or QueryCounterEXT. Query 1535bd8deadSopenharmony_ci objects contain one piece of state, an integer result value. This result 1545bd8deadSopenharmony_ci value is initialized to zero when the object is created. Any positive 1555bd8deadSopenharmony_ci integer except for zero (which is reserved for the GL) is a valid query 1565bd8deadSopenharmony_ci object name. 1575bd8deadSopenharmony_ci 1585bd8deadSopenharmony_ci Query objects are deleted by calling 1595bd8deadSopenharmony_ci 1605bd8deadSopenharmony_ci void DeleteQueriesEXT(sizei n, const uint *ids); 1615bd8deadSopenharmony_ci 1625bd8deadSopenharmony_ci <ids> contains <n> names of query objects to be deleted. After a 1635bd8deadSopenharmony_ci query object is deleted, its name is again unused. Unused names in 1645bd8deadSopenharmony_ci <ids> are silently ignored. 1655bd8deadSopenharmony_ci If an active query object is deleted its name immediately becomes unused, 1665bd8deadSopenharmony_ci but the underlying object is not deleted until it is no longer active. 1675bd8deadSopenharmony_ci 1685bd8deadSopenharmony_ci A timer query can be started and finished by calling 1695bd8deadSopenharmony_ci 1705bd8deadSopenharmony_ci void BeginQueryEXT(enum target, uint id); 1715bd8deadSopenharmony_ci void EndQueryEXT(enum target); 1725bd8deadSopenharmony_ci 1735bd8deadSopenharmony_ci where <target> is TIME_ELAPSED_EXT. If BeginQueryEXT is called 1745bd8deadSopenharmony_ci with an unused <id>, that name is marked as used and associated with 1755bd8deadSopenharmony_ci a new query object. 1765bd8deadSopenharmony_ci 1775bd8deadSopenharmony_ci If BeginQueryEXT is called with an <id> of zero, if the active query 1785bd8deadSopenharmony_ci object name for <target> is non-zero, if <id> is the name of an existing 1795bd8deadSopenharmony_ci query object whose type does not match <target>, or if <id> is the active 1805bd8deadSopenharmony_ci query object name for any query type, the error INVALID_OPERATION is 1815bd8deadSopenharmony_ci generated. If EndQueryEXT is called while no query with the same target 1825bd8deadSopenharmony_ci is in progress, an INVALID_OPERATION error is generated. 1835bd8deadSopenharmony_ci 1845bd8deadSopenharmony_ci When BeginQueryEXT and EndQueryEXT are called with a <target> of 1855bd8deadSopenharmony_ci TIME_ELAPSED_EXT, the GL prepares to start and stop the timer used for 1865bd8deadSopenharmony_ci timer queries. The timer is started or stopped when the effects from all 1875bd8deadSopenharmony_ci previous commands on the GL client and server state and the framebuffer 1885bd8deadSopenharmony_ci have been fully realized. On some architectures framebuffer can have 1895bd8deadSopenharmony_ci different meanings (specifically on some tiling GPUs fully realized might refer 1905bd8deadSopenharmony_ci to the framebuffer being in tile memory before it gets copied out to system 1915bd8deadSopenharmony_ci memory). The BeginQueryEXT and EndQueryEXT commands may return before the 1925bd8deadSopenharmony_ci timer is actually started or stopped. When the timer query timer is finally 1935bd8deadSopenharmony_ci stopped, the elapsed time (in nanoseconds) is written to the corresponding 1945bd8deadSopenharmony_ci query object as the query result value, and the query result for that object 1955bd8deadSopenharmony_ci is marked as available. 1965bd8deadSopenharmony_ci 1975bd8deadSopenharmony_ci If the elapsed time overflows the number of bits, <n>, available to hold 1985bd8deadSopenharmony_ci elapsed time, its value becomes undefined. It is recommended, but not 1995bd8deadSopenharmony_ci required, that implementations handle this overflow case by saturating at 2005bd8deadSopenharmony_ci 2^n - 1. 2015bd8deadSopenharmony_ci 2025bd8deadSopenharmony_ci The necessary state is a single bit indicating whether a timer 2035bd8deadSopenharmony_ci query is active, the identifier of the currently active timer 2045bd8deadSopenharmony_ci query, and a counter keeping track of the time that has passed. 2055bd8deadSopenharmony_ci 2065bd8deadSopenharmony_ci When the command 2075bd8deadSopenharmony_ci 2085bd8deadSopenharmony_ci void QueryCounterEXT(uint id, enum target); 2095bd8deadSopenharmony_ci 2105bd8deadSopenharmony_ci is called with <target> TIMESTAMP_EXT, the GL records the current time 2115bd8deadSopenharmony_ci into the corresponding query object. The time is recorded after all 2125bd8deadSopenharmony_ci previous commands on the GL client and server state and the framebuffer 2135bd8deadSopenharmony_ci have been fully realized. On some architectures framebuffer can have 2145bd8deadSopenharmony_ci different meanings (specifically on some tiling GPUs fully realized might refer 2155bd8deadSopenharmony_ci to the framebuffer being in tile memory before it gets copied out to system 2165bd8deadSopenharmony_ci memory). When the time is recorded, the query result for that object is 2175bd8deadSopenharmony_ci marked available. QueryCounterEXT timer queries can be used within a 2185bd8deadSopenharmony_ci BeginQueryEXT / EndQueryEXT block where the <target> is TIME_ELAPSED_EXT and 2195bd8deadSopenharmony_ci it does not affect the result of that query object. The error 2205bd8deadSopenharmony_ci INVALID_OPERATION is generated if the <id> is already in use within a 2215bd8deadSopenharmony_ci BeginQueryEXT/EndQueryEXT block. 2225bd8deadSopenharmony_ci 2235bd8deadSopenharmony_ci The current time of the GL may be queried by calling GetIntegerv or 2245bd8deadSopenharmony_ci GetInteger64v with the symbolic constant TIMESTAMP_EXT. This will return 2255bd8deadSopenharmony_ci the GL time after all previous commands have reached the GL server but have 2265bd8deadSopenharmony_ci not yet necessarily executed. By using a combination of this synchronous 2275bd8deadSopenharmony_ci get command and the asynchronous timestamp query object target, 2285bd8deadSopenharmony_ci applications can measure the latency between when commands reach the GL 2295bd8deadSopenharmony_ci server and when they are realized in the framebuffer. 2305bd8deadSopenharmony_ci 2315bd8deadSopenharmony_ci In order to know if the value returned from GetIntegerv or GetQuery is valid 2325bd8deadSopenharmony_ci GPU_DISJOINT_EXT needs to be used to make sure the GPU did not perform any 2335bd8deadSopenharmony_ci disjoint operation. This can be done through GetIntegerv by using GPU_- 2345bd8deadSopenharmony_ci DISJOINT_EXT for <pname>. <params> will be filled with a non-zero value if 2355bd8deadSopenharmony_ci a disjoint operation occurred since the last time GetIntegerv was used with 2365bd8deadSopenharmony_ci GPU_DISJOINT_EXT. A zero value will be returned if no disjoint operation 2375bd8deadSopenharmony_ci occurred, indicating the values returned by this extension that are found 2385bd8deadSopenharmony_ci in-between subsequent GetIntegerv calls will be valid for performance 2395bd8deadSopenharmony_ci metrics. 2405bd8deadSopenharmony_ci 2415bd8deadSopenharmony_ci Disjoint operations occur whenever a change in the GPU occurs that will 2425bd8deadSopenharmony_ci make the values returned by this extension unusable for performance 2435bd8deadSopenharmony_ci metrics. An example can be seen with how mobile GPUs need to proactively 2445bd8deadSopenharmony_ci try to conserve power, which might cause the GPU to go to sleep at the 2455bd8deadSopenharmony_ci lower levers. This means disjoint states will occur at different times on 2465bd8deadSopenharmony_ci different platforms and are implementation dependent. When the returned 2475bd8deadSopenharmony_ci value is non-zero, all time values that were filled since the previous 2485bd8deadSopenharmony_ci disjoint check should be considered undefined." 2495bd8deadSopenharmony_ci 2505bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL ES 2.0 Specification (State and State 2515bd8deadSopenharmony_ciRequests) 2525bd8deadSopenharmony_ci 2535bd8deadSopenharmony_ci Add GetInteger64vEXT to section 6.1.1 "Simple Queries", following 2545bd8deadSopenharmony_ci the prototype for GetIntegerv: 2555bd8deadSopenharmony_ci 2565bd8deadSopenharmony_ci " void GetInteger64vEXT(enum pname, int64 *data); 2575bd8deadSopenharmony_ci void GetFloatv(enum value, float *data); 2585bd8deadSopenharmony_ci 2595bd8deadSopenharmony_ci The commands obtain boolean, integer, 64-bit integer, or floating-point 2605bd8deadSopenharmony_ci variables..." 2615bd8deadSopenharmony_ci 2625bd8deadSopenharmony_ci Add a new section 6.1.9 "Timer Queries": 2635bd8deadSopenharmony_ci 2645bd8deadSopenharmony_ci "The command 2655bd8deadSopenharmony_ci 2665bd8deadSopenharmony_ci boolean IsQueryEXT(uint id); 2675bd8deadSopenharmony_ci 2685bd8deadSopenharmony_ci returns TRUE if <id> is the name of a query object. If <id> is zero, 2695bd8deadSopenharmony_ci or if <id> is a non-zero value that is not the name of a query 2705bd8deadSopenharmony_ci object, IsQueryEXT returns FALSE. 2715bd8deadSopenharmony_ci 2725bd8deadSopenharmony_ci Information about a query target can be queried with the command 2735bd8deadSopenharmony_ci 2745bd8deadSopenharmony_ci void GetQueryivEXT(enum target, enum pname, int *params); 2755bd8deadSopenharmony_ci 2765bd8deadSopenharmony_ci <target> identifies the query target and can be TIME_ELAPSED_EXT or 2775bd8deadSopenharmony_ci TIMESTAMP_EXT for timer queries. 2785bd8deadSopenharmony_ci 2795bd8deadSopenharmony_ci If <pname> is CURRENT_QUERY_EXT, the name of the currently active query 2805bd8deadSopenharmony_ci for <target>, or zero if no query is active, will be placed in <params>. 2815bd8deadSopenharmony_ci 2825bd8deadSopenharmony_ci If <pname> is QUERY_COUNTER_BITS_EXT, the implementation-dependent number 2835bd8deadSopenharmony_ci of bits used to hold the query result for <target> will be placed in 2845bd8deadSopenharmony_ci <params>. The number of query counter bits may be zero, in which case 2855bd8deadSopenharmony_ci the counter contains no useful information. 2865bd8deadSopenharmony_ci 2875bd8deadSopenharmony_ci For timer queries (TIME_ELAPSED_EXT and TIMESTAMP_EXT), if the number 2885bd8deadSopenharmony_ci of bits is non-zero, the minimum number of bits allowed is 30 which 2895bd8deadSopenharmony_ci will allow at least 1 second of timing. 2905bd8deadSopenharmony_ci 2915bd8deadSopenharmony_ci The state of a query object can be queried with the commands 2925bd8deadSopenharmony_ci 2935bd8deadSopenharmony_ci void GetQueryObjectivEXT(uint id, enum pname, int *params); 2945bd8deadSopenharmony_ci void GetQueryObjectuivEXT(uint id, enum pname, uint *params); 2955bd8deadSopenharmony_ci void GetQueryObjecti64vEXT(uint id, enum pname, int64 *params); 2965bd8deadSopenharmony_ci void GetQueryObjectui64vEXT(uint id, enum pname, uint64 *params); 2975bd8deadSopenharmony_ci 2985bd8deadSopenharmony_ci If <id> is not the name of a query object, or if the query object 2995bd8deadSopenharmony_ci named by <id> is currently active, then an INVALID_OPERATION error is 3005bd8deadSopenharmony_ci generated. 3015bd8deadSopenharmony_ci 3025bd8deadSopenharmony_ci If <pname> is QUERY_RESULT_EXT, then the query object's result 3035bd8deadSopenharmony_ci value is returned as a single integer in <params>. If the value is so 3045bd8deadSopenharmony_ci large in magnitude that it cannot be represented with the requested type, 3055bd8deadSopenharmony_ci then the nearest value representable using the requested type is 3065bd8deadSopenharmony_ci returned. If the number of query counter bits for target is zero, then 3075bd8deadSopenharmony_ci the result is returned as a single integer with the value zero. 3085bd8deadSopenharmony_ci 3095bd8deadSopenharmony_ci There may be an indeterminate delay before the above query returns. If 3105bd8deadSopenharmony_ci <pname> is QUERY_RESULT_AVAILABLE_EXT, FALSE is returned if such a delay 3115bd8deadSopenharmony_ci would be required; otherwise TRUE is returned. It must always be true 3125bd8deadSopenharmony_ci that if any query object returns a result available of TRUE, all queries 3135bd8deadSopenharmony_ci of the same type issued prior to that query must also return TRUE. 3145bd8deadSopenharmony_ci 3155bd8deadSopenharmony_ci Querying the state for a given timer query forces that timer query to 3165bd8deadSopenharmony_ci complete within a finite amount of time. 3175bd8deadSopenharmony_ci 3185bd8deadSopenharmony_ci If multiple queries are issued on the same target and id prior to 3195bd8deadSopenharmony_ci calling GetQueryObject[u]i[64]vEXT, the result returned will always be 3205bd8deadSopenharmony_ci from the last query issued. The results from any queries before the 3215bd8deadSopenharmony_ci last one will be lost if the results are not retrieved before starting 3225bd8deadSopenharmony_ci a new query on the same <target> and <id>. 3235bd8deadSopenharmony_ci 3245bd8deadSopenharmony_ciErrors 3255bd8deadSopenharmony_ci 3265bd8deadSopenharmony_ci The error INVALID_VALUE is generated if GenQueriesEXT is called where 3275bd8deadSopenharmony_ci <n> is negative. 3285bd8deadSopenharmony_ci 3295bd8deadSopenharmony_ci The error INVALID_VALUE is generated if DeleteQueriesEXT is called 3305bd8deadSopenharmony_ci where <n> is negative. 3315bd8deadSopenharmony_ci 3325bd8deadSopenharmony_ci The error INVALID_OPERATION is generated if BeginQueryEXT is called 3335bd8deadSopenharmony_ci when a query of the given <target> is already active. 3345bd8deadSopenharmony_ci 3355bd8deadSopenharmony_ci The error INVALID_OPERATION is generated if EndQueryEXT is called 3365bd8deadSopenharmony_ci when a query of the given <target> is not active. 3375bd8deadSopenharmony_ci 3385bd8deadSopenharmony_ci The error INVALID_OPERATION is generated if BeginQueryEXT is called 3395bd8deadSopenharmony_ci where <id> is zero. 3405bd8deadSopenharmony_ci 3415bd8deadSopenharmony_ci The error INVALID_OPERATION is generated if BeginQueryEXT is called 3425bd8deadSopenharmony_ci where <id> is the name of a query currently in progress. 3435bd8deadSopenharmony_ci 3445bd8deadSopenharmony_ci The error INVALID_OPERATION is generated if BeginQueryEXT is called 3455bd8deadSopenharmony_ci where <id> is the name of an existing query object whose type does not 3465bd8deadSopenharmony_ci match <target>. 3475bd8deadSopenharmony_ci 3485bd8deadSopenharmony_ci The error INVALID_ENUM is generated if BeginQueryEXT or EndQueryEXT 3495bd8deadSopenharmony_ci is called where <target> is not TIME_ELAPSED_EXT. 3505bd8deadSopenharmony_ci 3515bd8deadSopenharmony_ci The error INVALID_ENUM is generated if GetQueryivEXT is called where 3525bd8deadSopenharmony_ci <target> is not TIME_ELAPSED_EXT or TIMESTAMP_EXT. 3535bd8deadSopenharmony_ci 3545bd8deadSopenharmony_ci The error INVALID_ENUM is generated if GetQueryivEXT is called where 3555bd8deadSopenharmony_ci <pname> is not QUERY_COUNTER_BITS_EXT or CURRENT_QUERY_EXT. 3565bd8deadSopenharmony_ci 3575bd8deadSopenharmony_ci The error INVALID_ENUM is generated if QueryCounterEXT is called where 3585bd8deadSopenharmony_ci <target> is not TIMESTAMP_EXT. 3595bd8deadSopenharmony_ci 3605bd8deadSopenharmony_ci The error INVALID_OPERATION is generated if QueryCounterEXT is called 3615bd8deadSopenharmony_ci on a query object that is already in use inside a 3625bd8deadSopenharmony_ci BeginQueryEXT/EndQueryEXT. 3635bd8deadSopenharmony_ci 3645bd8deadSopenharmony_ci The error INVALID_OPERATION is generated if GetQueryObjectivEXT, 3655bd8deadSopenharmony_ci GetQueryObjectuivEXT, GetQueryObjecti64vEXT, or 3665bd8deadSopenharmony_ci GetQueryObjectui64vEXT is called where <id> is not the name of a query 3675bd8deadSopenharmony_ci object. 3685bd8deadSopenharmony_ci 3695bd8deadSopenharmony_ci The error INVALID_OPERATION is generated if GetQueryObjectivEXT, 3705bd8deadSopenharmony_ci GetQueryObjectuivEXT, GetQueryObjecti64vEXT, or 3715bd8deadSopenharmony_ci GetQueryObjectui64vEXT is called where <id> is the name of a currently 3725bd8deadSopenharmony_ci active query object. 3735bd8deadSopenharmony_ci 3745bd8deadSopenharmony_ci The error INVALID_ENUM is generated if GetQueryObjectivEXT, 3755bd8deadSopenharmony_ci GetQueryObjectuivEXT, GetQueryObjecti64vEXT, or 3765bd8deadSopenharmony_ci GetQueryObjectui64vEXT is called where <pname> is not 3775bd8deadSopenharmony_ci QUERY_RESULT_EXT or QUERY_RESULT_AVAILABLE_EXT. 3785bd8deadSopenharmony_ci 3795bd8deadSopenharmony_ciNew State 3805bd8deadSopenharmony_ci 3815bd8deadSopenharmony_ci (Add a new table 6.xx, "Query Operations") 3825bd8deadSopenharmony_ci 3835bd8deadSopenharmony_ci Get Value Type Get Command Initial Value Description Sec 3845bd8deadSopenharmony_ci --------- ---- ----------- ------------- ----------- ------ 3855bd8deadSopenharmony_ci - B - FALSE query active 5.3 3865bd8deadSopenharmony_ci CURRENT_QUERY_EXT Z+ GetQueryivEXT 0 active query ID 5.3 3875bd8deadSopenharmony_ci QUERY_RESULT_EXT Z+ GetQueryObjectuivEXT, 0 samples-passed count 5.3 3885bd8deadSopenharmony_ci GetQueryObjectui64vEXT 3895bd8deadSopenharmony_ci QUERY_RESULT_AVAILABLE_EXT B GetQueryObjectivEXT FALSE query result available 5.3 3905bd8deadSopenharmony_ci 3915bd8deadSopenharmony_ciNew Implementation Dependent State 3925bd8deadSopenharmony_ci 3935bd8deadSopenharmony_ci (Add the following entry to table 6.18): 3945bd8deadSopenharmony_ci 3955bd8deadSopenharmony_ci Get Value Type Get Command Minimum Value Description Sec 3965bd8deadSopenharmony_ci -------------------------- ---- ----------- ------------- ---------------- ------ 3975bd8deadSopenharmony_ci QUERY_COUNTER_BITS_EXT Z+ GetQueryivEXT see 6.1.9 Number of bits in 6.1.9 3985bd8deadSopenharmony_ci query counter 3995bd8deadSopenharmony_ci 4005bd8deadSopenharmony_ciInteractions with OpenGL ES 2.0 and OpenGL ES 3.x 4015bd8deadSopenharmony_ci 4025bd8deadSopenharmony_ci If only OpenGL ES 2.0 is supported, then GetInteger64vEXT is defined, 4035bd8deadSopenharmony_ci and is used instead of the GetInteger64v command defined by OpenGL ES 4045bd8deadSopenharmony_ci 3.x. If OpenGL ES 3.0 or later is supported, GetInteger64vEXT is not 4055bd8deadSopenharmony_ci required by an implementation of this extension, and the changes to 4065bd8deadSopenharmony_ci section 6.1.1 are ignored. 4075bd8deadSopenharmony_ci 4085bd8deadSopenharmony_ciExamples 4095bd8deadSopenharmony_ci 4105bd8deadSopenharmony_ci (1) Here is some rough sample code that demonstrates the intended usage 4115bd8deadSopenharmony_ci of this extension. 4125bd8deadSopenharmony_ci 4135bd8deadSopenharmony_ci GLint queries[N]; 4145bd8deadSopenharmony_ci GLint available = 0; 4155bd8deadSopenharmony_ci GLint disjointOccurred = 0; 4165bd8deadSopenharmony_ci /* Timer queries can contain more than 32 bits of data, so always 4175bd8deadSopenharmony_ci query them using the 64 bit types to avoid overflow */ 4185bd8deadSopenharmony_ci GLuint64 timeElapsed = 0; 4195bd8deadSopenharmony_ci 4205bd8deadSopenharmony_ci /* Create a query object. */ 4215bd8deadSopenharmony_ci glGenQueries(N, queries); 4225bd8deadSopenharmony_ci 4235bd8deadSopenharmony_ci /* Clear disjoint error */ 4245bd8deadSopenharmony_ci glGetIntegerv(GL_GPU_DISJOINT_EXT, &disjointOccurred); 4255bd8deadSopenharmony_ci 4265bd8deadSopenharmony_ci /* Start query 1 */ 4275bd8deadSopenharmony_ci glBeginQuery(GL_TIME_ELAPSED_EXT, queries[0]); 4285bd8deadSopenharmony_ci 4295bd8deadSopenharmony_ci /* Draw object 1 */ 4305bd8deadSopenharmony_ci .... 4315bd8deadSopenharmony_ci 4325bd8deadSopenharmony_ci /* End query 1 */ 4335bd8deadSopenharmony_ci glEndQuery(GL_TIME_ELAPSED_EXT); 4345bd8deadSopenharmony_ci 4355bd8deadSopenharmony_ci ... 4365bd8deadSopenharmony_ci 4375bd8deadSopenharmony_ci /* Start query N */ 4385bd8deadSopenharmony_ci glBeginQuery(GL_TIME_ELAPSED_EXT, queries[N-1]); 4395bd8deadSopenharmony_ci 4405bd8deadSopenharmony_ci /* Draw object N */ 4415bd8deadSopenharmony_ci .... 4425bd8deadSopenharmony_ci 4435bd8deadSopenharmony_ci /* End query N */ 4445bd8deadSopenharmony_ci glEndQuery(GL_TIME_ELAPSED_EXT); 4455bd8deadSopenharmony_ci 4465bd8deadSopenharmony_ci /* Wait for all results to become available */ 4475bd8deadSopenharmony_ci while (!available) { 4485bd8deadSopenharmony_ci glGetQueryObjectiv(queries[N-1], GL_QUERY_RESULT_AVAILABLE, &available); 4495bd8deadSopenharmony_ci } 4505bd8deadSopenharmony_ci 4515bd8deadSopenharmony_ci /* Check for disjoint operation for all queries within the last 4525bd8deadSopenharmony_ci disjoint check. This way we can only check disjoint once for all 4535bd8deadSopenharmony_ci queries between, and once the last is filled we know all previous 4545bd8deadSopenharmony_ci will have been filled as well */ 4555bd8deadSopenharmony_ci glGetIntegerv(GL_GPU_DISJOINT_EXT, &disjointOccurred); 4565bd8deadSopenharmony_ci 4575bd8deadSopenharmony_ci /* If a disjoint operation occurred, all timer queries in between 4585bd8deadSopenharmony_ci the last two disjoint checks that were filled are invalid, continue 4595bd8deadSopenharmony_ci without reading the the values */ 4605bd8deadSopenharmony_ci if (!disjointOccurred) { 4615bd8deadSopenharmony_ci for (i = 0; i < N; i++) { 4625bd8deadSopenharmony_ci /* See how much time the rendering of object i took in nanoseconds. */ 4635bd8deadSopenharmony_ci glGetQueryObjectui64vEXT(queries[i], GL_QUERY_RESULT, &timeElapsed); 4645bd8deadSopenharmony_ci 4655bd8deadSopenharmony_ci /* Do something useful with the time if a disjoint operation did 4665bd8deadSopenharmony_ci not occur. Note that care should be taken to use all 4675bd8deadSopenharmony_ci significant bits of the result, not just the least significant 4685bd8deadSopenharmony_ci 32 bits. */ 4695bd8deadSopenharmony_ci AdjustObjectLODBasedOnDrawTime(i, timeElapsed); 4705bd8deadSopenharmony_ci } 4715bd8deadSopenharmony_ci } 4725bd8deadSopenharmony_ci 4735bd8deadSopenharmony_ci This example is sub-optimal in that it stalls at the end of every 4745bd8deadSopenharmony_ci frame to wait for query results. Ideally, the collection of results 4755bd8deadSopenharmony_ci would be delayed one frame to minimize the amount of time spent 4765bd8deadSopenharmony_ci waiting for the GPU to finish rendering. 4775bd8deadSopenharmony_ci 4785bd8deadSopenharmony_ci (2) This example uses QueryCounter. 4795bd8deadSopenharmony_ci 4805bd8deadSopenharmony_ci GLint queries[2]; 4815bd8deadSopenharmony_ci GLint available = 0; 4825bd8deadSopenharmony_ci GLint disjointOccurred = 0; 4835bd8deadSopenharmony_ci /* Timer queries can contain more than 32 bits of data, so always 4845bd8deadSopenharmony_ci query them using the 64 bit types to avoid overflow */ 4855bd8deadSopenharmony_ci GLuint64 timeStart, timeEnd, timeElapsed = 0; 4865bd8deadSopenharmony_ci 4875bd8deadSopenharmony_ci /* Create a query object. */ 4885bd8deadSopenharmony_ci glGenQueries(2, queries); 4895bd8deadSopenharmony_ci 4905bd8deadSopenharmony_ci /* Clear disjoint error */ 4915bd8deadSopenharmony_ci glGetIntegerv(GL_GPU_DISJOINT_EXT, &disjointOccurred); 4925bd8deadSopenharmony_ci 4935bd8deadSopenharmony_ci /* Query current timestamp before drawing */ 4945bd8deadSopenharmony_ci glQueryCounterEXT(queries[0], GL_TIMESTAMP_EXT); 4955bd8deadSopenharmony_ci 4965bd8deadSopenharmony_ci /* Draw full rendertarget of objects */ 4975bd8deadSopenharmony_ci 4985bd8deadSopenharmony_ci /* Query current timestamp after drawing */ 4995bd8deadSopenharmony_ci glQueryCounterEXT(queries[1], GL_TIMESTAMP_EXT); 5005bd8deadSopenharmony_ci 5015bd8deadSopenharmony_ci /* Do some other work so you don't stall waiting for available */ 5025bd8deadSopenharmony_ci 5035bd8deadSopenharmony_ci /* Wait for the query result to become available */ 5045bd8deadSopenharmony_ci while (!available) { 5055bd8deadSopenharmony_ci glGetQueryObjectiv(queries[1], GL_QUERY_RESULT_AVAILABLE, &available); 5065bd8deadSopenharmony_ci } 5075bd8deadSopenharmony_ci 5085bd8deadSopenharmony_ci /* Check for disjoint operation. */ 5095bd8deadSopenharmony_ci glGetIntegerv(GL_GPU_DISJOINT_EXT, &disjointOccurred); 5105bd8deadSopenharmony_ci 5115bd8deadSopenharmony_ci /* If a disjoint operation occurred, continue without reading the the 5125bd8deadSopenharmony_ci values */ 5135bd8deadSopenharmony_ci if (!disjointOccurred) { 5145bd8deadSopenharmony_ci /* Get timestamp for when rendertarget started. */ 5155bd8deadSopenharmony_ci glGetQueryObjectui64vEXT(queries[0], GL_QUERY_RESULT, &timeStart); 5165bd8deadSopenharmony_ci /* Get timestamp for when rendertarget finished. */ 5175bd8deadSopenharmony_ci glGetQueryObjectui64vEXT(queries[1], GL_QUERY_RESULT, &timeEnd); 5185bd8deadSopenharmony_ci /* See how much time the rendering took in nanoseconds. */ 5195bd8deadSopenharmony_ci timeElapsed = timeEnd - timeStart; 5205bd8deadSopenharmony_ci 5215bd8deadSopenharmony_ci /* Do something useful with the time if a disjoint operation did 5225bd8deadSopenharmony_ci not occur. Note that care should be taken to use all 5235bd8deadSopenharmony_ci significant bits of the result, not just the least significant 5245bd8deadSopenharmony_ci 32 bits. */ 5255bd8deadSopenharmony_ci AdjustObjectLODBasedOnDrawTime(timeElapsed); 5265bd8deadSopenharmony_ci } 5275bd8deadSopenharmony_ci 5285bd8deadSopenharmony_ci (3) This example demonstrates how to measure the latency between GL 5295bd8deadSopenharmony_ci commands reaching the server and being realized in the framebuffer. 5305bd8deadSopenharmony_ci 5315bd8deadSopenharmony_ci /* Submit a frame of rendering commands */ 5325bd8deadSopenharmony_ci while (!doneRendering) { 5335bd8deadSopenharmony_ci ... 5345bd8deadSopenharmony_ci glDrawElements(...); 5355bd8deadSopenharmony_ci } 5365bd8deadSopenharmony_ci 5375bd8deadSopenharmony_ci /* Measure rendering latency: 5385bd8deadSopenharmony_ci Some commands may have already been submitted to hardware, 5395bd8deadSopenharmony_ci and some of those may have already completed. The goal is 5405bd8deadSopenharmony_ci to measure the time it takes for the remaining commands to 5415bd8deadSopenharmony_ci complete, thereby measuring how far behind the app the GPU 5425bd8deadSopenharmony_ci is lagging, but without synchronizing the GPU with the CPU. */ 5435bd8deadSopenharmony_ci 5445bd8deadSopenharmony_ci /* Clear disjoint error */ 5455bd8deadSopenharmony_ci glGetIntegerv(GL_GPU_DISJOINT_EXT, &disjointOccurred); 5465bd8deadSopenharmony_ci 5475bd8deadSopenharmony_ci /* Queue a query to find out when the frame finishes on the GL */ 5485bd8deadSopenharmony_ci glQueryCounterEXT(endFrameQuery, GL_TIMESTAMP_EXT); 5495bd8deadSopenharmony_ci 5505bd8deadSopenharmony_ci /* Get the current GL time without stalling the GL */ 5515bd8deadSopenharmony_ci glGetIntegerv(GL_TIMESTAMP_EXT, &flushTime); 5525bd8deadSopenharmony_ci 5535bd8deadSopenharmony_ci /* Finish the frame, submitting outstanding commands to the GL */ 5545bd8deadSopenharmony_ci SwapBuffers(); 5555bd8deadSopenharmony_ci 5565bd8deadSopenharmony_ci /* Render another frame */ 5575bd8deadSopenharmony_ci 5585bd8deadSopenharmony_ci /* Later, compare the query result of <endFrameQuery> 5595bd8deadSopenharmony_ci and <flushTime> to measure the latency of the frame. 5605bd8deadSopenharmony_ci A disjoint error still needs to be checked for in order 5615bd8deadSopenharmony_ci to verify these values are valid. */ 5625bd8deadSopenharmony_ci 5635bd8deadSopenharmony_ciIssues from EXT_timer_query 5645bd8deadSopenharmony_ci 5655bd8deadSopenharmony_ci (1) What time interval is being measured? 5665bd8deadSopenharmony_ci 5675bd8deadSopenharmony_ci RESOLVED: The timer starts when all commands prior to BeginQueryEXT() have 5685bd8deadSopenharmony_ci been fully executed. At that point, everything that should be drawn by 5695bd8deadSopenharmony_ci those commands has been written to the framebuffer. The timer stops 5705bd8deadSopenharmony_ci when all commands prior to EndQueryEXT() have been fully executed. 5715bd8deadSopenharmony_ci 5725bd8deadSopenharmony_ci (2) What unit of time will time intervals be returned in? 5735bd8deadSopenharmony_ci 5745bd8deadSopenharmony_ci RESOLVED: Nanoseconds (10^-9 seconds). This unit of measurement allows 5755bd8deadSopenharmony_ci for reasonably accurate timing of even small blocks of rendering 5765bd8deadSopenharmony_ci commands. The granularity of the timer is implementation-dependent. A 5775bd8deadSopenharmony_ci 32-bit query counter can express intervals of up to approximately 4 5785bd8deadSopenharmony_ci seconds. 5795bd8deadSopenharmony_ci 5805bd8deadSopenharmony_ci (3) What should be the minimum number of counter bits for timer queries? 5815bd8deadSopenharmony_ci 5825bd8deadSopenharmony_ci RESOLVED: 30 bits, which will allow timing sections that take up to 1 5835bd8deadSopenharmony_ci second to render. 5845bd8deadSopenharmony_ci 5855bd8deadSopenharmony_ci (4) How are counter results of more than 32 bits returned? 5865bd8deadSopenharmony_ci 5875bd8deadSopenharmony_ci RESOLVED: Via two new datatypes, int64 and uint64, and their 5885bd8deadSopenharmony_ci corresponding GetQueryObject entry points. These types hold integer 5895bd8deadSopenharmony_ci values and have a minimum bit width of 64. 5905bd8deadSopenharmony_ci 5915bd8deadSopenharmony_ci (5) Should the extension measure total time elapsed between the full 5925bd8deadSopenharmony_ci completion of the BeginQuery and EndQuery commands, or just time 5935bd8deadSopenharmony_ci spent in the graphics library? 5945bd8deadSopenharmony_ci 5955bd8deadSopenharmony_ci RESOLVED: This extension will measure the total time elapsed between 5965bd8deadSopenharmony_ci the full completion of these commands. Future extensions may implement 5975bd8deadSopenharmony_ci a query to determine time elapsed at different stages of the graphics 5985bd8deadSopenharmony_ci pipeline. 5995bd8deadSopenharmony_ci 6005bd8deadSopenharmony_ci (6) If multiple query types are supported, can multiple query types be 6015bd8deadSopenharmony_ci active simultaneously? 6025bd8deadSopenharmony_ci 6035bd8deadSopenharmony_ci RESOLVED: Yes; an application may perform a timer query and another 6045bd8deadSopenharmony_ci type of query simultaneously. An application can not perform multiple 6055bd8deadSopenharmony_ci timer queries or multiple queries of other types simultaneously. An 6065bd8deadSopenharmony_ci application also can not use the same query object for another query 6075bd8deadSopenharmony_ci and a timer query simultaneously. 6085bd8deadSopenharmony_ci 6095bd8deadSopenharmony_ci (7) Do query objects have a query type permanently associated with them? 6105bd8deadSopenharmony_ci 6115bd8deadSopenharmony_ci RESOLVED: No. A single query object can be used to perform different 6125bd8deadSopenharmony_ci types of queries, but not at the same time. 6135bd8deadSopenharmony_ci 6145bd8deadSopenharmony_ci Having a fixed type for each query object simplifies some aspects of the 6155bd8deadSopenharmony_ci implementation -- not having to deal with queries with different result 6165bd8deadSopenharmony_ci sizes, for example. It would also mean that BeginQuery() with a query 6175bd8deadSopenharmony_ci object of the "wrong" type would result in an INVALID_OPERATION error. 6185bd8deadSopenharmony_ci 6195bd8deadSopenharmony_ci UPDATE: This resolution was relevant for EXT_timer_query and OpenGL 2.0. 6205bd8deadSopenharmony_ci Since EXT_transform_feedback has since been incorporated into the core, 6215bd8deadSopenharmony_ci the resolution is that BeginQuery will generate error INVALID_OPERATION 6225bd8deadSopenharmony_ci if <id> represents a query object of a different type. 6235bd8deadSopenharmony_ci 6245bd8deadSopenharmony_ci (8) How predictable/repeatable are the results returned by the timer 6255bd8deadSopenharmony_ci query? 6265bd8deadSopenharmony_ci 6275bd8deadSopenharmony_ci RESOLVED: In general, the amount of time needed to render the same 6285bd8deadSopenharmony_ci primitives should be fairly constant. But there may be many other 6295bd8deadSopenharmony_ci system issues (e.g., context switching on the CPU and GPU, virtual 6305bd8deadSopenharmony_ci memory page faults, memory cache behavior on the CPU and GPU) that can 6315bd8deadSopenharmony_ci cause times to vary wildly. 6325bd8deadSopenharmony_ci 6335bd8deadSopenharmony_ci Note that modern GPUs are generally highly pipelined, and may be 6345bd8deadSopenharmony_ci processing different primitives in different pipeline stages 6355bd8deadSopenharmony_ci simultaneously. In this extension, the timers start and stop when the 6365bd8deadSopenharmony_ci BeginQuery/EndQuery commands reach the bottom of the rendering pipeline. 6375bd8deadSopenharmony_ci What that means is that by the time the timer starts, the GL driver on 6385bd8deadSopenharmony_ci the CPU may have started work on GL commands issued after BeginQuery, 6395bd8deadSopenharmony_ci and the higher pipeline stages (e.g., vertex transformation) may have 6405bd8deadSopenharmony_ci started as well. 6415bd8deadSopenharmony_ci 6425bd8deadSopenharmony_ci (9) What should the new 64 bit integer type be called? 6435bd8deadSopenharmony_ci 6445bd8deadSopenharmony_ci RESOLVED: The new types will be called GLint64/GLuint64. The new 6455bd8deadSopenharmony_ci command suffixes will be i64 and ui64. These names clearly convey the 6465bd8deadSopenharmony_ci minimum size of the types. These types are similar to the C99 standard 6475bd8deadSopenharmony_ci type int_least64_t, but we use names similar to the C99 optional type 6485bd8deadSopenharmony_ci int64_t for simplicity. 6495bd8deadSopenharmony_ci 6505bd8deadSopenharmony_ciIssues from ARB_timer_query 6515bd8deadSopenharmony_ci 6525bd8deadSopenharmony_ci (10) What about tile-based implementations? The effects of a command are 6535bd8deadSopenharmony_ci not complete until the frame is completely rendered. Timing recorded 6545bd8deadSopenharmony_ci before the frame is complete may not be what developers expect. Also 6555bd8deadSopenharmony_ci the amount of time needed to render the same primitives is not 6565bd8deadSopenharmony_ci consistent, which conflicts with issue (8) above. The time depends on 6575bd8deadSopenharmony_ci how early or late in the scene it is placed. 6585bd8deadSopenharmony_ci 6595bd8deadSopenharmony_ci RESOLVED: The current language supports tile-based rendering okay as it 6605bd8deadSopenharmony_ci is written. Developers are warned that using timers on tile-based 6615bd8deadSopenharmony_ci implementation may not produce results they expect since rendering is not 6625bd8deadSopenharmony_ci done in a linear order. Timing results are calculated when the frame is 6635bd8deadSopenharmony_ci completed and may depend on how early or late in the scene it is placed. 6645bd8deadSopenharmony_ci 6655bd8deadSopenharmony_ci (11) Can the GL implementation use different clocks to implement the 6665bd8deadSopenharmony_ci TIME_ELAPSED and TIMESTAMP queries? 6675bd8deadSopenharmony_ci 6685bd8deadSopenharmony_ci RESOLVED: Yes, the implementation can use different internal clocks to 6695bd8deadSopenharmony_ci implement TIME_ELAPSED and TIMESTAMP. If different clocks are 6705bd8deadSopenharmony_ci used it is possible there is a slight discrepancy when comparing queries 6715bd8deadSopenharmony_ci made from TIME_ELAPSED and TIMESTAMP; they may have slight 6725bd8deadSopenharmony_ci differences when both are used to measure the same sequence. However, this 6735bd8deadSopenharmony_ci is unlikely to affect real applications since comparing the two queries is 6745bd8deadSopenharmony_ci not expected to be useful. 6755bd8deadSopenharmony_ci 6765bd8deadSopenharmony_ciIssues 6775bd8deadSopenharmony_ci 6785bd8deadSopenharmony_ci (12) What should we call this extension? 6795bd8deadSopenharmony_ci 6805bd8deadSopenharmony_ci RESOLVED: EXT_disjoint_timer_query 6815bd8deadSopenharmony_ci 6825bd8deadSopenharmony_ci (13) Why is this done as a separate extension instead of just supporting 6835bd8deadSopenharmony_ci ARB_timer_query? 6845bd8deadSopenharmony_ci 6855bd8deadSopenharmony_ci ARB_timer_query is written against OpenGL 3.2, which includes a lot of 6865bd8deadSopenharmony_ci the required support for dealing with query objects. None of these 6875bd8deadSopenharmony_ci functions or tokens exist in OpenGL ES, and as such have to be added in 6885bd8deadSopenharmony_ci this specification. 6895bd8deadSopenharmony_ci 6905bd8deadSopenharmony_ci (14) How does this extension differ from ARB_timer_query? 6915bd8deadSopenharmony_ci 6925bd8deadSopenharmony_ci This extension contains most ARB_timer_query behavior unchanged as well 6935bd8deadSopenharmony_ci as adds the ability to detect GPU issues using GPU_DISJOINT_EXT. 6945bd8deadSopenharmony_ci 6955bd8deadSopenharmony_ci (15) Are query objects shareable between multiple contexts? 6965bd8deadSopenharmony_ci 6975bd8deadSopenharmony_ci RESOLVED: No. Query objects are lightweight and we normally share 6985bd8deadSopenharmony_ci large data across contexts. Also, being able to share query objects 6995bd8deadSopenharmony_ci across contexts is not particularly useful. In order to do the async 7005bd8deadSopenharmony_ci query across contexts, a query on one context would have to be finished 7015bd8deadSopenharmony_ci before the other context could query it. 7025bd8deadSopenharmony_ci 7035bd8deadSopenharmony_ci (16) How does this extension interact with EXT_occlusion_query_boolean? 7045bd8deadSopenharmony_ci 7055bd8deadSopenharmony_ci This extension redefines the Query Api originally defined in the EXT- 7065bd8deadSopenharmony_ci _occlusion_query_boolean. If both EXT_disjoint_timer_query and EXT- 7075bd8deadSopenharmony_ci _occlusion_query_boolean are supported, the rules and specification 7085bd8deadSopenharmony_ci regarding any overlap will be governed by the EXT_occlusion_query_boolean 7095bd8deadSopenharmony_ci extension. 7105bd8deadSopenharmony_ci 7115bd8deadSopenharmony_ci This extension should redefine the functionality in the same way, but if 7125bd8deadSopenharmony_ci some discrepancy is found and both are supported EXT_disjoint_timer_query 7135bd8deadSopenharmony_ci will yield to the rules and specifications governing the overlap in the 7145bd8deadSopenharmony_ci order above. 7155bd8deadSopenharmony_ci 7165bd8deadSopenharmony_ci (17) How does this extension interact with the OpenGL ES 3.0 specification? 7175bd8deadSopenharmony_ci 7185bd8deadSopenharmony_ci Some of the functionality and requirements described here overlap with the 7195bd8deadSopenharmony_ci OpenGL ES 3.0 specification. Any overlap for the functions or tokens in 7205bd8deadSopenharmony_ci this extension were meant to complement each other, but the OpenGL ES 3.0 7215bd8deadSopenharmony_ci spec takes precedence. If the implementation supports OpenGL ES 3.0 then 7225bd8deadSopenharmony_ci it should support both the core non-decorated functions and the EXT 7235bd8deadSopenharmony_ci decorated functions. 7245bd8deadSopenharmony_ci 7255bd8deadSopenharmony_ci (18) How do times from BeginQueryEXT/EndQueryEXT with a <target> of 7265bd8deadSopenharmony_ci TIME_ELAPSED_EXT and QueryCounterEXT with a <target> of TIMESTAMP_EXT 7275bd8deadSopenharmony_ci compare on some Qualcomm and ARM tiling GPUs? 7285bd8deadSopenharmony_ci 7295bd8deadSopenharmony_ci This does not describe all tiling GPUs, but it is how some tiling GPUs from 7305bd8deadSopenharmony_ci ARM, Qualcomm, and possibly other vendors work. This is just an 7315bd8deadSopenharmony_ci implementation note and there is no guarantee all ARM and Qualcomm 7325bd8deadSopenharmony_ci implementations will work this way. 7335bd8deadSopenharmony_ci 7345bd8deadSopenharmony_ci TIME_ELAPSED_EXT will be a summation of all the time spent on the workload 7355bd8deadSopenharmony_ci between begin and end. Tiling architectures might split this work up over a 7365bd8deadSopenharmony_ci binning pass and rendering many different tiles. It is up to the hardware 7375bd8deadSopenharmony_ci and/or driver to add up all the time spent on the work between begin and end 7385bd8deadSopenharmony_ci and report a single number making the implementation transparent to 7395bd8deadSopenharmony_ci developers using this feature. If the binning pass happens in parallel to 7405bd8deadSopenharmony_ci rendering pass this time would not be counted twice. On some 7415bd8deadSopenharmony_ci implementations this does not include the time to copy tile memory to or from 7425bd8deadSopenharmony_ci the frame buffer in system memory, and on other implementations this time 7435bd8deadSopenharmony_ci is included. 7445bd8deadSopenharmony_ci 7455bd8deadSopenharmony_ci TIMESTAMP_EXT is the time when all the commands are complete and copied out 7465bd8deadSopenharmony_ci of tile memory to the framebuffer in system memory. This can result in a 7475bd8deadSopenharmony_ci courser grain timestamp than developers familiar with immediate GPUs expect. 7485bd8deadSopenharmony_ci For example all the draws to an FBO can often all get the same timestamp, or 7495bd8deadSopenharmony_ci even all the draw calls to multiple FBOs can end up with the same timestamp. 7505bd8deadSopenharmony_ci If some operation causes a midframe store/load (such as flush or readPixels) 7515bd8deadSopenharmony_ci then that would create another point for timestamps, but is a lot of extra 7525bd8deadSopenharmony_ci work for the GPU so it should be avoided. 7535bd8deadSopenharmony_ci 7545bd8deadSopenharmony_ci If a preemption event happens before the TIMESTAMP_EXT is reported then that 7555bd8deadSopenharmony_ci time will include the time for preemption. With TIME_ELAPSED_EXT it is 7565bd8deadSopenharmony_ci undefined if the preemption time is counted or not. Some hardware will 7575bd8deadSopenharmony_ci count the preemption time (even though it is from a different context). For 7585bd8deadSopenharmony_ci this behavior GPU_DISJOINT_EXT will be set so you know there was an event 7595bd8deadSopenharmony_ci from a different context affecting results. Other hardware will not count 7605bd8deadSopenharmony_ci the time spent in the preempting context and for this cases GPU_DISJOINT_EXT 7615bd8deadSopenharmony_ci will not be set. 7625bd8deadSopenharmony_ci 7635bd8deadSopenharmony_ciRevision History 7645bd8deadSopenharmony_ci Revision 9, 2020/11/20 (xndcn) 7655bd8deadSopenharmony_ci - Minor fix of code sample 7665bd8deadSopenharmony_ci Revision 8, 2019/12/11 (Jon Leech) 7675bd8deadSopenharmony_ci - Add actual spec language defining GetInteger64vEXT (github 7685bd8deadSopenharmony_ci OpenGL-Registry issue 326) 7695bd8deadSopenharmony_ci Revision 7, 2016/9/2 (Maurice Ribble) 7705bd8deadSopenharmony_ci - Clarify language dealing with GetInteger64v 7715bd8deadSopenharmony_ci Revision 6, 2016/7/15 (Maurice Ribble) 7725bd8deadSopenharmony_ci - Clarified some outstanding questions about tiling GPUs 7735bd8deadSopenharmony_ci - Added issue 18 7745bd8deadSopenharmony_ci Revision 5, 2013/6/5 7755bd8deadSopenharmony_ci - Minor cleanup to match new gl2ext.h 7765bd8deadSopenharmony_ci Revision 4, 2013/4/25 (Jon Leech) 7775bd8deadSopenharmony_ci - Cleanup for publication 7785bd8deadSopenharmony_ci - Fix value assigned to GPU_DISJOINT_EXT 7795bd8deadSopenharmony_ci Revision 3, 2013/4/8 7805bd8deadSopenharmony_ci - Minor cleanup of code sample and re-wording 7815bd8deadSopenharmony_ci Revision 2, 2013/4/2 7825bd8deadSopenharmony_ci - Minor cleanup 7835bd8deadSopenharmony_ci Revision 1, 2013/1/2 7845bd8deadSopenharmony_ci - Copied from revision 1 of ANGLE_timer_query 7855bd8deadSopenharmony_ci - Added TIMESTAMP_EXT and GPU_DISJOINT_EXT 786