cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

coonoor
Journeyman III

ATI Driver Bug when mat4's are compared in shaders (windows xp and linux - ubuntu 10.04)

Operations that invlove comparison of mat4 matrices fails. Comparing the same matrices element by element succeeds

Hi,

 

 I am experiencing the following failure with my ATI GPU Drivers. This could be a problem with the GL Shader Compiler  that is used by the ATI Drivers.

Configuration

OS - Microsoft Windows XP Professional with SP2

GPU - ATO Radeon HD 2600 Pro

Driver version - 10.4 (from ATI Website)

Shader Program

The following shader returns incorrect result.

const mat4 ones_mat = mat4(1.0, 1.0, 1.0, 1.0,
               1.0, 1.0, 1.0, 1.0,
               1.0, 1.0, 1.0, 1.0,
               1.0, 1.0, 1.0, 1.0);
const mat4 zeros_mat = mat4(0.0, 0.0, 0.0, 0.0,
                0.0, 0.0, 0.0, 0.0,
                0.0, 0.0, 0.0, 0.0,
                0.0, 0.0, 0.0, 0.0);

bool matrix_equal(const in mat4 value, const in mat4 reference);
bool elements_equal(const in mat4 par, const in float value);

void main()
{
        mat4 var;
        var = ones_mat;
        if( matrix_equal(var, ones_mat ) )
            gl_FragColor = vec4(0.4,0.4,0.8,1.0);
}

bool matrix_equal(const in mat4 value, const in mat4 reference)
{
     if(value == reference)
         return true;
     else
         return false;

}

In the above shader, gl_FragColor should always be set to  vec4(0.4,0.4,0.8,1.0) as the comparison operations should return true. The comparison opeartion fails and hence the shader returns the uninitialized value (black color).

Comparing the matrices element by element returns the correct result. The complete fragment shader has been attached.

We have verified the shader with other GPUs (NVIDIA) and they return the expected ouput.  The problem has also been found with the latest ATI Drivers for Linux.

Linux Configuration

ATI Proprietary Linux Driver - 8.723

GPU - ATI Radeon HD 2600 Pro

 

Please let me know if a formal bug report needs to be raised. I am unsure of the forum it needs to be raised and hence posting it here.

 

Regards

Karthik

const mat4 ones_mat = mat4(1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0); bool matrix_equal(const in mat4 value, const in mat4 reference); bool elements_equal(const in mat4 par, const in float value); void main() { mat4 var; var = ones_mat; if( matrix_equal(var, ones_mat ) ) // if( elements_equal(var, 1.0) ) gl_FragColor = vec4(0.4,0.4,0.8,1.0); } bool matrix_equal(const in mat4 value, const in mat4 reference) { if(value == reference) return true; else return false; } bool elements_equal(const in mat4 par, const in float value) { bool ret = true; if(par[0][0] != value) ret = false; if(par[0][1] != value) ret = false; if(par[0][2] != value) ret = false; if(par[0][3] != value) ret = false; if(par[1][0] != value) ret = false; if(par[1][1] != value) ret = false; if(par[1][2] != value) ret = false; if(par[1][3] != value) ret = false; if(par[2][0] != value) ret = false; if(par[2][1] != value) ret = false; if(par[2][2] != value) ret = false; if(par[2][3] != value) ret = false; if(par[3][0] != value) ret = false; if(par[3][1] != value) ret = false; if(par[3][2] != value) ret = false; if(par[3][3] != value) ret = false; return ret; }

0 Likes
13 Replies