Forums - Crash with GL_EXT_disjoint_timer_query

4 posts / 0 new
Last post
Crash with GL_EXT_disjoint_timer_query
formisk
Join Date: 24 Jan 15
Posts: 8
Posted: Mon, 2015-07-06 23:36

I am attempting to get data on how long some opengl operations (mainly render to texture and transform feedback) take. Since OpenGL ES 3.0 does not have native measuring tools I thought I would attempt to use GL_EXT_disjoint_timer_query and have ran into a problem. On my Samsung Galaxy S4 Active (Adreno 320) I get a crash and on my Motorola G (Adreno 305) OpenGL stopps working (many unrelated error messages start to print on every opengl call, nothing is shown on screen). 

 

What I am doing:


#define GL_TIMESTAMP_EXT_                  0x8E28
typedef void (GL_APIENTRYP PFNGLGENQUERIESEXTPROC) (GLsizei n, GLuint *ids);
typedef void (GL_APIENTRYP PFNGLQUERYCOUNTEREXTPROC) (GLuint id, GLenum target);
 
PFNGLGENQUERIESEXTPROC glGenQueriesEXT_;
PFNGLQUERYCOUNTEREXTPROC glQueryCounterEXT_;
void add_disjoint_timer_ext() {
    glGenQueriesEXT_ = (PFNGLGENQUERIESEXTPROC)eglGetProcAddress("glGenQueriesEXT");
    glQueryCounterEXT_ = (PFNGLQUERYCOUNTEREXTPROC)eglGetProcAddress("glQueryCounterEXT");
}
---------- (later on in the code after we have a valid OpenGL Context and have checked that the device has the extension)
                add_disjoint_timer_ext();
                GLuint id;
                glGenQueriesEXT_(1, &id);
                println("id", id); // prints 1
                glBeginQueryEXT_(GL_TIME_ELAPSED_EXT_, id); // strangeness stops if this line is commented
 

 

Has anyone else sucessfully gotten this extension to work?

  • Up0
  • Down0
ayelder Moderator
Join Date: 3 Oct 12
Posts: 3
Posted: Fri, 2015-07-10 10:56

Hello,

Thanks for getting in touch with us about this issue.

 

I notice that you have a function, add_disjoint_timer_ext(), for setting up the function pointers however I notice that glBeginQueryEXT_ is not in that function. Could you check that the function pointer for glBeginQueryEXT_ is being setup correctly?

 

You stated that "strangeness" occurs when you use glBeginQueryEXT_, what exactly do you mean by that? Is it a crash, memory corruption or some other type of issue?

 

Some other things you could try to troubleshoot the issue:

* Check for GL errors after every GL call

* Make sure there is a corresponding glEndQuery following any glBeginQuery before retrieving the results of said query.

* Review description and examples in the spec which can be found here -  https://www.khronos.org/registry/gles/extensions/EXT/EXT_disjoint_timer_...

  •  
  • Up0
  • Down0
formisk
Join Date: 24 Jan 15
Posts: 8
Posted: Fri, 2015-07-10 13:33

Hello, thanks for taking a look.

Good catch on the missing glBeginQueryEXT_, that's a copy paste error on my part (I shortened the example to the smallest thing that would show the problem, but did it incorrectly), the full function is here:

Quote:

void add_disjoint_timer_ext() {

    glGenQueriesEXT_ = (PFNGLGENQUERIESEXTPROC)eglGetProcAddress("glGenQueriesEXT");
    glDeleteQueriesEXT_ = (PFNGLDELETEQUERIESEXTPROC)eglGetProcAddress("glDeleteQueriesEXT");
    glIsQueryEXT_ = (PFNGLISQUERYEXTPROC)eglGetProcAddress("glIsQueryEXT");
    glBeginQueryEXT_ = (PFNGLBEGINQUERYEXTPROC)eglGetProcAddress("glBeginQueryEXT");
    glEndQueryEXT_ = (PFNGLENDQUERYEXTPROC)eglGetProcAddress("glEndQueryEXT");
    glQueryCounterEXT_ = (PFNGLQUERYCOUNTEREXTPROC)eglGetProcAddress("glQueryCounterEXT");
    glGetQueryivEXT_ = (PFNGLGETQUERYIVEXTPROC)eglGetProcAddress("glGetQueryivEXT");
    glGetQueryObjectivEXT_ = (PFNGLGETQUERYOBJECTIVEXTPROC)eglGetProcAddress("glGetQueryObjectivEXT");
    glGetQueryObjectuivEXT_ = (PFNGLGETQUERYOBJECTUIVEXTPROC)eglGetProcAddress("glGetQueryObjectuivEXT");
    glGetQueryObjecti64vEXT_ = (PFNGLGETQUERYOBJECTI64VEXTPROC)eglGetProcAddress("glGetQueryObjecti64vEXT");
    glGetQueryObjectui64vEXT_  = (PFNGLGETQUERYOBJECTUI64VEXTPROC)eglGetProcAddress("glGetQueryObjectui64vEXT");
}
 

Strangeness means that the application continues to run, but (all?)opengl commands begin showing errors. As to what happens I do not know, I would guess that some kind of memory corruption has taken place.

I was not so much looking for ways of fixing it as for confirmation that someone somewhere has previously gotten these functions to work. I would have thought getting time information is very often used but I can't find anyone mentioning using them on mobile devices on the internet.

  • Up0
  • Down0
ayelder Moderator
Join Date: 3 Oct 12
Posts: 3
Posted: Thu, 2015-07-16 12:30

The functionality of this extension is tested internally and known to be working using glBeginQuery and glEndQuery.

 

Would you be able to give more information on the errors that are being thrown? What is the first function that throws an error and what is the error?

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.