[Windows & DMD] No callstack when crash with Access violation reading location 0x00000000

Benjamin Thaut code at benjamin-thaut.de
Mon Jan 13 13:47:05 PST 2014


Am 13.01.2014 21:52, schrieb Xavier Bigand:
> glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,9)
> glBindBuffer(GL_ARRAY_BUFFER,10)
> glEnableVertexAttribArray(0)
> glVertexAttribPointer(0,3,GL_FLOAT,false,12,00000000)
> glBindBuffer(GL_ARRAY_BUFFER,11)
> glEnableVertexAttribArray(1)
> glVertexAttribPointer(1,4,GL_FLOAT,false,16,00000000)
> glDrawElements(GL_LINE_LOOP,4,GL_UNSIGNED_INT,00000000) GLSL=4
> ----->glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT)
> ----->----->glUseProgram(4)
> ----->----->glUniformMatrix4fv(0,1,false,[0.002497,0.000000,0.000000,0.000000,0.000000,-0.003333,0.000000,0.000000,0.000000,0.000000,-0.010000,0.000000,-1.000000,1.000000,0.000000,1.000000])
>
> ----->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,9)
> ----->----->glBindBuffer(GL_ARRAY_BUFFER,10)
> ----->----->glEnableVertexAttribArray(0)
> ----->----->glVertexAttribPointer(0,3,GL_FLOAT,false,12,00000000)
> ----->----->glBindBuffer(GL_ARRAY_BUFFER,11)
> ----->----->glEnableVertexAttribArray(1)
> ----->----->glVertexAttribPointer(1,4,GL_FLOAT,false,16,00000000)
> ----->----->glDrawElements(GL_LINE_LOOP,4,GL_UNSIGNED_INT,00000000) GLSL=4
>
> This extract seems to correspond of latest gl command called just before
> the crash after the window resize. It doesn't seems to have any error here.
>

Yes this indeed looks correct.
Maybe its even a bug in the driver. Because it happens right after the 
window resize graphic resource might got invalid and the driver would 
need to re-create them. The problem ist most likely that you use two 
array buffers, one for each attribute, instead of using one array buffer 
and interleaving the attribute (this is the usual way). I could bet, 
that if you switch over to the interleaved variant, the problem goes away.

You could also try to make the three buffers slightly larger and 
specifiy different pointers to see which one actually causes the invalid 
read. So that the calls become:

 > ----->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,9)
 > ----->----->glBindBuffer(GL_ARRAY_BUFFER,10)
 > ----->----->glEnableVertexAttribArray(0)
 > ----->----->glVertexAttribPointer(0,3,GL_FLOAT,false,12,00000000)
 > ----->----->glBindBuffer(GL_ARRAY_BUFFER,11)
 > ----->----->glEnableVertexAttribArray(1)
 > ----->----->glVertexAttribPointer(1,4,GL_FLOAT,false,16,00000016)
 > ----->----->glDrawElements(GL_LINE_LOOP,4,GL_UNSIGNED_INT,00000004) 
GLSL=4

You could then see from the access violation which of the three buffers 
the read attempt fails.

You could also try to move the glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,9) 
right before the glDrawElements call.

Kind Regards
Benjamin Thaut


More information about the Digitalmars-d-learn mailing list