Imagination PowerVR SDK Blog

Access violation reading location 0xbaadf00d

pvrvframe

#1

I see 0xbaadf00d come up a lot with bad values and access violations. This particular one came up with the following code:





    GLint prog;


    glGetIntegerv(GL_CURRENT_PROGRAM, &prog);


    ASSERT(prog >= 0);


    ASSERT(glIsProgram(prog) == GL_TRUE);    // The bad access happens inside of the glIsProgram call.





I also encountered the 0xbaadf00d value coming up in





    GLint maxVertexAttribs;


    glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxVertexAttribs);





maxVertexAttribs every once in a while is 0xbaadfood, and a call to glGetError before this returns GL_NO_ERROR, and this is all immediately after successfully setting up the egl stuff.


#2

I’ve filed this as BRN34242 in our system.





Details of your development machine’s graphics acceleration, drivers will be helpful in reproducing and fixing this. If you can make a minimal example that reproduces the problem then please send it to devtech@imgtec.com and this could also help us.



#3

Hey, thanks! Do I have access to BRN34242 for adding my system’s details? If not, here they are:





Dell Inspiron 1720 (It’s a laptop)


Windows XP SP3


NVIDIA GeForce 8600M GT


6.14.12.6658 1/7/2011 (latest version of drivers)





And in case this helps, here are the strings returns from the various glGetString/eglQueryString functions:





GL:


Vendor:   Imagination Technologies (Host GL: NVIDIA Corporation)


Renderer: PowerVR PVRVFrame 8.1 SGX (Host GL: GeForce 8600M GT/PCI/SSE2)


Version: OpenGL ES 2.0 ( SDK build: 2.08.28.0607 )


EGL:


Vendor:   Imagination Technologies


Version: 1.4 PVRVFrame 8.1 (SDK 2.08.28.0607)


Extensions:











This is a pretty large game I’m working on, and I’m in crunch more at the moment, so I can’t narrow it down to a small case. :frowning: Given that I am starting to encounter errors all the time once I wired up some of the more advanced stuff in the game engine, it’s almost as if the emulation is getting stress-tested by the game and freaking out.





In the case of the GL_MAX_VERTEX_ATTRIBS problem I note above, that one is super-basic. It happens after I setup EGL, however it only happens once in a great while, so that’s the weird part. Once I hit F5 to continue after my homegrown ASSERT, PVRFrame later complained about a function pointer being NULL and that my system didn’t support that function (I can’t remember which one it was, but I think it was an OES function… but I don’t get that error unless the GL_MAX_VERTEX_ATTRIBS problem happens). Here’s my code leading up to that problem, so it’s probably easy to see what is not getting initialized correctly for GL_MAX_VERTEX_ATTRIBS to return 0xbaadf00d:








     m_eglDisplay = eglGetDisplay(GetDC(m_hMainWindow));


     if(m_eglDisplay == EGL_NO_DISPLAY)


          return;





     EGLint majorVersion, minorVersion;


     if(!eglInitialize(m_eglDisplay, &majorVersion, &minorVersion))


          return;





#if defined(EGL_VERSION_1_3) && defined(GL_ES_VERSION_2_0)


     if(!eglBindAPI(EGL_OPENGL_ES_API))


          return;


#endif





     EGLint numConfigs;


     if(!eglGetConfigs(m_eglDisplay, NULL, 0, &numConfigs))


          return;





     const EGLint attribList[] =


     {


          EGL_RED_SIZE,        8,


          EGL_GREEN_SIZE,      8,


          EGL_BLUE_SIZE,       8,


          EGL_ALPHA_SIZE,      8,


          EGL_DEPTH_SIZE,      16,


          EGL_STENCIL_SIZE,    8,


          EGL_SAMPLE_BUFFERS, 0,


#if defined(EGL_VERSION_1_3) && defined(GL_ES_VERSION_2_0)


          EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,


#endif


          EGL_NONE


     };


     EGLConfig config;


     if(!eglChooseConfig(m_eglDisplay, attribList, &config, 1, &numConfigs))


          return;





     EGLint contextAttribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE, EGL_NONE };


     EGLContext context = eglCreateContext(m_eglDisplay, config, EGL_NO_CONTEXT, contextAttribs);


     if(context == EGL_NO_CONTEXT)


          return;





     m_eglSurface = eglCreateWindowSurface(m_eglDisplay, config, m_hMainWindow, NULL);


     if(m_eglSurface == EGL_NO_SURFACE)


          return;





     if(!eglMakeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, context))


          return;





     DEBUG_OGL_FAIL(glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &m_maxVertexAttribs));


     ASSERT(m_maxVertexAttribs >= 8);     // should be at least 8, according to spec, but sometimes is 0xbaadf00d


jbuck2011-08-17 19:58:28


#4

Currently the bugtracking system is internal only, but I’ve added the information above to this issue.