PDA

View Full Version : Intel on-board graphics VBO problem?



yooyo
03-11-2010, 04:21 AM
I run into very strange issue on Intel integrated cards (on desktop and laptops), while using VBO. App crash because it writes data to VBO buffer.
- Create VBO and fill data
- bind and render -> OK
- bind and update data -> OK
- bind and render -> OK
- bind and update data -> crash in driver
It crashes no matter what I tried to do.. glBufferSubData or glMapBuffer + memcpy. glMapBuffer returns valid pointer and app crash even if I write only one byte to VBO memory. There is no buffer overrun.
ATM.. I disabled VBO when app run on Intel gfx and use good-old vertex arrays.

I found VBO examples on internet which correctly maps VBO's and update data and it work on Intel too.
Only difference between that sample and my app is that I use two VBO's.. texure coordinates and color in 1st VBO and position and normal in 2nd VBO (because of software skinning).

One more question... Is below code have same funcionality:


BindBufferARB(ARRAY_BUFFER_ARB, vbo1);
VertexPointer(4, FLOAT, 0, BUFFER_OFFSET(0));

BindBufferARB(ARRAY_BUFFER_ARB, vbo2);
ColorPointer(4, UNSIGNED_BYTE, 0, BUFFER_OFFSET(256));

// Enable arrays
EnableClientState(VERTEX_ARRAY);
EnableClientState(COLOR_ARRAY);

// draw code


and



BindBufferARB(ARRAY_BUFFER_ARB, vbo1);
VertexPointer(4, FLOAT, 0, BUFFER_OFFSET(0));
EnableClientState(VERTEX_ARRAY);

BindBufferARB(ARRAY_BUFFER_ARB, vbo2);
ColorPointer(4, UNSIGNED_BYTE, 0, BUFFER_OFFSET(256));
EnableClientState(COLOR_ARRAY);

// draw code

dorbie
03-11-2010, 08:26 PM
Nothing wrong here, but you aren't showing the important part, do you map the buffer for writes then unmap for rendering? You can't just write to a VBO it's an explicit mechanism for enforcing non-volatility.

yooyo
03-12-2010, 06:57 AM
Im doing this:


glBindBuffer( GL_ARRAY_BUFFER_ARB, m_DynVBOVertices );
if (!m_DirtyDynamicBlocks.empty())
{
size_t i;
for (i=0; i<m_DirtyDynamicBlocks.size(); i++)
{
tDirtyBlock&amp; b = m_DirtyDynamicBlocks[i];
glBufferSubData(GL_ARRAY_BUFFER_ARB, b.offset, b.size, m_DynData + b.offset);
}
m_DirtyDynamicBlocks.clear();
}


I tried to change glBufferSubData call with:


unsigned char* ptr = (unsigned char*)glMapBuffer(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY);
if (ptr != NULL)
{
memcpy(ptr + b.offset, m_DynData + b.offset, b.size);
glUnmapBuffer(GL_ARRAY_BUFFER_ARB);
}


In both case it works on NVidia hw, but crash on Intel in driver after 2nd frame. Client states for attributes in this VBO buffer are disabled before updates.
Pointer returned by glMapBuffer is always != NULL but it crash even if I try to write only one byte.

randall
03-12-2010, 07:15 AM
What is the value of b.offset when your application crashes? Try to set it to be multiple of 4.

yooyo
03-12-2010, 07:50 AM
Vertex have 6 floats (vec3 pos and vec3 normal) which is 24 bytes long.. so offset is always properly aligned.

Latest update: Now works.. I removed some code which displays 3D text (characters was in display lists created by wglUseFontOutlines). If draw any 3d text it crashes in VBO uploading.

Poor Intel...