return &group_obj->Counters[id];
}
-/* For INTEL_performance_query, query id 0 is reserved to be invalid. We use
- * index to Groups array + 1 as the query id. Same applies to counter id.
- */
-static inline GLuint
-queryid_to_index(GLuint queryid)
-{
- return queryid - 1;
-}
-
-static inline GLuint
-index_to_queryid(GLuint index)
-{
- return index + 1;
-}
-
-static inline bool
-queryid_valid(const struct gl_context *ctx, GLuint queryid)
-{
- return get_group(ctx, queryid_to_index(queryid)) != NULL;
-}
-
-static inline GLuint
-counterid_to_index(GLuint counterid)
-{
- return counterid - 1;
-}
-
/*****************************************************************************/
void GLAPIENTRY
if (enable) {
/* Enable the counters */
for (i = 0; i < numCounters; i++) {
- ++m->ActiveGroups[group];
- BITSET_SET(m->ActiveCounters[group], counterList[i]);
+ if (!BITSET_TEST(m->ActiveCounters[group], counterList[i])) {
+ ++m->ActiveGroups[group];
+ BITSET_SET(m->ActiveCounters[group], counterList[i]);
+ }
}
} else {
/* Disable the counters */
for (i = 0; i < numCounters; i++) {
- --m->ActiveGroups[group];
- BITSET_CLEAR(m->ActiveCounters[group], counterList[i]);
+ if (BITSET_TEST(m->ActiveCounters[group], counterList[i])) {
+ --m->ActiveGroups[group];
+ BITSET_CLEAR(m->ActiveCounters[group], counterList[i]);
+ }
}
}
}
* when a performance monitor is not currently started."
*/
if (!m->Active) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glBeginPerfMonitor(not active)");
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glEndPerfMonitor(not active)");
return;
}
for (group = 0; group < ctx->PerfMonitor.NumGroups; group++) {
const struct gl_perf_monitor_group *g = &ctx->PerfMonitor.Groups[group];
- BITSET_WORD tmp;
- BITSET_FOREACH_SET(counter, tmp, m->ActiveCounters[group], g->NumCounters) {
+ BITSET_FOREACH_SET(counter, m->ActiveCounters[group], g->NumCounters) {
const struct gl_perf_monitor_counter *c = &g->Counters[counter];
size += sizeof(uint32_t); /* Group ID */