I am writing an OpenGL (ES) application, and my device seems to fall back to software rendering. How can I determine what API calls/device restrictions are causing this to happen?

In my case, this is happening on a Raspberry Pi with OpenGL ES 2.0, but an ideal answer should apply to a much wider range of OpenGL versions and OSes.

有帮助吗?

解决方案

I honestly do no think there is a proper way to find out.

The graphics card drivers will provide functionality for a certain version of OpenGL, as far as I know it does not have to provide hardware support for those features, just be able to handle your application requesting them. So a card could claim support for say OpenGL 4, but almost everything that is newer then OpenGL3 could be simply software rendered.

You might be able to find some documentation for the hardware you wish to run on that will tell you what is hardware accelerated. Failing that, you may have to simple try to build up the list of features you use slowly until you start seeing it has fallen back on software rendering.

Also, how do you know it is using software rendering, is it just the performance hit? I guess it could be possible that whilst it does support a feature in hardware, it does so very badly. There is also the possibility you are not creating your context correctly in the first place, thus can't take advantage of the more recent version.

其他提示

if device supports GL_ARB_debug_output then debug output might have clues whether something is software rendered or bad for performance.

Usage is described in the document http://www.opengl.org/registry/specs/ARB/debug_output.txt In short you should set log buffer or callback function that would receive messages.

There is also another one debug extension http://www.opengl.org/registry/specs/KHR/debug.txt probably some more exists.

to use KHR extension you should init context properly

EGLint ctx_attribs[] = {
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_CONTEXT_FLAGS_KHR, EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR,
EGL_NONE};

EGLContext *ctx = eglCreateContext(dpy, config, EGL_NO_CONTEXT, ctx_attribs);

and setup callback

static void on_gl_error(enum source, enum type, uint id, enum severity, 
sizei length, const char* message, void *userParam)
{
    printf("%s\n", message);
}

static void enable_debug_callbacks(void)
{
    glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR, GL_TRUE);
    glDebugMessageCallbackKHR(on_gl_error, NULL);
}

Others probably work in similar way, you should check supported extensions before trying this, this is done by examining return of the call. It is a string with list of all supported extensions.

glGetString(GL_EXTENSIONS);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top