AnsweredAssumed Answered

glFlushMappedBufferRange causes access violation error

Question asked by br_andrey on Nov 15, 2015
Latest reply on Nov 18, 2015 by pinform

I am trying to fill buffers using glMapBufferRange with GL_MAP_FLUSH_EXPLICIT_BIT option. In my case I need to map array buffer and element buffer at the same time. But it doesn't work on Visual Studio (Windows 7 64 bit): access violation error is generated. I checked all lines using GetError and found no errors. The same code perfectly works on XCode under ios. So I am absolutely sure that all variables and content of the both buffers are correct. If I remove GL_MAP_FLUSH_EXPLICIT_BIT it works perfectly. If I map array buffer only (fill element buffer using glBufferData) it works even with GL_MAP_FLUSH_EXPLICIT_BIT option.

So it looks like for me that the problem is in drivers.

I have Radeon HD 6450M card. Driver version 8.801.2.3000. I tried to update the driver from amd site. But it resulted in unstable work and I uninstalled it.

 

Tree->Fillbuffers(
   
(BAV_Tree::vertsTrunk*)glMapBufferRange(
        GL_ARRAY_BUFFER
,
       
0,
        MAXVERTS
*sizeof(BAV_Tree::vertsTrunk),
        GL_MAP_WRITE_BIT
| GL_MAP_FLUSH_EXPLICIT_BIT),
   
(unsigned int*)glMapBufferRange(
        GL_ELEMENT_ARRAY_BUFFER
,
       
0,
       
2 * MAXVERTS*sizeof(unsigned int),
        GL_MAP_WRITE_BIT
| GL_MAP_FLUSH_EXPLICIT_BIT));
glFlushMappedBufferRange
(
    GL_ARRAY_BUFFER
,
   
Tree->tbpos*sizeof(BAV_Tree::vertsTrunk),
   
(Tree->nverts - Tree->tbpos)*sizeof(BAV_Tree::vertsTrunk));
glFlushMappedBufferRange
(
    GL_ELEMENT_ARRAY_BUFFER
,
   
Tree->tebpos*sizeof(unsigned int),
   
(Tree->ninds - Tree->tebpos)*sizeof(unsigned int));
glUnmapBuffer
(GL_ARRAY_BUFFER);
glUnmapBuffer
(GL_ELEMENT_ARRAY_BUFFER);

Outcomes