Crash with GL_EXT_disjoint_timer_query
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?
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_...
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:
void add_disjoint_timer_ext() {
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.
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?