Go Back   nV News Forums > Linux Support Forums > NVIDIA Linux

Newegg Daily Deals

Reply
 
Thread Tools
Old 10-09-09, 01:42 PM   #1
kwvtk
Registered User
 
Join Date: Oct 2008
Posts: 17
Default BUG: glDrawArrays() segfaults with glEdgeFlagPointer() and buffer objects

Hello,

The minimal attached sample code crashes when using glEdgeFlagPointer() on a buffer object.

More exactly:
1. if the buffer object is created, bound, allocated and fed with data and used directly by glEdgeFlagPointer(), it works fine (see drawWithVBO1() in the source code)

2. if the buffer object is created, bound, allocated and fed with data, unbound, re-bound later on to be used by glEdgeFlagPointer(), it crashes (see drawWithVBO2() in the source code)

The machine is a notebook Dell Precision M6300 with an nVidia Quadro FX 3600M, 512MB.
The OS is Ubuntu x86_64 9.04
The nVidia driver is 180.44 from the Ubuntu package.

The source code contains the command line to build the executable. It requires glut and glew.

Regards.

--
François Bertel, PhD | Kitware Inc. Suite 204
1 (518) 371 3971 x113 | 28 Corporate Drive
| Clifton Park NY 12065, USA

PS:
here is the part of the source code that works fine
Code:
void drawWithVBO1()
{
  GLuint pos;
  GLuint f;

  glGenBuffers(1,&pos);
  glGenBuffers(1,&f);

  glBindBuffer(GL_ARRAY_BUFFER,pos);
  glBufferData(GL_ARRAY_BUFFER,9*sizeof(GLfloat),positions,GL_STATIC_DRAW);
  glVertexPointer(3,GL_FLOAT,0,0);

  glBindBuffer(GL_ARRAY_BUFFER,f);
  glBufferData(GL_ARRAY_BUFFER,3*sizeof(GLboolean),flags,GL_STATIC_DRAW);
  glEdgeFlagPointer(0,0);
  glBindBuffer(GL_ARRAY_BUFFER,0);

  glEnableClientState(GL_VERTEX_ARRAY);
  glEnableClientState(GL_EDGE_FLAG_ARRAY);

  glDrawArrays(GL_TRIANGLES,0,3); // a single triangle

  glDisableClientState(GL_VERTEX_ARRAY);
  glDisableClientState(GL_EDGE_FLAG_ARRAY);

  glDeleteBuffers(1,&pos);
  glDeleteBuffers(1,&f);
}
here is the part of the source code that causes the crash

Code:
void drawWithVBO2()
{
  GLuint pos;
  GLuint f;

  glGenBuffers(1,&pos);
  glGenBuffers(1,&f);

  glBindBuffer(GL_ARRAY_BUFFER,pos);
  glBufferData(GL_ARRAY_BUFFER,9*sizeof(GLfloat),positions,GL_STATIC_DRAW);
  glBindBuffer(GL_ARRAY_BUFFER,f);
  glBufferData(GL_ARRAY_BUFFER,3*sizeof(GLboolean),flags,GL_STATIC_DRAW);
  glBindBuffer(GL_ARRAY_BUFFER,0);

  glBindBuffer(GL_ARRAY_BUFFER,f);
  glEdgeFlagPointer(0,0);
  glBindBuffer(GL_ARRAY_BUFFER,pos);
  glVertexPointer(3,GL_FLOAT,0,0);
  glBindBuffer(GL_ARRAY_BUFFER,0);

  glEnableClientState(GL_VERTEX_ARRAY);
  glEnableClientState(GL_EDGE_FLAG_ARRAY); // remove this line, prevent CRASH

  glDrawArrays(GL_TRIANGLES,0,3); // a single triangle

  glDisableClientState(GL_VERTEX_ARRAY);
  glDisableClientState(GL_EDGE_FLAG_ARRAY);

  glDeleteBuffers(1,&pos);
  glDeleteBuffers(1,&f);
}
Attached Files
File Type: gz nvidia-bug-report.log.gz (44.3 KB, 78 views)
File Type: gz main.c.gz (1.5 KB, 90 views)
kwvtk is offline   Reply With Quote
Old 10-09-09, 01:48 PM   #2
kwvtk
Registered User
 
Join Date: Oct 2008
Posts: 17
Default Re: BUG: glDrawArrays() segfaults with glEdgeFlagPointer() and buffer objects

In case it is relevant, I don't use compiz.
kwvtk is offline   Reply With Quote
Old 10-09-09, 02:32 PM   #3
AaronP
NVIDIA Corporation
 
AaronP's Avatar
 
Join Date: Mar 2005
Posts: 2,487
Default Re: BUG: glDrawArrays() segfaults with glEdgeFlagPointer() and buffer objects

In the future, before reporting a problem please check to see if it's already fixed in a newer release. In this case, I reproduced the problem with 180.44 and found that it was fixed in the current stable release, 185.18.36.
AaronP is offline   Reply With Quote
Old 10-09-09, 03:59 PM   #4
kwvtk
Registered User
 
Join Date: Oct 2008
Posts: 17
Default Re: BUG: glDrawArrays() segfaults with glEdgeFlagPointer() and buffer objects

Hello,

Thanks for the prompt response. Glad to know it is fixed in a more recent driver!

I apologize for not checking with the latest release driver. I hope the upcoming Ubuntu 9.10 will integrate a driver version that has the fix.

Do you know the exact driver version from which this bug has been fixed? I ask this question because I'd like to add some workaround code for this bug in my projects so I can still use edgeflag in the main path and add an alternate code, maybe slower and cumbersome but still robust to crash with faulty drivers.

I also hope that the OpenGL Linux driver developers at nVidia will add a regression test based on the sample code I posted to prevent this bug to re-appear in any future release: it was kind of hard to isolate the faulty piece of code (at first, I did not know if it was a bug in my code or in the driver).

Thanks again!
kwvtk is offline   Reply With Quote
Old 10-28-09, 01:40 PM   #5
kwvtk
Registered User
 
Join Date: Oct 2008
Posts: 17
Default Re: BUG: glDrawArrays() segfaults with glEdgeFlagPointer() and buffer objects

Just a follow-up, in case other people run into the same issue, I tested the following driver versions (on Windows, but 90% of the driver is cross-platform http://www.phoronix.com/scan.php?pag...qa_linux&num=2) and they were affected as well:

162.62
169.96
175.75
178.13
182.46

An update to 191.00 fixed the bug.
kwvtk is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 06:10 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright ©1998 - 2014, nV News.