Mark Cass wrote:
developers,
I am having experiancing a sementation fault when calling glCompressedTexImage2DARB. I have checked the pointer returned from GetProcAddress and it seems to be valid (not NULL). i placed a breakpoint in teximage.c (a mesa source file) on the function _mesa_CompressedTexImage2DARB. I am not getting to this mesa function before the segmentation fault. The debugger is giving me fits and i can not look at a backtrace to determine where the crash occurred. even loading a core dump yields no useful information.

gdb has always worked for me, as long as libGL and the driver are compiled with -g.



My question is what should i check? how do i determine if the pointer returned is actually the right one? is _mesa_CompressedTexImage2DARB is obviously not called directly by glCompressedTexImage2DARB, so how does it get called? this last question is related to flow, has does an opengl call in an application make it to the appropriate place in the driver?

When you call glCompressedTexImage2DARB, you're calling a function in libGL, either implemented in C or x86 assembly.


The C code is implemented with macro/template code (see dispatch.c and glapitemp.h), but boils down to something like this:

void glCompressedTexImage2DARB(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * data)
{
_glapi_Dispatch->CompressedTexImage2DARB, target, level, internalformat, width, height, border, imageSize, data);
}


The alternate assembly code is:

ALIGNTEXT16
GLOBL_FN(GL_PREFIX(CompressedTexImage2DARB,[EMAIL PROTECTED]))
GL_PREFIX(CompressedTexImage2DARB,[EMAIL PROTECTED]):
        MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX)
        JMP(GL_OFFSET(_gloffset_CompressedTexImage2DARB))

In either case, the variable '_glapi_Dispatch' is a pointer to the dispatch table (a big struct of function pointers). The entry for CompressedTexImage2DARB typically points to the _mesa_CompressedTexImage2DARB function. This assignment is done in the mesa/src/main/state.c file.

The use of a dispatch table lets us efficiently switch between immediate mode and display list mode, between direct and indirect rendering mode, and thread-safe and non-threadsafe mode.

-Brian



-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
--
_______________________________________________
Dri-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to