Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


Division by zero and AMD


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 V-man   Members   -  Reputation: 805

Like
0Likes
Like

Posted 03 February 2013 - 06:45 AM

We have a project written in VB6. It uses GL 1.1. It runs fine on multiple Windows versions and different cards.

But with the Catalyst 13.1 driver and also previous one, "division by zero" message is getting thrown.

 

It happens on HD 5450, Win 7 32 bit and also on another HD series card.

It happens on simple functions like glScalef and glScissor.

The values being submitted to those functions are fine so I don't understand what the problem is. There is some behind the scene thing happening in the AMD drivers.


Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

Sponsor:

#2 wintertime   Members   -  Reputation: 1790

Like
0Likes
Like

Posted 03 February 2013 - 10:28 AM

If you know two special driver versions are not working then you just use some other driver version? Or if you have too much spare time you can rewrite your program to use a modern OpenGL version without those deprecated functions.

Edited by wintertime, 03 February 2013 - 10:29 AM.


#3 Ohforf sake   Members   -  Reputation: 1832

Like
0Likes
Like

Posted 03 February 2013 - 11:19 AM

Back in the days when I was using Borland compilers, there used to be this weird issue that OpenGL would occasionally throw floating point division by zero exceptions and you had to manually disable FP-exceptions. I believe that those were from the software vertex transformation which should reside in the GPU for most cards these days, but who knows.

I am using gcc now, where FP-exceptions are disabled by default, so I don't know if all of this is still an issue.

 

Can you check if your exception is a FP or integer exception and if FP-exceptions are enabled in your build?

 

std::cout << 1.0f/0.0f << std::endl;
E.g. should return "inf" and not throw an exception.

#4 V-man   Members   -  Reputation: 805

Like
0Likes
Like

Posted 03 February 2013 - 12:57 PM

wintertime : the driver that comes on the CD for the video card works fine. Rewriting the entire code would be too drastic and it also doesn't mean that it would solve the problem.

 

Ohforf sake : yes, I remember reading about that, back in 2000 or 2001. But in my case, is the AMD driver enabling exception? I don't know how to check if it is integer or floating point exception in VB6.


Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

#5 V-man   Members   -  Reputation: 805

Like
0Likes
Like

Posted 06 February 2013 - 09:06 AM

A SOLUTION IS FOUND.

In VB6, go to project properties, click on compile tab.

Press the Advanced Optimizations button.

Click on Remove floating point exceptions check.



I had already done this in my project but for some reason, my partner's VB6 did not have that checked.


Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS