GLES Disjoint timer query unexpected value

Hi,

I'm having an issue getting plausible values at certain times with a disjoint timer query. I've read the discussion in here but my issue seems slightly different.

I'm not trying to time individual draw calls but rather the time it takes for complete the backbuffer.

I'm getting "roughly" consistent numbers for a large part of the frames, but frequently get 18446744073709551615 (2^64-1). This happens even when glGetQueryObjectuiv() returns true for an available query. Here's a snippet of the code (which is a slightly modified version this Unity plugin to use a 64-bit query):

GLuint available = 0;
glGetQueryObjectuiv(queryObject, GL_QUERY_RESULT_AVAILABLE, &available);
if (available == GL_TRUE) 
{
  GLuint64 elapsed_time_ns;
  glGetQueryObjectui64vEXT(queryObject, GL_QUERY_RESULT, &elapsed_time_ns);
  if (glGetError() == GL_NO_ERROR) 
  {
    ...
  }
  ...
}

I've tried forcing a synchronous call by ignoring the availability of the result. In such cases, the MAX_UINT above doesn't seem to occur and the values are "roughly" consistent (sometimes a few ms apart, but that's perhaps due HW pipelining).

I've gone through the extension spec but I can't find anything that might explain this. Could I've missed something?

I'm running this on a Samsung A20 with a Mali-G71. I've tried the same test on a device with an old Adreno 330 and I don't seem to get the same issue though.

GLuint available = 0;
glGetQueryObjectuiv(queryObject, GL_QUERY_RESULT_AVAILABLE, &available);
if (available == GL_TRUE) 
{
  GLuint64 elapsed_time_ns;
  glGetQueryObjectui64vEXT(queryObject, GL_QUERY_RESULT, &elapsed_time_ns);
  if (glGetError() == GL_NO_ERROR) 
  {
    ...
  }
  ...
}

More questions in this forum