Division by zero and AMD

Started by
3 comments, last by V-man 11 years, 2 months ago

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);
Advertisement
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.

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.

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);

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);

This topic is closed to new replies.

Advertisement