I need to get GPU information (including vendor, renderer, version, available extensions etc) programmatically in my Android SDK. So far, I know these ways to do this.
- Run
dumpsys | grep GLES command(Does not work becausedumpsysis a system-level command available only to some system apps or the ADB shell) - Create a
GLSurfaceView, attach aGLSurfaceView.Renderer, and get GPU information in its callback (Works fine but I want to know if there is a way to do that without creating aGLSurfaceViewsince I do not want to tinker with the host app's view hierarchy from my SDK)
Take a look at the Grafika project.
Within it there is
GLESInfoActivity, which demonstrates how to obtain the information you're looking for.The function
gatherGlInfo()has the code you need and it states that:This
EGLSurfaceis required to obtain the information from theGLES20class (OpenGLES information). You do not need this surface if you just want the information from theEGL14class (EGL information). However, given your question you will need information from theGLES20class and thus require anEGLSurface.In your case it should suffice to copy this method and use an offscreen surface, which would avoid the need to use
GLSurfaceView.You will also need some of the code within the
glespackage for theEGLset up and configuration. In particular: