Programatically figure out the driver version?

My recent investigation resulted in a conclusion that there is a certain bug on ARM Mali driver version r12. The bug is for sure fixed in driver version r22.
I would thus like to implement a workaround

if( vendorIsARM() && driverVersion()<22 )

I know how to write the ‘workaround()’ and ‘vendorIsARM()’ functions, but how do I implement the ‘int driverVersion()’ ?

On my phone, glGetString(GL_VERSION) returns

   OpenGL ES 3.2 v1.[b]r12p1-03dev0[/b].228ab63cced004f840e7dd47b762a1d0

Where ‘r12p1-03dev0’ is the driver version as reported by the underlying Linux kernel. I guess I could parse out the ‘r12’ from that, but this feels a bit shaky. Would GL_VERSION always be structured identically? Is there a better way?

Sounds like a plan to me, not shaky at all.

I would verify that you can properly parse the version # from all versions before relying on it, but that’s just me.