FrameCapture: Start active queries last in MEC Before this CL, we cycle through all queries, Begin and End them, unless they are active, and we skip End. That can give us a sequence like this: glGenQueries(1, (GLuint *)gReadBuffer); UpdateQueryID(1, 0); glBeginQuery(GL_TIME_ELAPSED_EXT, gQueryMap[1]); glEndQuery(GL_TIME_ELAPSED_EXT); glGenQueries(1, (GLuint *)gReadBuffer); UpdateQueryID(2, 0); glBeginQuery(GL_TIME_ELAPSED_EXT, gQueryMap[2]); glGenQueries(1, (GLuint *)gReadBuffer); UpdateQueryID(3, 0); glBeginQuery(GL_TIME_ELAPSED_EXT, gQueryMap[3]); glEndQuery(GL_TIME_ELAPSED_EXT); Note that gQueryMap[2] is not Ended because it is active. That results in a GL error when we try to Begin gQueryMap[3]: INFO: glBeginQuery: GL error: HIGH: Other query is active. To fix this, we need to start active queries last. That results in the following sequence: glGenQueries(1, (GLuint *)gReadBuffer); UpdateQueryID(1, 0); glBeginQuery(GL_TIME_ELAPSED_EXT, gQueryMap[1]); glEndQuery(GL_TIME_ELAPSED_EXT); glGenQueries(1, (GLuint *)gReadBuffer); UpdateQueryID(2, 0); glGenQueries(1, (GLuint *)gReadBuffer); UpdateQueryID(3, 0); glBeginQuery(GL_TIME_ELAPSED_EXT, gQueryMap[3]); glEndQuery(GL_TIME_ELAPSED_EXT); glBeginQuery(GL_TIME_ELAPSED_EXT, gQueryMap[2]); Test: Filament mosquito trace Bug: b/322364529 Change-Id: I4de9401e49bf93b0cfe02ba5ad536f3ab3079b81 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6017473 Reviewed-by: Mark Łobodziński <mark@lunarg.com> Commit-Queue: Cody Northrop <cnorthrop@google.com>